Class: Gorgerb::Client
- Inherits:
-
Object
- Object
- Gorgerb::Client
- Defined in:
- lib/gorgerb/client.rb
Instance Method Summary collapse
-
#initialize(url, user: nil, password: nil, connect_timeout: 1, timeout: 2, user_agent: 'gorgerb') ⇒ Client
constructor
A new instance of Client.
- #player_statistics(steam_id) ⇒ Object
Constructor Details
#initialize(url, user: nil, password: nil, connect_timeout: 1, timeout: 2, user_agent: 'gorgerb') ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/gorgerb/client.rb', line 5 def initialize(url, user: nil, password: nil, connect_timeout: 1, timeout: 2, user_agent: 'gorgerb') @url = url @http_user = user @http_password = password @connect_timeout = connect_timeout @timeout = timeout Typhoeus::Config.user_agent = user_agent end |
Instance Method Details
#player_statistics(steam_id) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/gorgerb/client.rb', line 16 def player_statistics(steam_id) response = request("players/#{ steam_id }/statistics") PlayerStatistics.from_hsh(response) rescue KeyError => e raise APIError, "Incomplete JSON returned: #{ e. }" end |