Class: Destiny::Client

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

#accountObject

Returns the value of attribute account.



7
8
9
# File 'lib/destiny/client.rb', line 7

def 
  @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