Class: Marver::API::Client
- Inherits:
-
Object
- Object
- Marver::API::Client
- Defined in:
- lib/marver/api/client.rb
Constant Summary collapse
- API_VERSION =
"v1"
- API_ENDPOINT =
"http://gateway.marvel.com"
Instance Method Summary collapse
Instance Method Details
#credentials ⇒ Object
25 26 27 |
# File 'lib/marver/api/client.rb', line 25 def credentials Credentials.get end |
#endpoint ⇒ Object
21 22 23 |
# File 'lib/marver/api/client.rb', line 21 def endpoint "#{API_ENDPOINT}/#{API_VERSION}/public" end |
#get(entity, options) ⇒ Object
10 11 12 13 14 |
# File 'lib/marver/api/client.rb', line 10 def get(entity, ) url = "#{endpoint}/#{entity.to_s}" json = RestClient.get url, { params: .merge(credentials) } Marver::API::Response.new(json) end |
#get_uri(uri) ⇒ Object
16 17 18 19 |
# File 'lib/marver/api/client.rb', line 16 def get_uri(uri) response = RestClient.get uri, { params: credentials } Marver::API::Response.new(response) end |