Class: MoresMarvel::Client
- Inherits:
-
Object
- Object
- MoresMarvel::Client
- Includes:
- Resource
- Defined in:
- lib/mores_marvel/client.rb
Defined Under Namespace
Classes: ServiceClientError
Instance Method Summary collapse
- #get_resource(resource, filters = {}) ⇒ Object
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
Methods included from Resource
#fetch_all, #fetch_by_id, #fetch_filtered_by, #get_character, #get_characters
Constructor Details
#initialize(config) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 |
# File 'lib/mores_marvel/client.rb', line 11 def initialize config @public_key = config[:public_key] @private_key = config[:private_key] @base_uri = config[:base_uri] end |
Instance Method Details
#get_resource(resource, filters = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/mores_marvel/client.rb', line 17 def get_resource(resource, filters = {}) api_end_point = "#{@base_uri}#{resource}" url_params = filters.empty? ? security_hash : security_hash.merge(filters) restructure_response RestClient.get(api_end_point, { params: url_params }) end |