Class: Luchadeer::Client

Inherits:
Object
  • Object
show all
Includes:
API
Defined in:
lib/luchadeer/client.rb

Constant Summary collapse

GIANT_BOMB =
'http://www.giantbomb.com/api'

Constants included from API

API::RESOURCES

Instance Attribute Summary collapse

Attributes included from API

#cache

Instance Method Summary collapse

Methods included from API

#fetch

Constructor Details

#initialize(opts = {}) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:



17
18
19
20
# File 'lib/luchadeer/client.rb', line 17

def initialize(opts = {})
  @api_key = opts[:api_key] if opts[:api_key]
  yield self if block_given?
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



14
15
16
# File 'lib/luchadeer/client.rb', line 14

def api_key
  @api_key
end

Instance Method Details

#api_key?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/luchadeer/client.rb', line 26

def api_key?
  not (api_key.nil? || api_key == '')
end

#get(path, params = {}) ⇒ Object



30
31
32
# File 'lib/luchadeer/client.rb', line 30

def get(path, params = {})
  request(:get, path, params)
end

#user_agentObject



22
23
24
# File 'lib/luchadeer/client.rb', line 22

def user_agent
  "Luchadeer #{Luchadeer::VERSION}"
end