tcgplayer_api 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tcgplayer_api.rb +10 -4
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebb110e71f6ccd18923471377d7784747e612e0a
4
- data.tar.gz: 987e0409d3eeeb389c35895060fe79418b693437
3
+ metadata.gz: 0eb669957c7ad94e0c4d08a29ff2e357d9a075ce
4
+ data.tar.gz: f5b978a08e2036f453ae82e7c84d3429f9619b98
5
5
  SHA512:
6
- metadata.gz: 3c18748c03432deade4b5cb5dba21506bab33af7870e1e436fc82cc21849880c6c432e5c4bea2f81889e30ccc9af04a202d87082523b220cff07bf0308008d43
7
- data.tar.gz: 038aa6d58cf0396409a50612d917275b35cd7a1f381b4e4add1ff6b67a274ac19589ecb619c967a45419e0406c5f1eade67d97289cd1681f479fbe7cc5951de9
6
+ metadata.gz: f9d6297178f62ab0e03bbdb2865838473d31734539fe945c5b7427837f5ea144f10b50a515c88e1334bf5ab6389ce8d6db5beda4fe989bf8eadb9ca8c9d0d56c
7
+ data.tar.gz: 143c8a1cf7b226bc948219a47ad619bcac6e62f58da1b6be9198cb750771c1f35ed78f7d6186938f5a3580e2a1aeb430b0a1d7b05ac7b88219809469d211ba39
@@ -2,7 +2,7 @@ require 'active_support/core_ext/hash/conversions'
2
2
  require 'open-uri'
3
3
 
4
4
  class TCGplayerAPI
5
- VERSION = '0.0.3'
5
+ VERSION = '0.0.4'
6
6
 
7
7
  class << self
8
8
  attr_accessor :partner_key, :logger
@@ -13,14 +13,20 @@ class TCGplayerAPI
13
13
  def price_points(card_name, set_name=nil)
14
14
  request_params = {p: card_name}
15
15
  request_params[:s] = set_name unless set_name.to_s.strip.empty?
16
- get('/phl.asmx/p', request_params)["products"]["product"]
16
+ response = get('/phl.asmx/p', request_params)
17
+ @logger.info("RESPONSE #{response}") if @logger
18
+ raise response['error']['message'] if response['error']
19
+ return response['products']['product']
17
20
  end
18
21
 
19
22
  # Fetch prices from eight vendors for the given card printing.
20
23
  def vendor_prices(card_name, set_name=nil)
21
24
  request_params = {p: card_name, v: 8} # Default to the maximum of 8 results
22
25
  request_params[:s] = set_name unless set_name.to_s.strip.empty?
23
- get('/pv.asmx/p', request_params)["prices"]
26
+ response = get('/pv.asmx/p', request_params)
27
+ @logger.info("RESPONSE #{response}") if @logger
28
+ raise response['error']['message'] if response['error']
29
+ return response['prices']
24
30
  end
25
31
 
26
32
  private
@@ -30,7 +36,7 @@ class TCGplayerAPI
30
36
  encoded_params = '?' + URI.encode_www_form(params)
31
37
  url = [BASE_URL, endpoint, encoded_params].join
32
38
  @logger.info "GET #{url}" if @logger
33
- Hash.from_xml open(url)
39
+ return Hash.from_xml open(url)
34
40
  end
35
41
 
36
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tcgplayer_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabe Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-25 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  requirements: []
54
54
  rubyforge_project:
55
- rubygems_version: 2.2.2
55
+ rubygems_version: 2.6.10
56
56
  signing_key:
57
57
  specification_version: 4
58
58
  summary: Ruby interface for TCGplayer's pricing API