ebayr 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -12
- data/ebayr.gemspec +6 -6
- data/lib/ebayr/record.rb +4 -0
- data/lib/ebayr/request.rb +2 -0
- data/lib/ebayr.rb +1 -1
- data/test/ebayr/record_test.rb +11 -0
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afa1185390ffef499568df9d81b663eaa29fc575
|
4
|
+
data.tar.gz: 052ea275ccca3ec5f5deb3de93b4a062b3625f6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91ceaa2c8fbc72b45dcf0b50c6f262541a311369179a10b977399f9fbe6751d47a60e5fe00e7f1e7004b4fa442a507fffbd90e4a34096249aa9cd7f7d609cc86
|
7
|
+
data.tar.gz: 830b446c010af348f4e36734b179aaa3139228c22b322c377da18f3cdc84ef2b67afe4e2cc71fa5d30568bfef67da9b00608cb63526cff68a84645aa9b60574c
|
data/README.md
CHANGED
@@ -64,10 +64,10 @@ Ebayr.call(:GetOrders, :auth_token => "another-ebay-auth-token")
|
|
64
64
|
Ebayr will look for the following Ruby files, and load them *once* in order (if
|
65
65
|
they exist) when the module is evaluated:
|
66
66
|
|
67
|
-
1. /etc/
|
68
|
-
2. /usr/local/etc/
|
69
|
-
3. ~/.
|
70
|
-
4. ./.
|
67
|
+
1. /etc/ebayr.conf
|
68
|
+
2. /usr/local/etc/ebayr.conf
|
69
|
+
3. ~/.ebayr.conf
|
70
|
+
4. ./.ebayr.conf
|
71
71
|
|
72
72
|
You can put configuration code in there (such as the variable setting shown
|
73
73
|
above). The files should be plain old Ruby.
|
@@ -84,23 +84,44 @@ repository.
|
|
84
84
|
When running test, you generally won't want to use up your API call-limit too
|
85
85
|
quickly, so it makes sense to stub out calls to the eBay API.
|
86
86
|
|
87
|
-
Ebayr
|
88
|
-
for this, and just requires that you wrap your test code in a block, like this:
|
87
|
+
Ebayr test use [Fakeweb][2] to mimic the responses from eBay.
|
89
88
|
|
90
89
|
```ruby
|
91
|
-
require 'ebayr
|
90
|
+
require 'ebayr'
|
91
|
+
require 'test/unit'
|
92
|
+
require 'fakeweb'
|
93
|
+
|
92
94
|
class MyTest < Test::Unit::TestCase
|
93
|
-
|
95
|
+
def setup
|
96
|
+
Ebayr.sandbox = true
|
97
|
+
end
|
94
98
|
|
95
99
|
# A very contrived example...
|
96
|
-
def
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
+
def test_get_ebay_time
|
101
|
+
xml = <<-XML
|
102
|
+
<GeteBayOfficialTimeResponse>
|
103
|
+
<Ack>Success</Ack>
|
104
|
+
<Timestamp>blah</Timestamp>
|
105
|
+
</GeteBayOfficialTimeResponse>
|
106
|
+
XML
|
107
|
+
|
108
|
+
FakeWeb.register_uri(:post, Ebayr.uri, :body => xml)
|
109
|
+
|
110
|
+
time = SomeWrapperThatUsesEbayr.get_ebay_time
|
111
|
+
assert_equal 'blah', time
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class SomeWrapperThatUsesEbayr
|
116
|
+
def self.get_ebay_time
|
117
|
+
hash = Ebayr.call(:GeteBayOfficialTime)
|
118
|
+
hash.timestamp
|
100
119
|
end
|
101
120
|
end
|
102
121
|
```
|
103
122
|
|
123
|
+
See ['./test/ebayr_test.rb'](test/ebayr_test.rb) for more examples.
|
124
|
+
|
104
125
|
You need to remember to include Fakeweb in your Gemfile, or Ebayr will complain.
|
105
126
|
|
106
127
|
## Contributing
|
data/ebayr.gemspec
CHANGED
@@ -3,22 +3,22 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
|
-
gem.authors = [
|
7
|
-
gem.email = ["
|
8
|
-
gem.
|
9
|
-
gem.
|
6
|
+
gem.authors = ['JJ Buckley', 'Eric McKenna']
|
7
|
+
gem.email = ["jj@bjjb.org"]
|
8
|
+
gem.summary = "A tidy library for using the eBay Trading API with Ruby"
|
9
|
+
gem.description = <<-DESCRIPTION
|
10
10
|
eBayR is a gem that makes it (relatively) easy to use the eBay Trading API from
|
11
11
|
Ruby. Includes a self-contained XML parser, a flexible callback system, and a
|
12
12
|
command-line client which aids integration into other projects.
|
13
13
|
DESCRIPTION
|
14
|
-
gem.homepage = "http://
|
14
|
+
gem.homepage = "http://github.com/bjjb/ebayr"
|
15
15
|
|
16
16
|
gem.files = `git ls-files`.split($\)
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^test/})
|
19
19
|
gem.name = "ebayr"
|
20
20
|
gem.require_paths = ["lib"]
|
21
|
-
gem.version = "0.0.
|
21
|
+
gem.version = "0.0.6"
|
22
22
|
if RUBY_VERSION < "1.9"
|
23
23
|
gem.add_dependency 'activesupport', '~> 3.2'
|
24
24
|
gem.add_development_dependency 'minitest'
|
data/lib/ebayr/record.rb
CHANGED
data/lib/ebayr/request.rb
CHANGED
@@ -15,6 +15,7 @@ module Ebayr #:nodoc:
|
|
15
15
|
@auth_token = (options.delete(:auth_token) || self.auth_token).to_s
|
16
16
|
@site_id = (options.delete(:site_id) || self.site_id).to_s
|
17
17
|
@compatability_level = (options.delete(:compatability_level) || self.compatability_level).to_s
|
18
|
+
@http_timeout = (options.delete(:http_timeout) || 60).to_i
|
18
19
|
# Remaining options are converted and used as input to the call
|
19
20
|
@input = self.class.serialize_input(options)
|
20
21
|
end
|
@@ -54,6 +55,7 @@ module Ebayr #:nodoc:
|
|
54
55
|
# Ebayr::Response
|
55
56
|
def send
|
56
57
|
http = Net::HTTP.new(@uri.host, @uri.port)
|
58
|
+
http.read_timeout = @http_timeout
|
57
59
|
|
58
60
|
if @uri.port == 443
|
59
61
|
http.use_ssl = true
|
data/lib/ebayr.rb
CHANGED
@@ -70,7 +70,7 @@ module Ebayr
|
|
70
70
|
# eBay Trading API version to use. For more details, see
|
71
71
|
# http://developer.ebay.com/devzone/xml/docs/HowTo/eBayWS/eBaySchemaVersioning.html
|
72
72
|
mattr_accessor :compatability_level
|
73
|
-
self.compatability_level =
|
73
|
+
self.compatability_level = 837
|
74
74
|
|
75
75
|
mattr_accessor :logger
|
76
76
|
self.logger = Logger.new(STDOUT)
|
data/test/ebayr/record_test.rb
CHANGED
@@ -17,5 +17,16 @@ module Ebayr
|
|
17
17
|
assert_equal 1, record.foo.bars[0].value
|
18
18
|
assert_equal 2, record.foo.bars[1].value
|
19
19
|
end
|
20
|
+
|
21
|
+
def test_has_key_is_available
|
22
|
+
str_key = "Bar"
|
23
|
+
sym_key = :sym_bar
|
24
|
+
record = Record.new({ str_key => "Baz", sym_key => "Foo"})
|
25
|
+
|
26
|
+
assert_respond_to record, :has_key?
|
27
|
+
assert record.has_key?(sym_key), "Record does not have symbol '#{sym_key}'."
|
28
|
+
assert record.has_key?(str_key), "Record does not have '#{str_key}'."
|
29
|
+
|
30
|
+
end
|
20
31
|
end
|
21
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebayr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- JJ Buckley
|
8
|
+
- Eric McKenna
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-09 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activesupport
|
@@ -52,9 +53,12 @@ dependencies:
|
|
52
53
|
- - '>='
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '0'
|
55
|
-
description:
|
56
|
+
description: |
|
57
|
+
eBayR is a gem that makes it (relatively) easy to use the eBay Trading API from
|
58
|
+
Ruby. Includes a self-contained XML parser, a flexible callback system, and a
|
59
|
+
command-line client which aids integration into other projects.
|
56
60
|
email:
|
57
|
-
-
|
61
|
+
- jj@bjjb.org
|
58
62
|
executables: []
|
59
63
|
extensions: []
|
60
64
|
extra_rdoc_files: []
|
@@ -78,7 +82,7 @@ files:
|
|
78
82
|
- test/ebayr/response_test.rb
|
79
83
|
- test/ebayr_test.rb
|
80
84
|
- test/test_helper.rb
|
81
|
-
homepage: http://
|
85
|
+
homepage: http://github.com/bjjb/ebayr
|
82
86
|
licenses: []
|
83
87
|
metadata: {}
|
84
88
|
post_install_message:
|
@@ -100,9 +104,7 @@ rubyforge_project:
|
|
100
104
|
rubygems_version: 2.0.3
|
101
105
|
signing_key:
|
102
106
|
specification_version: 4
|
103
|
-
summary:
|
104
|
-
from Ruby. Includes a self-contained XML parser, a flexible callback system, and
|
105
|
-
a command-line client which aids integration into other projects.
|
107
|
+
summary: A tidy library for using the eBay Trading API with Ruby
|
106
108
|
test_files:
|
107
109
|
- test/ebayr/record_test.rb
|
108
110
|
- test/ebayr/request_test.rb
|