ebay_request 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cb76a7e262a07c379dc602b7ba074c7086c96849692329aae220974794313ee7
4
+ data.tar.gz: 0603e8fb221798bb65f8341327a88fb1d093c057d9d2cdacc46c6c986221869a
5
+ SHA512:
6
+ metadata.gz: b5a67b1c80e93578cf03037368281883bdb66f144e6c69f642cebc34bd0f77bc886c2cfbd8f981179f5571682c1d2962a5cf43fb325368491302694c0fafcb03
7
+ data.tar.gz: 04b18a44284c64a8633b4e0010226fde1605227ee91c7a44e10b31625537bacd74371857641c493b0fc3fad995701d2d74abd21b4a97bd29a3be3830f44f3b9e
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,23 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Exclude:
4
+ - bin/**/*
5
+
6
+ Documentation:
7
+ Enabled: false
8
+
9
+ Style/StringLiterals:
10
+ EnforcedStyle: double_quotes
11
+
12
+ Style/ClassAndModuleChildren:
13
+ EnforcedStyle: compact
14
+
15
+ Style/TrailingCommaInLiteral:
16
+ Description: 'Checks for trailing comma in array and hash literals.'
17
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
18
+ Enabled: true
19
+ EnforcedStyleForMultiline: comma
20
+
21
+ Metrics/BlockLength:
22
+ Exclude:
23
+ - spec/**/*
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ source "https://rubygems.org"
3
+
4
+ # Specify your gem's dependencies in ebay_request.gemspec
5
+ gemspec
@@ -0,0 +1,124 @@
1
+ # EbayRequest
2
+
3
+ eBay XML API request interface.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ebay_request'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ebay_request
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ # config/initializers/ebay_request.rb
25
+
26
+ secrets = Rails.application.secrets.ebay
27
+ raise "Set eBay credentials in secrets.yml" if secrets.blank?
28
+
29
+ EbayRequest.configure do |config|
30
+ config.appid = secrets["appid"]
31
+ config.certid = secrets["certid"]
32
+ config.devid = secrets["devid"]
33
+ config.runame = secrets["runame"]
34
+ config.sandbox = secrets["sandbox"]
35
+ end
36
+
37
+ EbayRequest.logger = Logger.new("ebay-request.log")
38
+ EbayRequest.warn_logger = Logger.new("ebay-request-warn.log") # Not logged otherwise
39
+ EbayRequest.json_logger = GraylogProxy.new # Should receive #notify
40
+ ```
41
+
42
+ ```ruby
43
+ EbayRequest::Finding.new.response("findItemsByKeywords", keywords: "abc")
44
+ EbayRequest::Shopping.new.response("GetSingleItem", ItemID: "252261544055")
45
+ EbayRequest::Shopping.new(token: "...").response("AddItem", ...some data...)
46
+ ```
47
+
48
+ ## Using multiple key sets
49
+
50
+ ```ruby
51
+ EbayRequest.configure do |config|
52
+ config.appid = secrets["appid"]
53
+ # And so on
54
+ # ...
55
+ end
56
+
57
+ EbayRequest.configure(:sandbox) do |config|
58
+ config.appid = secrets["appid"]
59
+ # ...
60
+ config.sandbox = true
61
+ end
62
+
63
+ EbayRequest::Finding.new(env: :sandbox).response("findItemsByKeywords", keywords: "abc")
64
+ ```
65
+
66
+ ## OmniAuth strategy
67
+
68
+ If gem is configured somewhere at initializer (shown above):
69
+
70
+ ```ruby
71
+ Rails.application.config.middleware.use OmniAuth::Builder do
72
+ provider :ebay
73
+ end
74
+ ```
75
+
76
+ If you want to use just strategy you can pass all the required options as `#provider` args ([see source](https://github.com/gzigzigzeo/ebay_request/blob/master/lib/omniauth/strategies/ebay.rb#L4)).
77
+
78
+ This strategy is for Auth'n'auth method only. For OAuth method see the [omniauth-ebay-oauth](https://github.com/evilmartians/omniauth-ebay-oauth) gem.
79
+
80
+
81
+ ## Working with old XML and new REST API simultaneously
82
+
83
+ If you're planning to work with new eBay REST APIs, you will find that another kind of access tokens are required for working with these APIs.
84
+
85
+ Tokens obtained with Auth'n'auth only usable with eBay XML API, while tokens obtained with OAuth only usable with eBay REST API.
86
+
87
+ However, you can use new OAuth tokens to access old APIs by providing an access token in (not yet) documented HTTP header `X-EBAY-API-IAF-TOKEN`. This gem has builtin support for this.
88
+
89
+ To use it:
90
+
91
+ 1. Replace OmniAuth strategy from this gem to the strategy from the [omniauth-ebay-oauth](https://github.com/evilmartians/omniauth-ebay-oauth) gem.
92
+
93
+ Most probably you will need to store and use both Auth'n'auth and OAuth tokens for a while to provide a smooth transition.
94
+
95
+ 2. For working with REST API and their tokens add the [ebay_api](https://github.com/nepalez/ebay_api/) gem to your application.
96
+
97
+ 3. Construct an `EbayAPI::TokenManager` instance with all OAuth tokens.
98
+
99
+ See https://github.com/nepalez/ebay_api/#working-with-access-tokens
100
+
101
+ Any object that responds to `refresh!` method and returns actual token from the `access_token` method will be fine too.
102
+
103
+ 4. Pass this token manager object in `:iaf_token_manager` option into the XML API constructor:
104
+
105
+ ```ruby
106
+ EbayRequest::Trading.new(
107
+ token: auth_n_auth_token,
108
+ iaf_token_manager: iaf_token_manager,
109
+ siteid: 0,
110
+ )
111
+ ```
112
+
113
+ You can pass both old token in `:token` option and new token manager in `:iaf_token_manager` option. Old tokens will be used if the token manager is `nil`.
114
+
115
+
116
+ ## Development
117
+
118
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
119
+
120
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
121
+
122
+ ## Contributing
123
+
124
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gzigzigzeo/ebay_request.
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ebay_request"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,321 @@
1
+ ---
2
+ - globalid: EBAY-US
3
+ id: 0
4
+ name: US
5
+ code: US
6
+ currency: USD
7
+ language: en
8
+ domain: ebay.com
9
+ metric: imperial
10
+ country: US
11
+ shipping_zones: [US, Americas, NorthAmerica]
12
+ free_placement: 50
13
+ max_insertion_fee: 0.3
14
+ free_pictures: 12
15
+ subtitle_fee: 3.0
16
+ gtc_available: true
17
+ min_fixed_price: 0.99 # https://pages.ebay.com/help/sell/fixed-price.html
18
+
19
+ - globalid: EBAY-RU
20
+ id: 215
21
+ name: Russia
22
+ code: RU
23
+ currency: RUB
24
+ language: ru
25
+ domain: ebay.com
26
+ metric: metric
27
+ country: RU
28
+ shipping_zones: [RU, Russia, RussianFederation]
29
+ gtc_available: true
30
+ free_placement: 1000000
31
+ max_insertion_fee: 0
32
+ free_pictures: 12
33
+ picture_fee: 0
34
+ subtitle_fee: 0
35
+ min_fixed_price: 0.99 # https://pages.ebay.com/help/sell/fixed-price.html
36
+
37
+ - globalid: EBAY-AT
38
+ id: 16
39
+ name: Austria
40
+ code: AT
41
+ currency: EUR
42
+ language: de
43
+ domain: ebay.at
44
+ metric: metric
45
+ country: AT
46
+ min_fixed_price: # no limit at https://pages.ebay.com.at/help/sell/fixed-price.html
47
+
48
+ - globalid: EBAY-AU
49
+ id: 15
50
+ name: Australia
51
+ code: AU
52
+ currency: AUD
53
+ language: en
54
+ domain: ebay.com.au
55
+ metric: metric
56
+ country: AU
57
+ shipping_zones: [AU, Oceania]
58
+ free_placement: 0
59
+ max_insertion_fee: 3.5
60
+ free_pictures: 12
61
+ subtitle_fee: 2
62
+ gtc_available: true
63
+ min_fixed_price: # no limit at https://pages.ebay.com.au/help/sell/fixed-price.html
64
+
65
+ - globalid: EBAY-CH
66
+ id: 193
67
+ name: Switzerland
68
+ code: CH
69
+ currency: CHF
70
+ language: de
71
+ domain: ebay.ch
72
+ metric: metric
73
+ country: CH
74
+ min_fixed_price: # no limit at https://pages.ebay.ch/help/sell/fixed-price.html
75
+
76
+ - globalid: EBAY-DE
77
+ id: 77
78
+ name: Germany
79
+ code: DE
80
+ currency: EUR
81
+ language: de
82
+ domain: ebay.de
83
+ metric: metric
84
+ country: DE
85
+ shipping_zones: [DE, Europe, EuropeanUnion]
86
+ free_placement: 50
87
+ max_insertion_fee: 0.35
88
+ free_pictures: 12
89
+ picture_fee: nil
90
+ subtitle_fee: 0.5
91
+ quantity_limits: 9
92
+ gtc_available: true
93
+ min_fixed_price: # no limit at https://pages.ebay.de/help/sell/fixed-price.html
94
+
95
+ - globalid: EBAY-ENCA
96
+ id: 2
97
+ name: Canada
98
+ code: CA
99
+ currency: CAD
100
+ language: en
101
+ domain: ebay.ca
102
+ metric: metric
103
+ country: CA
104
+ shipping_zones: [CA, Americas, NorthAmerica]
105
+ free_placement: 50
106
+ max_insertion_fee: 0.3
107
+ free_pictures: 12
108
+ subtitle_fee: 1.5
109
+ quantity_limits: 9
110
+ gtc_available: true
111
+ min_fixed_price: 0.99 # https://pages.ebay.ca/help/sell/fixed-price.html
112
+
113
+ - globalid: EBAY-ES
114
+ id: 186
115
+ name: Spain
116
+ code: ES
117
+ currency: EUR
118
+ language: es
119
+ domain: ebay.es
120
+ metric: metric
121
+ country: ES
122
+ shipping_zones: [ES, Europe, EuropeanUnion]
123
+ free_placement: 50
124
+ max_insertion_fee: 0.35
125
+ free_pictures: 12
126
+ subtitle_fee: 0.41
127
+ gtc_available: false
128
+ min_fixed_price: 0.99 # https://pages.ebay.es/help/sell/fixed-price.html
129
+
130
+ - globalid: EBAY-FR
131
+ id: 71
132
+ name: France
133
+ code: FR
134
+ currency: EUR
135
+ language: fr
136
+ domain: ebay.fr
137
+ metric: metric
138
+ country: FR
139
+ shipping_zones: [FR, Europe, EuropeanUnion]
140
+ free_placement: 50
141
+ max_insertion_fee: 0.35
142
+ free_pictures: 1
143
+ picture_fee: 0.13
144
+ subtitle_fee: 0.42
145
+ gtc_available: false
146
+ min_fixed_price: 1.00 # https://pages.ebay.fr/help/sell/fixed-price.html
147
+
148
+ - globalid: EBAY-FRBE
149
+ id: 23
150
+ name: Belgium_French
151
+ code: BEFR
152
+ currency: EUR
153
+ language: fr
154
+ domain: ebay.be
155
+ metric: metric
156
+ country: BE
157
+ min_fixed_price: 1.00 # https://pages.befr.ebay.be/help/sell/fixed-price.html
158
+
159
+ - globalid: EBAY-FRCA
160
+ id: 210
161
+ name: CanadaFrench
162
+ code: CAFR
163
+ currency: CAD
164
+ language: fr
165
+ domain: ebay.ca
166
+ metric: metric
167
+ country: CA
168
+ shipping_zones: [CA, Americas, NorthAmerica]
169
+ free_placement: 50
170
+ max_insertion_fee: 0.3
171
+ free_pictures: 12
172
+ subtitle_fee: 3.0
173
+ quantity_limits: 9
174
+ gtc_available: true
175
+ min_fixed_price: 0.99 # https://pages.ebay.ca/help/sell/fixed-price.html
176
+
177
+ - globalid: EBAY-GB
178
+ id: 3
179
+ name: UK
180
+ code: UK
181
+ currency: GBP
182
+ language: en
183
+ domain: ebay.co.uk
184
+ metric: metric
185
+ country: GB
186
+ shipping_zones: [GB, Europe]
187
+ free_placement: 0
188
+ max_insertion_fee: 0.26
189
+ free_pictures: 12
190
+ subtitle_fee: 1
191
+ gtc_available: true
192
+ min_fixed_price: 0.99 # for GBP at https://pages.ebay.co.uk/help/sell/fixed-price.html
193
+
194
+ - globalid: EBAY-HK
195
+ id: 201
196
+ name: HongKong
197
+ code: HK
198
+ currency: HKD
199
+ language: zh
200
+ domain: ebay.com.hk
201
+ metric: metric
202
+ country: HK
203
+ min_fixed_price: 1.00 # https://pages.ebay.com.hk/help/sell/fixed-price.html
204
+
205
+ - globalid: EBAY-IE
206
+ id: 205
207
+ name: Ireland
208
+ code: IE
209
+ currency: EUR
210
+ language: en
211
+ domain: ebay.ie
212
+ metric: metric
213
+ country: IE
214
+ min_fixed_price: 1.00 # for EUR at https://pages.ebay.ie/help/sell/fixed-price.html
215
+
216
+ - globalid: EBAY-IN
217
+ id: 203
218
+ name: India
219
+ code: IN
220
+ currency: INR
221
+ language: en
222
+ domain: ebay.in
223
+ metric: metric
224
+ country: IN
225
+ min_fixed_price: 1.00 # https://pages.ebay.in/help/sell/fixed-price.html
226
+
227
+ - globalid: EBAY-IT
228
+ id: 101
229
+ name: Italy
230
+ code: IT
231
+ currency: EUR
232
+ language: it
233
+ domain: ebay.it
234
+ metric: metric
235
+ country: IT
236
+ shipping_zones: [IT, Europe, EuropeanUnion]
237
+ free_placement: 50
238
+ max_insertion_fee: 0.35
239
+ free_pictures: 1
240
+ picture_fee: 0.12
241
+ subtitle_fee: 0.41
242
+ gtc_available: false
243
+ min_fixed_price: 1.00 # https://pages.ebay.it/help/sell/fixed-price.html
244
+
245
+ - globalid: EBAY-MOTOR
246
+ id: 100
247
+ name: US Motors
248
+ code: MOTOR
249
+ currency: USD
250
+ language: en
251
+ domain: ebay.com/motors
252
+ metric: imperial
253
+ country: US
254
+ shipping_zones: [US, Americas, NorthAmerica]
255
+ min_fixed_price: 0.99 # https://pages.ebay.com/motors/help/sell/fixed-price.html
256
+
257
+ - globalid: EBAY-MY
258
+ id: 207
259
+ name: Malaysia
260
+ code: MY
261
+ currency: MYR
262
+ language: en
263
+ domain: ebay.com.my
264
+ metric: metric
265
+ country: MY
266
+ min_fixed_price: 0.99 # for USD at https://pages.ebay.com.my/help/sell/fixed-price.html
267
+
268
+ - globalid: EBAY-NL
269
+ id: 146
270
+ name: Netherlands
271
+ code: NL
272
+ currency: EUR
273
+ language: nl
274
+ domain: ebay.nl
275
+ metric: metric
276
+ country: NL
277
+ min_fixed_price: # no limit at https://pages.ebay.nl/help/sell/fixed-price.html
278
+
279
+ - globalid: EBAY-NLBE
280
+ id: 123
281
+ name: Belgium_Dutch
282
+ code: BENL
283
+ currency: EUR
284
+ language: de
285
+ domain: ebay.nl
286
+ metric: metric
287
+ country: BE
288
+ min_fixed_price: # no limit at https://pages.benl.ebay.be/help/sell/fixed-price.html
289
+
290
+ - globalid: EBAY-PH
291
+ id: 211
292
+ name: Philippines
293
+ code: PH
294
+ currency: PHP
295
+ language: en
296
+ domain: ebay.ph
297
+ metric: metric
298
+ country: PH
299
+ min_fixed_price: 0.99 # for USD at https://pages.ebay.ph/help/sell/fixed-price.html
300
+
301
+ - globalid: EBAY-PL
302
+ id: 212
303
+ name: Poland
304
+ code: PL
305
+ currency: PLN
306
+ language: pl
307
+ domain: ebay.pl
308
+ metric: metric
309
+ country: PL
310
+ min_fixed_price: # no limit at https://pages.ebay.pl/help/sell/fixed-price.html
311
+
312
+ - globalid: EBAY-SG
313
+ id: 216
314
+ name: Singapore
315
+ code: SG
316
+ currency: SGD
317
+ language: en
318
+ domain: ebay.com.sg
319
+ metric: metric
320
+ country: SG
321
+ min_fixed_price: 1.00 # for USD at https://pages.ebay.com.sg/help/sell/fixed-price.html