ebay_client 0.1.0 → 0.2.0
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 +5 -13
- data/.ruby-version +1 -1
- data/Gemfile.lock +69 -32
- data/README.md +1 -1
- data/config/defaults.yml +6 -4
- data/ebay_client.gemspec +17 -17
- data/lib/ebay_client/api.rb +31 -16
- data/lib/ebay_client/configuration.rb +4 -4
- data/lib/ebay_client/endpoint.rb +4 -4
- data/lib/ebay_client/engine.rb +0 -6
- data/lib/ebay_client/header.rb +2 -2
- data/lib/ebay_client/request.rb +15 -7
- data/lib/ebay_client/response.rb +13 -19
- data/lib/ebay_client/version.rb +1 -1
- data/spec/config/with_preload.yml +8 -0
- data/spec/config/without_preload.yml +8 -0
- data/spec/ebay_client/api_spec.rb +88 -0
- data/spec/spec_helper.rb +24 -0
- data/vendor/ebay/{809.wsdl → 949.wsdl} +40383 -38507
- metadata +71 -19
- data/vendor/ebay/767.wsdl +0 -133660
checksums.yaml
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
5
|
-
data.tar.gz: !binary |-
|
|
6
|
-
MWFjZWIyZWQwMmM1ZTE0MGZjYjY2N2UxYTI1OTM1YjRmODNkM2Q1Mg==
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 7cea576c603795e615b04cefd3ca295ce205f729
|
|
4
|
+
data.tar.gz: 8571f1122c99c9cc445bb58c70bfc6e85444dd0d
|
|
7
5
|
SHA512:
|
|
8
|
-
metadata.gz:
|
|
9
|
-
|
|
10
|
-
ODMyMjk4MWVjYzA2MDA4MjA3NGQ3NTI3ZmY1NTVkNzFlNjkwMjZjZTA0ZjAy
|
|
11
|
-
Y2Y2ODFiM2M0MzY4MTExNTJmOGExZDdlNTg0MGU0Yzc2MjFiZDA=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
MTg2NjZmMGY2YjVmZmUzMWI4OTM4ZWJhNWUxYzQ3ZTFhYzY4MjJlMTBjYTQx
|
|
14
|
-
NTQ1NDQ3NmNiNWM3NDJkMGQ5ZDMwZTU3YjJiYTZjMTA5YTliZmM4NDQ0OTUz
|
|
15
|
-
N2I0YjQ3ZGY4ZWZjNjZkZTZhMDM0YWVkZmY5Zjg2YmNhNDM3N2E=
|
|
6
|
+
metadata.gz: 4395ab2c7e9d539c6578d092be1dc979a2b2ea0cc5e07e1fa2201d3cd1c9aac59f9cc4c6bd2758fd72a11c038eb684db732c41e97339a6a30ce1be1372c5908d
|
|
7
|
+
data.tar.gz: cfd9c380d43b4b1cd1e247f9cd48d7c4365b564c6b42dc122b1e564ddc6f536e2f7669c29143100a0fa9b5bcfb3b15e971b348190f84494c0be6c7b87e4fffb9
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.2.3
|
data/Gemfile.lock
CHANGED
|
@@ -1,51 +1,88 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ebay_client (0.0
|
|
4
|
+
ebay_client (0.2.0)
|
|
5
5
|
activesupport (>= 3.1.0)
|
|
6
|
-
savon (
|
|
6
|
+
savon (>= 2.0.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
|
-
remote:
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activesupport (
|
|
12
|
-
i18n (~> 0.
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
activesupport (4.2.5.1)
|
|
12
|
+
i18n (~> 0.7)
|
|
13
|
+
json (~> 1.7, >= 1.7.7)
|
|
14
|
+
minitest (~> 5.1)
|
|
15
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
16
|
+
tzinfo (~> 1.1)
|
|
17
|
+
addressable (2.4.0)
|
|
18
|
+
akami (1.3.1)
|
|
15
19
|
gyoku (>= 0.4.0)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
debugger-ruby_core_source (>= 1.1.1)
|
|
24
|
-
debugger-ruby_core_source (1.1.2)
|
|
25
|
-
gyoku (0.4.4)
|
|
20
|
+
nokogiri
|
|
21
|
+
builder (3.2.2)
|
|
22
|
+
crack (0.4.3)
|
|
23
|
+
safe_yaml (~> 1.0.0)
|
|
24
|
+
diff-lcs (1.2.5)
|
|
25
|
+
docile (1.1.5)
|
|
26
|
+
gyoku (1.3.1)
|
|
26
27
|
builder (>= 2.1.2)
|
|
27
|
-
|
|
28
|
+
hashdiff (0.2.3)
|
|
29
|
+
httpi (2.4.1)
|
|
28
30
|
rack
|
|
29
|
-
i18n (0.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
i18n (0.7.0)
|
|
32
|
+
json (1.8.3)
|
|
33
|
+
mini_portile2 (2.0.0)
|
|
34
|
+
minitest (5.8.4)
|
|
35
|
+
nokogiri (1.6.7.2)
|
|
36
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
37
|
+
nori (2.6.0)
|
|
38
|
+
rack (1.6.4)
|
|
39
|
+
rspec (3.4.0)
|
|
40
|
+
rspec-core (~> 3.4.0)
|
|
41
|
+
rspec-expectations (~> 3.4.0)
|
|
42
|
+
rspec-mocks (~> 3.4.0)
|
|
43
|
+
rspec-core (3.4.1)
|
|
44
|
+
rspec-support (~> 3.4.0)
|
|
45
|
+
rspec-expectations (3.4.0)
|
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
47
|
+
rspec-support (~> 3.4.0)
|
|
48
|
+
rspec-mocks (3.4.1)
|
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
|
+
rspec-support (~> 3.4.0)
|
|
51
|
+
rspec-support (3.4.1)
|
|
52
|
+
safe_yaml (1.0.4)
|
|
53
|
+
savon (2.11.1)
|
|
54
|
+
akami (~> 1.2)
|
|
36
55
|
builder (>= 2.1.2)
|
|
37
|
-
gyoku (
|
|
38
|
-
httpi (~>
|
|
39
|
-
nokogiri (>= 1.4.0)
|
|
40
|
-
nori (~> 1.1)
|
|
41
|
-
wasabi (~> 2.1)
|
|
42
|
-
wasabi (2.1.0)
|
|
56
|
+
gyoku (~> 1.2)
|
|
57
|
+
httpi (~> 2.3)
|
|
43
58
|
nokogiri (>= 1.4.0)
|
|
59
|
+
nori (~> 2.4)
|
|
60
|
+
wasabi (~> 3.4)
|
|
61
|
+
simplecov (0.11.1)
|
|
62
|
+
docile (~> 1.1.0)
|
|
63
|
+
json (~> 1.8)
|
|
64
|
+
simplecov-html (~> 0.10.0)
|
|
65
|
+
simplecov-html (0.10.0)
|
|
66
|
+
thread_safe (0.3.5)
|
|
67
|
+
tzinfo (1.2.2)
|
|
68
|
+
thread_safe (~> 0.1)
|
|
69
|
+
wasabi (3.5.0)
|
|
70
|
+
httpi (~> 2.0)
|
|
71
|
+
nokogiri (>= 1.4.2)
|
|
72
|
+
webmock (1.22.6)
|
|
73
|
+
addressable (>= 2.3.6)
|
|
74
|
+
crack (>= 0.3.2)
|
|
75
|
+
hashdiff
|
|
44
76
|
|
|
45
77
|
PLATFORMS
|
|
46
78
|
ruby
|
|
47
79
|
|
|
48
80
|
DEPENDENCIES
|
|
49
81
|
bundler
|
|
50
|
-
debugger
|
|
51
82
|
ebay_client!
|
|
83
|
+
rspec
|
|
84
|
+
simplecov
|
|
85
|
+
webmock
|
|
86
|
+
|
|
87
|
+
BUNDLED WITH
|
|
88
|
+
1.10.6
|
data/README.md
CHANGED
data/config/defaults.yml
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
defaults: &defaults
|
|
2
|
-
version:
|
|
2
|
+
version: 949
|
|
3
3
|
# use local file as default
|
|
4
|
-
#wsdl_file: 'http://developer.ebay.com/webservices/
|
|
4
|
+
#wsdl_file: 'http://developer.ebay.com/webservices/949/eBaySvc.wsdl'
|
|
5
5
|
routing: default
|
|
6
6
|
siteid: 0
|
|
7
7
|
preload: false
|
|
8
8
|
warning_level: Low
|
|
9
9
|
error_language: en_US
|
|
10
10
|
api_keys: []
|
|
11
|
-
savon_log_level: debug
|
|
11
|
+
savon_log_level: :debug
|
|
12
|
+
http_read_timeout: 600
|
|
12
13
|
|
|
13
14
|
development: &development
|
|
14
15
|
<<: *defaults
|
|
15
16
|
url: 'https://api.sandbox.ebay.com/wsapi'
|
|
16
17
|
warning_level: High
|
|
17
|
-
savon_log_level:
|
|
18
|
+
savon_log_level: :debug
|
|
18
19
|
|
|
19
20
|
test:
|
|
20
21
|
<<: *development
|
|
@@ -23,3 +24,4 @@ production:
|
|
|
23
24
|
<<: *defaults
|
|
24
25
|
url: 'https://api.ebay.com/wsapi'
|
|
25
26
|
preload: true
|
|
27
|
+
savon_log_level: :info
|
data/ebay_client.gemspec
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
$:.push File.expand_path(
|
|
3
|
-
require
|
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
|
3
|
+
require 'ebay_client/version'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |s|
|
|
6
|
-
s.name =
|
|
6
|
+
s.name = 'ebay_client'
|
|
7
7
|
s.version = EbayClient::VERSION
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
|
9
|
-
s.date = Time.now.strftime(
|
|
10
|
-
s.authors = [
|
|
11
|
-
s.email = 'marian.theisen@kayoom.com'
|
|
12
|
-
s.summary =
|
|
13
|
-
s.homepage =
|
|
14
|
-
s.description =
|
|
15
|
-
s.license =
|
|
16
|
-
s.metadata = {
|
|
17
|
-
'issue_tracker' => 'https://github.com/kayoom/ebay_client/issues'
|
|
18
|
-
}
|
|
9
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
|
10
|
+
s.authors = ['Marian Theisen','Burkhard Vogel-Kreykenbohm']
|
|
11
|
+
s.email = ['marian.theisen@kayoom.com','b.vogel@buddyandselly.com']
|
|
12
|
+
s.summary = 'Ebay Trading API Client'
|
|
13
|
+
s.homepage = 'http://github.com/kayoom/ebay_client'
|
|
14
|
+
s.description = 'Simple, lightweight eBay Trading API Client'
|
|
15
|
+
s.license = 'MIT'
|
|
19
16
|
|
|
20
17
|
s.files = `git ls-files`.split("\n")
|
|
21
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
22
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
23
|
-
s.require_paths = [
|
|
20
|
+
s.require_paths = ['lib']
|
|
24
21
|
|
|
25
|
-
s.add_dependency
|
|
26
|
-
s.add_dependency
|
|
22
|
+
s.add_dependency 'activesupport', '>= 3.1.0'
|
|
23
|
+
s.add_dependency 'savon', '>= 2.0.0'
|
|
27
24
|
|
|
28
|
-
s.add_development_dependency
|
|
25
|
+
s.add_development_dependency 'bundler'
|
|
26
|
+
s.add_development_dependency 'rspec'
|
|
27
|
+
s.add_development_dependency 'webmock'
|
|
28
|
+
s.add_development_dependency 'simplecov'
|
|
29
29
|
end
|
data/lib/ebay_client/api.rb
CHANGED
|
@@ -2,36 +2,51 @@ require 'savon'
|
|
|
2
2
|
require 'gyoku'
|
|
3
3
|
require 'ebay_client/response'
|
|
4
4
|
|
|
5
|
-
class EbayClient::Api < ActiveSupport::
|
|
5
|
+
class EbayClient::Api < ActiveSupport::ProxyObject
|
|
6
6
|
attr_reader :configuration, :endpoint, :namespace, :header, :client, :calls
|
|
7
7
|
|
|
8
|
-
def initialize
|
|
8
|
+
def initialize(configuration)
|
|
9
9
|
@configuration = configuration
|
|
10
10
|
@endpoint = ::EbayClient::Endpoint.new configuration
|
|
11
11
|
@namespace = :urn
|
|
12
12
|
@header = ::EbayClient::Header.new configuration, namespace
|
|
13
|
-
@
|
|
14
|
-
@client
|
|
13
|
+
@logger = (defined?(Rails) && Rails.respond_to?(:logger) ? Rails.logger : ::Logger.new(::STDOUT))
|
|
14
|
+
@client = ::Savon.client(
|
|
15
|
+
:wsdl => configuration.wsdl_file,
|
|
16
|
+
:read_timeout => configuration.http_read_timeout,
|
|
17
|
+
:namespaces => {'xmlns:urn' => 'urn:ebay:apis:eBLBaseComponents'},
|
|
18
|
+
:convert_request_keys_to => :camelcase,
|
|
19
|
+
:log => true,
|
|
20
|
+
:logger => @logger,
|
|
21
|
+
:log_level => configuration.savon_log_level,
|
|
22
|
+
)
|
|
15
23
|
@calls = 0
|
|
16
24
|
|
|
17
|
-
::Gyoku.convert_symbols_to :camelcase
|
|
18
25
|
create_methods if configuration.preload?
|
|
19
26
|
end
|
|
20
27
|
|
|
21
|
-
def dispatch
|
|
28
|
+
def dispatch(name, body, fail_on_error = false)
|
|
22
29
|
request = ::EbayClient::Request.new self, name, body
|
|
30
|
+
response = nil
|
|
23
31
|
|
|
24
32
|
@calls += 1
|
|
25
33
|
begin
|
|
26
|
-
request.execute
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
response = request.execute
|
|
35
|
+
response.raise_failure if fail_on_error && response.failure?
|
|
36
|
+
rescue ::EbayClient::Response::Exception => e
|
|
37
|
+
if e.code == '218050'
|
|
38
|
+
@configuration.next_key!
|
|
39
|
+
response = request.execute
|
|
40
|
+
else
|
|
41
|
+
@logger.error e.to_s unless @logger.nil? || !@logger.respond_to?(:error)
|
|
42
|
+
raise e
|
|
43
|
+
end
|
|
30
44
|
end
|
|
45
|
+
response
|
|
31
46
|
end
|
|
32
47
|
|
|
33
|
-
def dispatch!
|
|
34
|
-
dispatch(name, body).payload
|
|
48
|
+
def dispatch!(name, body)
|
|
49
|
+
dispatch(name, body, true).payload
|
|
35
50
|
end
|
|
36
51
|
|
|
37
52
|
def inspect
|
|
@@ -43,7 +58,7 @@ class EbayClient::Api < ActiveSupport::BasicObject
|
|
|
43
58
|
def create_methods
|
|
44
59
|
api_methods = ::Module.new
|
|
45
60
|
|
|
46
|
-
client.
|
|
61
|
+
client.operations.each do |action|
|
|
47
62
|
name = action.to_s.gsub(/e_bay_/, '_ebay_')
|
|
48
63
|
|
|
49
64
|
api_methods.send :define_method, name do |*args|
|
|
@@ -58,9 +73,9 @@ class EbayClient::Api < ActiveSupport::BasicObject
|
|
|
58
73
|
api_methods.send :extend_object, self
|
|
59
74
|
end
|
|
60
75
|
|
|
61
|
-
def method_missing
|
|
62
|
-
if name.to_s[-1,1] == '!'
|
|
63
|
-
dispatch! name, args.first
|
|
76
|
+
def method_missing(name, *args, &block)
|
|
77
|
+
if name.to_s[-1, 1] == '!'
|
|
78
|
+
dispatch! name[0..-2], args.first
|
|
64
79
|
else
|
|
65
80
|
dispatch name, args.first
|
|
66
81
|
end
|
|
@@ -2,16 +2,16 @@ class EbayClient::Configuration
|
|
|
2
2
|
class ApiKey
|
|
3
3
|
attr_accessor :appid, :devid, :certid, :token
|
|
4
4
|
|
|
5
|
-
def initialize
|
|
5
|
+
def initialize(key_values)
|
|
6
6
|
key_values.each do |key, val|
|
|
7
7
|
instance_variable_set "@#{key}", val
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
attr_accessor :version, :siteid, :routing, :url, :api_keys, :warning_level, :error_language, :current_key, :savon_log_level
|
|
12
|
+
attr_accessor :version, :siteid, :routing, :url, :api_keys, :warning_level, :error_language, :current_key, :savon_log_level, :http_read_timeout
|
|
13
13
|
|
|
14
|
-
def initialize
|
|
14
|
+
def initialize(presets)
|
|
15
15
|
presets.each do |key, val|
|
|
16
16
|
instance_variable_set "@#{key}", val
|
|
17
17
|
end
|
|
@@ -53,7 +53,7 @@ class EbayClient::Configuration
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
class << self
|
|
56
|
-
def load
|
|
56
|
+
def load(file)
|
|
57
57
|
defaults = load_defaults
|
|
58
58
|
configs = YAML.load_file file
|
|
59
59
|
|
data/lib/ebay_client/endpoint.rb
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
class EbayClient::Endpoint
|
|
2
2
|
attr_reader :configuration
|
|
3
3
|
|
|
4
|
-
def initialize
|
|
4
|
+
def initialize(configuration)
|
|
5
5
|
@configuration = configuration
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
def url_for
|
|
8
|
+
def url_for(action)
|
|
9
9
|
url_base + action.to_s
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def url_base
|
|
13
|
-
|
|
13
|
+
[
|
|
14
14
|
configuration.url,
|
|
15
15
|
params_base
|
|
16
16
|
].join
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def params_base
|
|
20
|
-
|
|
20
|
+
"?appid=#{configuration.appid}&siteid=#{configuration.siteid}&version=#{configuration.version}&routing=#{configuration.routing}&callname="
|
|
21
21
|
end
|
|
22
22
|
end
|
data/lib/ebay_client/engine.rb
CHANGED
|
@@ -9,12 +9,6 @@ module EbayClient
|
|
|
9
9
|
configuration = configurations[Rails.env]
|
|
10
10
|
|
|
11
11
|
EbayClient.api = EbayClient::Api.new configuration
|
|
12
|
-
|
|
13
|
-
::Savon.configure do |config|
|
|
14
|
-
config.log = true
|
|
15
|
-
config.logger = Rails.logger
|
|
16
|
-
config.log_level = configuration.savon_log_level
|
|
17
|
-
end
|
|
18
12
|
end
|
|
19
13
|
end
|
|
20
14
|
end
|
data/lib/ebay_client/header.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
class EbayClient::Header
|
|
2
2
|
attr_reader :configuration, :namespace
|
|
3
3
|
|
|
4
|
-
def initialize
|
|
4
|
+
def initialize(configuration, namespace)
|
|
5
5
|
@configuration = configuration
|
|
6
6
|
@namespace = namespace
|
|
7
7
|
end
|
|
@@ -20,7 +20,7 @@ class EbayClient::Header
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
protected
|
|
23
|
-
def ns_key
|
|
23
|
+
def ns_key(key)
|
|
24
24
|
"#{namespace}:#{key}"
|
|
25
25
|
end
|
|
26
26
|
end
|
data/lib/ebay_client/request.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
class EbayClient::Request
|
|
2
|
-
def initialize
|
|
2
|
+
def initialize(api, name, body)
|
|
3
3
|
@api = api
|
|
4
4
|
@name = name
|
|
5
5
|
@body = body || {}
|
|
@@ -9,6 +9,10 @@ class EbayClient::Request
|
|
|
9
9
|
@normalized_name ||= @name.to_s.camelcase.gsub(/ebay/i, 'eBay')
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
def name_symbol
|
|
13
|
+
@name_sym ||= @name.to_s.gsub(/_ebay_/i, 'e_bay_').to_sym
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
def normalized_body
|
|
13
17
|
@normalized_body ||= @body.to_hash.merge body_defaults
|
|
14
18
|
end
|
|
@@ -27,14 +31,18 @@ class EbayClient::Request
|
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
def execute_request
|
|
30
|
-
@api.client.
|
|
31
|
-
|
|
32
|
-
soap.header = @api.header.to_hash
|
|
33
|
-
soap.body = normalized_body
|
|
34
|
-
end
|
|
34
|
+
@api.client.set_endpoint @api.endpoint.url_for normalized_name
|
|
35
|
+
@api.client.call(name_symbol, soap_header: @api.header.to_hash, message: normalized_body)
|
|
35
36
|
end
|
|
36
37
|
|
|
37
|
-
def read_response
|
|
38
|
+
def read_response(response_body)
|
|
38
39
|
EbayClient::Response.new response_body.values.first
|
|
39
40
|
end
|
|
40
41
|
end
|
|
42
|
+
|
|
43
|
+
# We need to monkey-patch savon to be able to alter the endpoint on each call
|
|
44
|
+
class Savon::Client
|
|
45
|
+
def set_endpoint(endpoint)
|
|
46
|
+
@globals[:endpoint] = endpoint
|
|
47
|
+
end
|
|
48
|
+
end
|