Class: TCGplayerAPI
- Inherits:
-
Object
- Object
- TCGplayerAPI
- Defined in:
- lib/tcgplayer_api.rb
Constant Summary collapse
- VERSION =
'0.0.4'
- BASE_URL =
'http://partner.tcgplayer.com/x3'
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
-
.partner_key ⇒ Object
Returns the value of attribute partner_key.
Class Method Summary collapse
-
.price_points(card_name, set_name = nil) ⇒ Object
Fetch High/Mid/Low prices for the given card.
-
.vendor_prices(card_name, set_name = nil) ⇒ Object
Fetch prices from eight vendors for the given card printing.
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
8 9 10 |
# File 'lib/tcgplayer_api.rb', line 8 def logger @logger end |
.partner_key ⇒ Object
Returns the value of attribute partner_key.
8 9 10 |
# File 'lib/tcgplayer_api.rb', line 8 def partner_key @partner_key end |
Class Method Details
.price_points(card_name, set_name = nil) ⇒ Object
Fetch High/Mid/Low prices for the given card. If set_name is excluded, returns the cheapest printing across all sets.
13 14 15 16 17 18 19 20 |
# File 'lib/tcgplayer_api.rb', line 13 def price_points(card_name, set_name=nil) request_params = {p: card_name} request_params[:s] = set_name unless set_name.to_s.strip.empty? response = get('/phl.asmx/p', request_params) @logger.info("RESPONSE #{response}") if @logger raise response['error']['message'] if response['error'] return response['products']['product'] end |
.vendor_prices(card_name, set_name = nil) ⇒ Object
Fetch prices from eight vendors for the given card printing.
23 24 25 26 27 28 29 30 |
# File 'lib/tcgplayer_api.rb', line 23 def vendor_prices(card_name, set_name=nil) request_params = {p: card_name, v: 8} # Default to the maximum of 8 results request_params[:s] = set_name unless set_name.to_s.strip.empty? response = get('/pv.asmx/p', request_params) @logger.info("RESPONSE #{response}") if @logger raise response['error']['message'] if response['error'] return response['prices'] end |