Class: Destiny::Client
- Inherits:
-
Object
- Object
- Destiny::Client
- Defined in:
- lib/destiny/client.rb
Overview
The Destiny::Client class is the primary class used to interact with the Destiny API
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_key) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/destiny/client.rb', line 9 def initialize(api_key) @client = Hurley::Client.new 'http://www.bungie.net/Platform/' @client.header['X-API-Key'] = api_key end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
7 8 9 |
# File 'lib/destiny/client.rb', line 7 def account @account end |
Class Method Details
.validate(response) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/destiny/client.rb', line 18 def self.validate(response) if response.success? JSON.parse response.body else raise 'There was a problem with the request' end end |