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.
- checksums.yaml +4 -4
- data/lib/tcgplayer_api.rb +10 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eb669957c7ad94e0c4d08a29ff2e357d9a075ce
|
4
|
+
data.tar.gz: f5b978a08e2036f453ae82e7c84d3429f9619b98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d6297178f62ab0e03bbdb2865838473d31734539fe945c5b7427837f5ea144f10b50a515c88e1334bf5ab6389ce8d6db5beda4fe989bf8eadb9ca8c9d0d56c
|
7
|
+
data.tar.gz: 143c8a1cf7b226bc948219a47ad619bcac6e62f58da1b6be9198cb750771c1f35ed78f7d6186938f5a3580e2a1aeb430b0a1d7b05ac7b88219809469d211ba39
|
data/lib/tcgplayer_api.rb
CHANGED
@@ -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.
|
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)
|
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)
|
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.
|
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:
|
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.
|
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
|