tcgplayer_api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/tcgplayer_api.rb +35 -0
- metadata +59 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4708223da1413c5688b1955d9a30c2c6d74642df
|
4
|
+
data.tar.gz: 66f027a8cf2e1bc15c4f14a86ab51f88ec3b1222
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e571494df04216947eda482d277608c42327ab2be0e5497b95e697fa1b57e15b5496670e677b58308d31eda1315ab30b0c08d0e329142dd31b83a891d5f23696
|
7
|
+
data.tar.gz: 013a2ad1169a03d4b18d5644ec94c80eb87d43f0d6e95c37c4663bde4bfd17c4a3a85af2d49152c317ab2b2d0ffb8fd9b5c3b042f8fb18168bdfc1614a31c76c
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'active_support/core_ext/hash/conversions'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
class TCGplayerAPI
|
5
|
+
VERSION = '0.0.1'
|
6
|
+
|
7
|
+
class << self
|
8
|
+
BASE_URL = 'http://partner.tcgplayer.com/x3'
|
9
|
+
|
10
|
+
# Fetch High/Mid/Low prices for the given card. If set_name is excluded,
|
11
|
+
# returns the cheapest printing across all sets.
|
12
|
+
def price_points(card_name, set_name=nil)
|
13
|
+
request_params = {p: card_name}
|
14
|
+
request_params[:s] = set_name unless set_name.to_s.strip.empty?
|
15
|
+
get('/phl.asmx/p', request_params)["products"]["product"]
|
16
|
+
end
|
17
|
+
|
18
|
+
# Fetch prices from eight vendors for the given card printing.
|
19
|
+
def vendor_prices(card_name, set_name=nil)
|
20
|
+
request_params = {p: card_name, v: 8} # Default to the maximum of 8 results
|
21
|
+
request_params[:s] = set_name unless set_name.to_s.strip.empty?
|
22
|
+
get('/pv.asmx/p', request_params)["prices"]
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def get(endpoint, params)
|
28
|
+
params[:pk] = 'TCGTEST'
|
29
|
+
encoded_params = '?' + URI.encode_www_form(params)
|
30
|
+
url = [BASE_URL, endpoint, encoded_params].join
|
31
|
+
Hash.from_xml open(url)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tcgplayer_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gabe Smith
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Ruby interface for TCGplayer's pricing API
|
28
|
+
email:
|
29
|
+
- sgt.floydpepper@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/tcgplayer_api.rb
|
35
|
+
homepage: https://github.com/sgtFloyd/tcgplayer_api
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 2.2.2
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: Ruby interface for TCGplayer's pricing API
|
59
|
+
test_files: []
|