Class: Steam::Client
- Inherits:
-
Object
- Object
- Steam::Client
- Defined in:
- lib/steam-api/client.rb
Overview
Client object used to communicate with the steam webapi
Instance Method Summary collapse
-
#get(resource, params: {}, key: Steam.apikey) ⇒ Object
overriding the get method of Faraday to make things simpler.
-
#initialize(url) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(url) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/steam-api/client.rb', line 5 def initialize(url) @conn = Faraday.new(url: url) end |
Instance Method Details
#get(resource, params: {}, key: Steam.apikey) ⇒ Object
overriding the get method of Faraday to make things simpler.
13 14 15 16 17 18 19 |
# File 'lib/steam-api/client.rb', line 13 def get(resource, params: {}, key: Steam.apikey) params[:key] = key response = @conn.get resource, params JSON.parse(response.body) rescue JSON::ParserError { error: '500 Internal Server Error' } end |