ebay-ruby 0.2.0 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +114 -9
- data/lib/ebay-ruby.rb +2 -0
- data/lib/ebay.rb +3 -9
- data/lib/ebay/browse.rb +164 -0
- data/lib/ebay/config.rb +33 -8
- data/lib/ebay/finding.rb +145 -5
- data/lib/ebay/merchandising.rb +92 -5
- data/lib/ebay/oauth/client_credentials_grant.rb +52 -0
- data/lib/ebay/requestable.rb +69 -0
- data/lib/ebay/shopping.rb +165 -6
- data/lib/ebay/version.rb +1 -1
- metadata +106 -64
- data/.gitignore +0 -5
- data/.travis.yml +0 -15
- data/Gemfile +0 -2
- data/Rakefile +0 -9
- data/ebay-ruby.gemspec +0 -22
- data/lib/ebay/parser.rb +0 -15
- data/lib/ebay/product.rb +0 -9
- data/lib/ebay/product_metadata.rb +0 -9
- data/lib/ebay/request.rb +0 -35
- data/test/cassettes/finding.yml +0 -135
- data/test/cassettes/merchandising.yml +0 -93
- data/test/cassettes/product.yml +0 -101
- data/test/cassettes/product_metadata.yml +0 -96
- data/test/cassettes/shopping.yml +0 -125
- data/test/helper.rb +0 -10
- data/test/test_finding.rb +0 -36
- data/test/test_merchandising.rb +0 -34
- data/test/test_parser.rb +0 -25
- data/test/test_product.rb +0 -38
- data/test/test_product_metadata.rb +0 -36
- data/test/test_shopping.rb +0 -34
@@ -1,96 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://svcs.sandbox.ebay.com/services/marketplacecatalog/ProductMetadataService/v1?GLOBAL-ID=EBAY-US&OPERATION-NAME=getProductSearchDataVersion&categoryId=123
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
X-EBAY-SOA-SECURITY-APPNAME:
|
11
|
-
- APP_ID
|
12
|
-
response:
|
13
|
-
status:
|
14
|
-
code: 200
|
15
|
-
message:
|
16
|
-
headers:
|
17
|
-
Server:
|
18
|
-
- Apache-Coyote/1.1
|
19
|
-
X-EBAY-SOA-SERVICE-METRICS:
|
20
|
-
- '6211150'
|
21
|
-
X-EBAY-SOA-REQUEST-ID:
|
22
|
-
- 145ed517-6580-a471-d312-7542ffffe3bd!ProductMetadataService!10.71.29.49!v3apifindingsandboxcore[]
|
23
|
-
X-EBAY-SOA-SERVICE-VERSION:
|
24
|
-
- 1.6.0
|
25
|
-
X-EBAY-SOA-LOCALE-LIST:
|
26
|
-
- en-US_US
|
27
|
-
X-EBAY-SOA-MESSAGE-PROTOCOL:
|
28
|
-
- NONE
|
29
|
-
X-EBAY-SOA-RESPONSE-DATA-FORMAT:
|
30
|
-
- XML
|
31
|
-
X-EBAY-SOA-GLOBAL-ID:
|
32
|
-
- EBAY-US
|
33
|
-
X-EBAY-SOA-OPERATION-NAME:
|
34
|
-
- getProductSearchDataVersion
|
35
|
-
X-EBAY-SOA-SERVICE-NAME:
|
36
|
-
- "{https://www.ebay.com/marketplace/marketplacecatalog/v1/services}ProductMetadataService"
|
37
|
-
Content-Type:
|
38
|
-
- text/xml;charset=UTF-8
|
39
|
-
Transfer-Encoding:
|
40
|
-
- ''
|
41
|
-
Date:
|
42
|
-
- Sun, 11 May 2014 22:05:10 GMT
|
43
|
-
body:
|
44
|
-
encoding: UTF-8
|
45
|
-
string: <?xml version='1.0' encoding='UTF-8'?><getProductSearchDataVersionResponse
|
46
|
-
xmlns="https://www.ebay.com/marketplace/marketplacecatalog/v1/services"><ack>Failure</ack><errorMessage><error><errorId>28</errorId><domain>Marketplace</domain><severity>Error</severity><category>System</category><message>Category
|
47
|
-
ID, 123, is invalid.</message><subdomain>MarketplaceCatalog</subdomain><parameter>123</parameter></error></errorMessage><version>1.6.0</version><timestamp>2014-05-11T22:05:10.104Z</timestamp></getProductSearchDataVersionResponse>
|
48
|
-
http_version:
|
49
|
-
recorded_at: Sun, 11 May 2014 22:05:09 GMT
|
50
|
-
- request:
|
51
|
-
method: get
|
52
|
-
uri: https://svcs.sandbox.ebay.com/services/marketplacecatalog/ProductMetadataService/v1?GLOBAL-ID=EBAY-US&OPERATION-NAME=getProductSearchDataVersion&RESPONSE-DATA-FORMAT=JSON&categoryId=123
|
53
|
-
body:
|
54
|
-
encoding: US-ASCII
|
55
|
-
string: ''
|
56
|
-
headers:
|
57
|
-
X-EBAY-SOA-SECURITY-APPNAME:
|
58
|
-
- APP_ID
|
59
|
-
response:
|
60
|
-
status:
|
61
|
-
code: 200
|
62
|
-
message:
|
63
|
-
headers:
|
64
|
-
Server:
|
65
|
-
- Apache-Coyote/1.1
|
66
|
-
X-EBAY-SOA-SERVICE-METRICS:
|
67
|
-
- '5185806'
|
68
|
-
X-EBAY-SOA-REQUEST-ID:
|
69
|
-
- 145ed526-7200-a471-d300-04c0ffffe557!ProductMetadataService!10.71.29.48!v3apifindingsandboxcore[]
|
70
|
-
X-EBAY-SOA-SERVICE-VERSION:
|
71
|
-
- 1.6.0
|
72
|
-
X-EBAY-SOA-LOCALE-LIST:
|
73
|
-
- en-US_US
|
74
|
-
X-EBAY-SOA-MESSAGE-PROTOCOL:
|
75
|
-
- NONE
|
76
|
-
X-EBAY-SOA-RESPONSE-DATA-FORMAT:
|
77
|
-
- JSON
|
78
|
-
X-EBAY-SOA-GLOBAL-ID:
|
79
|
-
- EBAY-US
|
80
|
-
X-EBAY-SOA-OPERATION-NAME:
|
81
|
-
- getProductSearchDataVersion
|
82
|
-
X-EBAY-SOA-SERVICE-NAME:
|
83
|
-
- "{https://www.ebay.com/marketplace/marketplacecatalog/v1/services}ProductMetadataService"
|
84
|
-
Content-Type:
|
85
|
-
- text/plain;charset=UTF-8
|
86
|
-
Transfer-Encoding:
|
87
|
-
- ''
|
88
|
-
Date:
|
89
|
-
- Sun, 11 May 2014 22:06:11 GMT
|
90
|
-
body:
|
91
|
-
encoding: UTF-8
|
92
|
-
string: '{"getProductSearchDataVersionResponse":[{"ack":["Failure"],"errorMessage":[{"error":[{"errorId":["28"],"domain":["Marketplace"],"severity":["Error"],"category":["System"],"message":["Category
|
93
|
-
ID, 123, is invalid."],"subdomain":["MarketplaceCatalog"],"parameter":["123"]}]}],"version":["1.6.0"],"timestamp":["2014-05-11T22:06:11.760Z"]}]}'
|
94
|
-
http_version:
|
95
|
-
recorded_at: Sun, 11 May 2014 22:06:11 GMT
|
96
|
-
recorded_with: VCR 2.9.0
|
data/test/cassettes/shopping.yml
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://open.api.sandbox.ebay.com/shopping?CALLNAME=FindHalfProducts&QueryKeywords=ernesto+laclau
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
X-EBAY-API-APP-ID:
|
11
|
-
- APP_ID
|
12
|
-
X-EBAY-API-VERSION:
|
13
|
-
- 799
|
14
|
-
response:
|
15
|
-
status:
|
16
|
-
code: 200
|
17
|
-
message:
|
18
|
-
headers:
|
19
|
-
Content-Type:
|
20
|
-
- text/xml;charset=utf-8
|
21
|
-
Cache-Control:
|
22
|
-
- no-cache
|
23
|
-
Expires:
|
24
|
-
- Sat, 25 Dec 1999 00:00:00 GMT
|
25
|
-
Last-Modified:
|
26
|
-
- Sun, 11 May 2014 21:37:30 GMT
|
27
|
-
Pragma:
|
28
|
-
- no-cache
|
29
|
-
Server:
|
30
|
-
- Apache-Coyote/1.1
|
31
|
-
X-EBAY-API-BUILD-TAG:
|
32
|
-
- E867_CORE_APILW2_16754878_R1
|
33
|
-
X-EBAY-API-POOL-NAME:
|
34
|
-
- ___cDRidW9rdDd1Zm1hZGh7Zml1Zg==
|
35
|
-
X-EBAY-API-SERVER-NAME:
|
36
|
-
- ___dm8ucnA3MyhjM2djMzJlKjc3LTI3KTE8KD41Pz43OzU=
|
37
|
-
X-EBAY-ESB-GUID:
|
38
|
-
- urn:uuid:F6312D3A17B1431B3A231610888800615421803067607
|
39
|
-
Date:
|
40
|
-
- Sun, 11 May 2014 21:37:30 GMT
|
41
|
-
Transfer-Encoding:
|
42
|
-
- ''
|
43
|
-
Connection:
|
44
|
-
- Keep-Alive
|
45
|
-
body:
|
46
|
-
encoding: UTF-8
|
47
|
-
string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <FindHalfProductsResponse
|
48
|
-
xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2014-05-11T21:37:30.214Z</Timestamp>\n
|
49
|
-
\ <Ack>Success</Ack>\n <Build>E867_CORE_APILW2_16754878_R1</Build>\n <Version>867</Version>\n
|
50
|
-
\ <PageNumber>1</PageNumber>\n <ApproximatePages>42</ApproximatePages>\n
|
51
|
-
\ <MoreResults>true</MoreResults>\n <TotalProducts>42</TotalProducts>\n
|
52
|
-
\ <Products>\n <Product>\n <Title>Hegemony and Socialist Strategy
|
53
|
-
: Towards a Radical Democratic Politics by Ernesto Laclau and Chantal Mouffe
|
54
|
-
(1985, Paperback)</Title>\n <DetailsURL>https://syicatalogs.sandbox.ebay.com/ws/eBayISAPI.dll?PageSyiProductDetails&IncludeAttributes=1&ShowAttributesTable=1&ProductMementoString=116501:2:1055:1801344777:636461977:f037f5013398147917ef7356f3f28683:1:1:1:411300</DetailsURL>\n
|
55
|
-
\ <StockPhotoURL>https://i.ebayimg.com/00/$T2eC16dHJG8E9nyfpmrQBRVzID0nGw~~_6.JPG?set_id=89040003C1</StockPhotoURL>\n
|
56
|
-
\ <DisplayStockPhotos>true</DisplayStockPhotos>\n <ItemCount>0</ItemCount>\n
|
57
|
-
\ <ProductID type=\"Reference\">308707</ProductID>\n <ProductID type=\"ISBN\">086091769X</ProductID>\n
|
58
|
-
\ <ProductID type=\"ISBN\">9780860917694</ProductID>\n <DomainName>Textbooks,
|
59
|
-
Education</DomainName>\n <ItemSpecifics>\n <NameValueList>\n <Name>Publisher</Name>\n
|
60
|
-
\ <Value>Verso Books</Value>\n </NameValueList>\n <NameValueList>\n
|
61
|
-
\ <Name>Author</Name>\n <Value>Chantal Mouffe</Value>\n <Value>Ernesto
|
62
|
-
Laclau</Value>\n </NameValueList>\n <NameValueList>\n <Name>Title</Name>\n
|
63
|
-
\ <Value>Hegemony and Socialist Strategy : Towards a Radical Democratic
|
64
|
-
Politics by Ernesto Laclau and Chantal Mouffe (1985, Paperback)</Value>\n
|
65
|
-
\ </NameValueList>\n <NameValueList>\n <Name>Language</Name>\n
|
66
|
-
\ <Value>English</Value>\n </NameValueList>\n </ItemSpecifics>\n
|
67
|
-
\ <ReviewCount>0</ReviewCount>\n <MinPrice currencyID=\"USD\">5.08</MinPrice>\n
|
68
|
-
\ </Product>\n </Products>\n <ProductSearchURL>https://search.half.sandbox.ebay.com/ernesto-laclau</ProductSearchURL>\n
|
69
|
-
\ </FindHalfProductsResponse>\n "
|
70
|
-
http_version:
|
71
|
-
recorded_at: Sun, 11 May 2014 21:37:29 GMT
|
72
|
-
- request:
|
73
|
-
method: get
|
74
|
-
uri: https://open.api.sandbox.ebay.com/shopping?CALLNAME=FindHalfProducts&QueryKeywords=ernesto+laclau&RESPONSEENCODING=JSON
|
75
|
-
body:
|
76
|
-
encoding: US-ASCII
|
77
|
-
string: ''
|
78
|
-
headers:
|
79
|
-
X-EBAY-API-APP-ID:
|
80
|
-
- APP_ID
|
81
|
-
X-EBAY-API-VERSION:
|
82
|
-
- 799
|
83
|
-
response:
|
84
|
-
status:
|
85
|
-
code: 200
|
86
|
-
message:
|
87
|
-
headers:
|
88
|
-
Content-Type:
|
89
|
-
- text/plain;charset=utf-8
|
90
|
-
Cache-Control:
|
91
|
-
- no-cache
|
92
|
-
Expires:
|
93
|
-
- Sat, 25 Dec 1999 00:00:00 GMT
|
94
|
-
Last-Modified:
|
95
|
-
- Sun, 11 May 2014 21:37:30 GMT
|
96
|
-
Pragma:
|
97
|
-
- no-cache
|
98
|
-
Server:
|
99
|
-
- Apache-Coyote/1.1
|
100
|
-
X-EBAY-API-BUILD-TAG:
|
101
|
-
- E867_CORE_APILW2_16754878_R1
|
102
|
-
X-EBAY-API-POOL-NAME:
|
103
|
-
- ___cDRidW9rdDd1Zm1hZGh7Zml1Zg==
|
104
|
-
X-EBAY-API-SERVER-NAME:
|
105
|
-
- ___dm8ucnA3MyhnZTE1MTM1Kjc3LTI3KTE8KDIyPz43OzU=
|
106
|
-
X-EBAY-ESB-GUID:
|
107
|
-
- urn:uuid:3539309CC9B8FD194815692613447223882589539128
|
108
|
-
Date:
|
109
|
-
- Sun, 11 May 2014 21:37:30 GMT
|
110
|
-
Transfer-Encoding:
|
111
|
-
- ''
|
112
|
-
Connection:
|
113
|
-
- Keep-Alive
|
114
|
-
body:
|
115
|
-
encoding: UTF-8
|
116
|
-
string: '{"Timestamp":"2014-05-11T21:37:30.721Z","Ack":"Success","Build":"E867_CORE_APILW2_16754878_R1","Version":"867","PageNumber":1,"ApproximatePages":42,"MoreResults":true,"TotalProducts":42,"Products":{"Product":[{"Title":"Hegemony
|
117
|
-
and Socialist Strategy : Towards a Radical Democratic Politics by Ernesto
|
118
|
-
Laclau and Chantal Mouffe (1985, Paperback)","DetailsURL":"https://syicatalogs.sandbox.ebay.com/ws/eBayISAPI.dll?PageSyiProductDetails&IncludeAttributes=1&ShowAttributesTable=1&ProductMementoString=116501:2:1055:1801344777:636461977:f037f5013398147917ef7356f3f28683:1:1:1:411300","StockPhotoURL":"https://i.ebayimg.com/00/$T2eC16dHJG8E9nyfpmrQBRVzID0nGw~~_6.JPG?set_id=89040003C1","DisplayStockPhotos":true,"ItemCount":0,"ProductID":[{"Value":"308707","Type":"Reference"},{"Value":"086091769X","Type":"ISBN"},{"Value":"9780860917694","Type":"ISBN"}],"DomainName":"Textbooks,
|
119
|
-
Education","ItemSpecifics":{"NameValueList":[{"Name":"Publisher","Value":["Verso
|
120
|
-
Books"]},{"Name":"Author","Value":["Chantal Mouffe","Ernesto Laclau"]},{"Name":"Title","Value":["Hegemony
|
121
|
-
and Socialist Strategy : Towards a Radical Democratic Politics by Ernesto
|
122
|
-
Laclau and Chantal Mouffe (1985, Paperback)"]},{"Name":"Language","Value":["English"]}]},"ReviewCount":0,"MinPrice":{"Value":5.08,"CurrencyID":"USD"}}]},"ProductSearchURL":"https://search.half.sandbox.ebay.com/ernesto-laclau"}'
|
123
|
-
http_version:
|
124
|
-
recorded_at: Sun, 11 May 2014 21:37:29 GMT
|
125
|
-
recorded_with: VCR 2.9.0
|
data/test/helper.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require 'vcr'
|
3
|
-
|
4
|
-
VCR.configure do |c|
|
5
|
-
c.cassette_library_dir = File.dirname(__FILE__) + '/cassettes'
|
6
|
-
c.default_cassette_options = { record: :new_episodes }
|
7
|
-
c.hook_into :excon
|
8
|
-
c.before_record { |http| http.ignore! if http.response.status.code >= 400 }
|
9
|
-
c.filter_sensitive_data('APP_ID') { Ebay::Config.app_id }
|
10
|
-
end
|
data/test/test_finding.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'ebay/finding'
|
3
|
-
|
4
|
-
class TestFinding < Minitest::Test
|
5
|
-
def setup
|
6
|
-
VCR.insert_cassette('finding')
|
7
|
-
|
8
|
-
@finding = Ebay::Finding.new
|
9
|
-
@finding.sandbox!
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
VCR.eject_cassette
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_finds_items_by_keywords
|
17
|
-
params = {
|
18
|
-
'GLOBAL-ID' => 'EBAY-US',
|
19
|
-
'OPERATION-NAME' => 'findItemsByKeywords',
|
20
|
-
'keywords' => 'ernesto laclau'
|
21
|
-
}
|
22
|
-
parser = @finding.get(query: params, expects: 200)
|
23
|
-
assert_kind_of Hash, parser.parse
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_finds_items_by_keywords_with_json
|
27
|
-
params = {
|
28
|
-
'RESPONSEENCODING' => 'JSON',
|
29
|
-
'GLOBAL-ID' => 'EBAY-US',
|
30
|
-
'OPERATION-NAME' => 'findItemsByKeywords',
|
31
|
-
'keywords' => 'ernesto laclau'
|
32
|
-
}
|
33
|
-
parser = @finding.get(query: params, expects: 200)
|
34
|
-
assert_kind_of Hash, parser.parse
|
35
|
-
end
|
36
|
-
end
|
data/test/test_merchandising.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'ebay/merchandising'
|
3
|
-
|
4
|
-
class TestMerchandising < Minitest::Test
|
5
|
-
def setup
|
6
|
-
VCR.insert_cassette('merchandising')
|
7
|
-
|
8
|
-
@merchandising = Ebay::Merchandising.new
|
9
|
-
@merchandising.sandbox!
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
VCR.eject_cassette
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_gets_most_watched_items
|
17
|
-
params = {
|
18
|
-
'GLOBAL-ID' => 'EBAY-US',
|
19
|
-
'OPERATION-NAME' => 'getMostWatchedItems'
|
20
|
-
}
|
21
|
-
parser = @merchandising.get(query: params, expects: 200)
|
22
|
-
assert_kind_of Hash, parser.parse
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_gets_most_watched_items_with_json
|
26
|
-
params = {
|
27
|
-
'RESPONSE-DATA-FORMAT' => 'JSON',
|
28
|
-
'GLOBAL-ID' => 'EBAY-US',
|
29
|
-
'OPERATION-NAME' => 'getMostWatchedItems'
|
30
|
-
}
|
31
|
-
parser = @merchandising.get(query: params, expects: 200)
|
32
|
-
assert_kind_of Hash, parser.parse
|
33
|
-
end
|
34
|
-
end
|
data/test/test_parser.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'ebay/parser'
|
3
|
-
|
4
|
-
class TestEbayParser < Minitest::Test
|
5
|
-
def build_response(content_type, body)
|
6
|
-
OpenStruct.new(
|
7
|
-
headers: { 'Content-Type' => content_type },
|
8
|
-
body: body
|
9
|
-
)
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_parses_xml
|
13
|
-
response = build_response('text/xml', '<foo>bar</foo>')
|
14
|
-
parser = Ebay::Parser.new(response)
|
15
|
-
|
16
|
-
assert_kind_of Hash, parser.parse
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_parses_json
|
20
|
-
response = build_response('application/json', '{"foo":"bar"}')
|
21
|
-
parser = Ebay::Parser.new(response)
|
22
|
-
|
23
|
-
assert_kind_of Hash, parser.parse
|
24
|
-
end
|
25
|
-
end
|
data/test/test_product.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'ebay/product'
|
3
|
-
|
4
|
-
class TestProduct < Minitest::Test
|
5
|
-
def setup
|
6
|
-
VCR.insert_cassette('product')
|
7
|
-
|
8
|
-
@product = Ebay::Product.new
|
9
|
-
@product.sandbox!
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
VCR.eject_cassette
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_gets_product_details
|
17
|
-
params = {
|
18
|
-
'GLOBAL-ID' => 'EBAY-US',
|
19
|
-
'OPERATION-NAME' => 'getProductDetails',
|
20
|
-
'productDetailsRequest.dataset' => 'DisplayableSearchResults',
|
21
|
-
'productDetailsRequest.productIdentifier.ePID' => '83414'
|
22
|
-
}
|
23
|
-
parser = @product.get(query: params, expects: 200)
|
24
|
-
assert_kind_of Hash, parser.parse
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_gets_product_details_with_json
|
28
|
-
params = {
|
29
|
-
'RESPONSE-DATA-FORMAT' => 'JSON',
|
30
|
-
'GLOBAL-ID' => 'EBAY-US',
|
31
|
-
'OPERATION-NAME' => 'getProductDetails',
|
32
|
-
'productDetailsRequest.dataset' => 'DisplayableSearchResults',
|
33
|
-
'productDetailsRequest.productIdentifier.ePID' => '83414'
|
34
|
-
}
|
35
|
-
parser = @product.get(query: params, expects: 200)
|
36
|
-
assert_kind_of Hash, parser.parse
|
37
|
-
end
|
38
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'ebay/product_metadata'
|
3
|
-
|
4
|
-
class TestProductMetadata < Minitest::Test
|
5
|
-
def setup
|
6
|
-
VCR.insert_cassette('product_metadata')
|
7
|
-
|
8
|
-
@product_metadata = Ebay::ProductMetadata.new
|
9
|
-
@product_metadata.sandbox!
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
VCR.eject_cassette
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_gets_product_search_data_version
|
17
|
-
params = {
|
18
|
-
'GLOBAL-ID' => 'EBAY-US',
|
19
|
-
'OPERATION-NAME' => 'getProductSearchDataVersion',
|
20
|
-
'categoryId' => '123'
|
21
|
-
}
|
22
|
-
parser = @product_metadata.get(query: params, expects: 200)
|
23
|
-
assert_kind_of Hash, parser.parse
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_gets_product_search_data_version_with_json
|
27
|
-
params = {
|
28
|
-
'RESPONSE-DATA-FORMAT' => 'JSON',
|
29
|
-
'GLOBAL-ID' => 'EBAY-US',
|
30
|
-
'OPERATION-NAME' => 'getProductSearchDataVersion',
|
31
|
-
'categoryId' => '123'
|
32
|
-
}
|
33
|
-
parser = @product_metadata.get(query: params, expects: 200)
|
34
|
-
assert_kind_of Hash, parser.parse
|
35
|
-
end
|
36
|
-
end
|
data/test/test_shopping.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'ebay/shopping'
|
3
|
-
|
4
|
-
class TestShopping < Minitest::Test
|
5
|
-
def setup
|
6
|
-
VCR.insert_cassette('shopping')
|
7
|
-
|
8
|
-
@shopping = Ebay::Shopping.new
|
9
|
-
@shopping.sandbox!
|
10
|
-
end
|
11
|
-
|
12
|
-
def teardown
|
13
|
-
VCR.eject_cassette
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_finds_half_products
|
17
|
-
params = {
|
18
|
-
'CALLNAME' => 'FindHalfProducts',
|
19
|
-
'QueryKeywords' => 'ernesto laclau'
|
20
|
-
}
|
21
|
-
parser = @shopping.get(query: params, expects: 200)
|
22
|
-
assert_kind_of Hash, parser.parse
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_finds_half_products_with_json
|
26
|
-
params = {
|
27
|
-
'CALLNAME' => 'FindHalfProducts',
|
28
|
-
'RESPONSEENCODING' => 'JSON',
|
29
|
-
'QueryKeywords' => 'ernesto laclau'
|
30
|
-
}
|
31
|
-
parser = @shopping.get(query: params, expects: 200)
|
32
|
-
assert_kind_of Hash, parser.parse
|
33
|
-
end
|
34
|
-
end
|