Class: Marvell::Client
- Inherits:
-
Object
- Object
- Marvell::Client
- Includes:
- HTTParty
- Defined in:
- lib/marvell/client.rb
Instance Attribute Summary collapse
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
Instance Method Summary collapse
-
#character(params) ⇒ Object
Takes a character ID.
- #characters(params = {}) ⇒ Object
- #comic(params) ⇒ Object
- #comics(params = {}) ⇒ Object
- #creator(params) ⇒ Object
- #creators(params = {}) ⇒ Object
- #event(params) ⇒ Object
- #events(params = {}) ⇒ Object
-
#initialize(params) ⇒ Client
constructor
A new instance of Client.
- #serie(params) ⇒ Object
- #series(params = {}) ⇒ Object
- #stories(params = {}) ⇒ Object
- #story(params) ⇒ Object
Constructor Details
#initialize(params) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/marvell/client.rb', line 9 def initialize(params) @public_key = params[:public_key] @private_key = params[:private_key] end |
Instance Attribute Details
#private_key ⇒ Object (readonly)
Returns the value of attribute private_key.
13 14 15 |
# File 'lib/marvell/client.rb', line 13 def private_key @private_key end |
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
13 14 15 |
# File 'lib/marvell/client.rb', line 13 def public_key @public_key end |
Instance Method Details
#character(params) ⇒ Object
Takes a character ID
16 17 18 |
# File 'lib/marvell/client.rb', line 16 def character(params) characters(id: params[:id]).first end |
#characters(params = {}) ⇒ Object
20 21 22 |
# File 'lib/marvell/client.rb', line 20 def characters(params = {}) get_and_parse_collection "characters", params end |
#comic(params) ⇒ Object
24 25 26 |
# File 'lib/marvell/client.rb', line 24 def comic(params) comics(id: params[:id]).first end |
#comics(params = {}) ⇒ Object
28 29 30 |
# File 'lib/marvell/client.rb', line 28 def comics(params = {}) get_and_parse_collection "comics", params end |
#creator(params) ⇒ Object
32 33 34 |
# File 'lib/marvell/client.rb', line 32 def creator(params) creators(id: params[:id]).first end |
#creators(params = {}) ⇒ Object
36 37 38 |
# File 'lib/marvell/client.rb', line 36 def creators(params = {}) get_and_parse_collection "creators", params end |
#event(params) ⇒ Object
56 57 58 |
# File 'lib/marvell/client.rb', line 56 def event(params) events(id: params[:id]).first end |
#events(params = {}) ⇒ Object
60 61 62 |
# File 'lib/marvell/client.rb', line 60 def events(params = {}) get_and_parse_collection "events", params end |
#serie(params) ⇒ Object
48 49 50 |
# File 'lib/marvell/client.rb', line 48 def serie(params) series(id: params[:id]).first end |
#series(params = {}) ⇒ Object
52 53 54 |
# File 'lib/marvell/client.rb', line 52 def series(params = {}) get_and_parse_collection "series", params end |
#stories(params = {}) ⇒ Object
44 45 46 |
# File 'lib/marvell/client.rb', line 44 def stories(params = {}) get_and_parse_collection "stories", params end |
#story(params) ⇒ Object
40 41 42 |
# File 'lib/marvell/client.rb', line 40 def story(params) stories(id: params[:id]).first end |