Skip to content

curtydudes/batch9-activities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

API Wrapper using RAWG.IO

Avion School Rails Activity

image

References:

Documentation link: https://api.rawg.io/docs/

How to use the RAWG.IO API?

Go to RAWG.IO and create an account
Push the API Button in the top right and will lead you to another page. Press the said button in the image.

image

This will lead you to the page to get your own API Key. Take note that the key expires in a month after you activate it.
Highly Recommended: Clone a repository into your work.
REST is used for this API Wrapper project so go ahead and follow the instructions here: https://rubygems.org/gems/rest-client/versions/2.1.0 to install the REST Gem.
You may read more of the documentation by checking out this link: https://github.com/rest-client/rest-client
Once you have everything set and read, run bundle install.
run bundle install

Using the API Wrapper

You may now call on the API from RAWG as you follow the documentation of REST-Client here: https://rubydoc.info/github/rest-client/rest-client/master
You may test the API via Postman.

Checking out my code

If you're going to check out my code, these are the routes or data that I got from API to my localhost.
  namespace :api do
    get '/creator-roles' => 'creator_roles#index'
    get '/developers' => 'developers#index'
    get '/genres' => 'genres#index'
    get '/platforms' => 'platforms#index'
    get '/platforms_parents' => 'platforms_parents#index'
    get '/creator-roles' => 'creator_roles#index'
  namespace :rawgames do
      get '/games' => 'games#index'
    end
  end
As you noticed, I created another subfolder in my controller folder hence the nesting of :rawgames in the routing. I wanted to experiment on the namespacing assuming that I created another subfolder. I wanted to see what changes will happen. I let the changes stay there so I will also have my own reference.

Testing Errors

If the test is successful, using Postmanm, this will be the outcome:

image

If the test is unsuccessful, I've created in the controllers, a response to errors. This is one of them:

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors