Class: HearthstoneCardApi::Caller
- Inherits:
-
Object
- Object
- HearthstoneCardApi::Caller
- Defined in:
- lib/hearthstone_card_api/caller.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#collectible ⇒ Object
Returns the value of attribute collectible.
-
#filters ⇒ Object
Returns the value of attribute filters.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Caller
constructor
A new instance of Caller.
- #return_cards(args = {}) ⇒ Object
- #return_info(url) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Caller
Returns a new instance of Caller.
6 7 8 9 10 11 12 |
# File 'lib/hearthstone_card_api/caller.rb', line 6 def initialize(args={}) @api_key = HearthstoneCardApi.api_key @api_url = "https://omgvamp-hearthstone-v1.p.mashape.com/" @collectible = "1" @filters = {cost: nil, attack: nil, health: nil, durability: nil} end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/hearthstone_card_api/caller.rb', line 4 def api_key @api_key end |
#api_url ⇒ Object
Returns the value of attribute api_url.
4 5 6 |
# File 'lib/hearthstone_card_api/caller.rb', line 4 def api_url @api_url end |
#collectible ⇒ Object
Returns the value of attribute collectible.
4 5 6 |
# File 'lib/hearthstone_card_api/caller.rb', line 4 def collectible @collectible end |
#filters ⇒ Object
Returns the value of attribute filters.
4 5 6 |
# File 'lib/hearthstone_card_api/caller.rb', line 4 def filters @filters end |
Instance Method Details
#return_cards(args = {}) ⇒ Object
14 15 16 17 |
# File 'lib/hearthstone_card_api/caller.rb', line 14 def return_cards(args={}) url = add_filters_to_url(args) api_response(endpoint(url)) end |
#return_info(url) ⇒ Object
19 20 21 |
# File 'lib/hearthstone_card_api/caller.rb', line 19 def return_info(url) api_response(endpoint(url)) end |