Class: Thanos::API::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/thanos/api/client.rb

Constant Summary collapse

API_VERSION =
'v1'
API_ENDPOINT =
'http://gateway.marvel.com'

Instance Method Summary collapse

Instance Method Details

#authenticationObject



21
22
23
# File 'lib/thanos/api/client.rb', line 21

def authentication
  Authentication.get
end

#endpointObject



17
18
19
# File 'lib/thanos/api/client.rb', line 17

def endpoint
  "#{API_ENDPOINT}/#{API_VERSION}/public"
end

#get(resource, options) ⇒ Object



11
12
13
14
15
# File 'lib/thanos/api/client.rb', line 11

def get(resource, options)
  url = "#{endpoint}/#{resource}"
  response = RestClient.get(url, params: options.merge(authentication))
  Thanos::API::Response.new(response)
end