etsy 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +0 -1
- data/Rakefile +1 -1
- data/lib/etsy.rb +1 -1
- data/lib/etsy/response.rb +5 -1
- data/lib/etsy/version.rb +1 -1
- data/test/unit/etsy/basic_client_test.rb +1 -0
- data/test/unit/etsy/response_test.rb +6 -2
- data/test/unit/etsy/secure_client_test.rb +2 -2
- data/test/unit/etsy_test.rb +15 -0
- metadata +21 -38
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3d8467d59605302ecbe6fa8a5c2c78fae8435b2b
|
4
|
+
data.tar.gz: 9f78e9dd4514d505d5738b19ebc9724184ce6259
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 80ab0008d0d4087c40b5045a9a38c46a50a4232b6d37e6062e162143641aad1893fc3ce1340f0e3825dabbcfc576312697f3600fd660331039bc1c001cb5418a
|
7
|
+
data.tar.gz: f7e5fd820fe67797cb8c180ad5f91d58672d9fa7ccbe05cf5766480cfada9c72579dc4637b574badb099999ec9c49f03d736b4891472a01cbc75f9a9dad31fc4
|
data/README.md
CHANGED
@@ -31,7 +31,6 @@ It will likely work with higher versions, but this is unproven.
|
|
31
31
|
The Etsy API has two modes: public, and authenticated. Public mode only requires an
|
32
32
|
API key (available from http://developer.etsy.com ):
|
33
33
|
|
34
|
-
require 'rubygems'
|
35
34
|
require 'etsy'
|
36
35
|
|
37
36
|
Etsy.api_key = 'foobar'
|
data/Rakefile
CHANGED
data/lib/etsy.rb
CHANGED
data/lib/etsy/response.rb
CHANGED
@@ -4,6 +4,8 @@ module Etsy
|
|
4
4
|
class MissingShopID < StandardError; end
|
5
5
|
class EtsyJSONInvalid < StandardError; end
|
6
6
|
class TemporaryIssue < StandardError; end
|
7
|
+
class ResourceUnavailable < TemporaryIssue; end
|
8
|
+
class ExceededRateLimit < TemporaryIssue; end
|
7
9
|
class InvalidUserID < StandardError; end
|
8
10
|
|
9
11
|
# = Response
|
@@ -77,7 +79,9 @@ module Etsy
|
|
77
79
|
raise OAuthTokenRevoked if token_revoked?
|
78
80
|
raise MissingShopID if missing_shop_id?
|
79
81
|
raise InvalidUserID if invalid_user_id?
|
80
|
-
raise TemporaryIssue if temporary_etsy_issue?
|
82
|
+
raise TemporaryIssue if temporary_etsy_issue?
|
83
|
+
raise ResourceUnavailable if resource_unavailable?
|
84
|
+
raise ExceededRateLimit if exceeded_rate_limit?
|
81
85
|
raise EtsyJSONInvalid.new("CODE: #{code}, BODY: #{data}") unless valid_json?
|
82
86
|
true
|
83
87
|
end
|
data/lib/etsy/version.rb
CHANGED
@@ -114,18 +114,22 @@ module Etsy
|
|
114
114
|
r = Response.new(raw_response)
|
115
115
|
|
116
116
|
lambda { r.to_hash }.should raise_error(Etsy::TemporaryIssue)
|
117
|
+
end
|
117
118
|
|
119
|
+
should "raise ResourceUnavailable" do
|
118
120
|
raw_response = mock
|
119
121
|
raw_response.stubs(:body => "something Resource temporarily unavailable something")
|
120
122
|
r = Response.new(raw_response)
|
121
123
|
|
122
|
-
lambda { r.to_hash }.should raise_error(Etsy::
|
124
|
+
lambda { r.to_hash }.should raise_error(Etsy::ResourceUnavailable)
|
125
|
+
end
|
123
126
|
|
127
|
+
should "raise ExceededRateLimit" do
|
124
128
|
raw_response = mock
|
125
129
|
raw_response.stubs(:body => "something You have exceeded your API limit something")
|
126
130
|
r = Response.new(raw_response)
|
127
131
|
|
128
|
-
lambda { r.to_hash }.should raise_error(Etsy::
|
132
|
+
lambda { r.to_hash }.should raise_error(Etsy::ExceededRateLimit)
|
129
133
|
end
|
130
134
|
|
131
135
|
should "provide the code" do
|
@@ -13,7 +13,7 @@ module Etsy
|
|
13
13
|
Etsy.stubs(:permission_scopes).returns(['scope_one', 'scope_two'])
|
14
14
|
|
15
15
|
OAuth::Consumer.stubs(:new).with('key', 'secret', {
|
16
|
-
:site => '
|
16
|
+
:site => 'https://sandbox',
|
17
17
|
:request_token_path => '/v2/oauth/request_token?scope=scope_one+scope_two',
|
18
18
|
:access_token_path => '/v2/oauth/access_token',
|
19
19
|
}).returns('consumer')
|
@@ -31,7 +31,7 @@ module Etsy
|
|
31
31
|
Etsy.stubs(:permission_scopes).returns(['scope_one', 'scope_two'])
|
32
32
|
|
33
33
|
OAuth::Consumer.stubs(:new).with('key', 'secret', {
|
34
|
-
:site => '
|
34
|
+
:site => 'https://production',
|
35
35
|
:request_token_path => '/v2/oauth/request_token?scope=scope_one+scope_two',
|
36
36
|
:access_token_path => '/v2/oauth/access_token',
|
37
37
|
}).returns('consumer')
|
data/test/unit/etsy_test.rb
CHANGED
@@ -4,6 +4,7 @@ class EtsyTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
context "The Etsy module" do
|
6
6
|
setup do
|
7
|
+
Etsy.instance_variable_set(:@protocol, nil)
|
7
8
|
Etsy.instance_variable_set(:@environment, nil)
|
8
9
|
Etsy.instance_variable_set(:@access_mode, nil)
|
9
10
|
Etsy.instance_variable_set(:@callback_url, nil)
|
@@ -25,6 +26,19 @@ class EtsyTest < Test::Unit::TestCase
|
|
25
26
|
Etsy.user('littletjane').should == user
|
26
27
|
end
|
27
28
|
|
29
|
+
should "use the https protocol by default" do
|
30
|
+
Etsy.protocol.should == "https"
|
31
|
+
end
|
32
|
+
|
33
|
+
should "be able to set the protocol to a valid value" do
|
34
|
+
Etsy.protocol = 'http'
|
35
|
+
Etsy.protocol.should == 'http'
|
36
|
+
end
|
37
|
+
|
38
|
+
should "raise an exception when attempting to set an invalid protocol" do
|
39
|
+
lambda { Etsy.protocol = :invalid }.should raise_error(ArgumentError)
|
40
|
+
end
|
41
|
+
|
28
42
|
should "use the sandbox environment by default" do
|
29
43
|
Etsy.environment.should == :sandbox
|
30
44
|
end
|
@@ -78,6 +92,7 @@ class EtsyTest < Test::Unit::TestCase
|
|
78
92
|
|
79
93
|
context "The Etsy module when set up properly" do
|
80
94
|
setup do
|
95
|
+
Etsy.instance_variable_set(:@protocol, 'https')
|
81
96
|
Etsy.instance_variable_set(:@environment, :sandbox)
|
82
97
|
Etsy.instance_variable_set(:@access_mode, :read_write)
|
83
98
|
Etsy.instance_variable_set(:@api_key, 'key')
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Patrick Reagan
|
@@ -10,108 +9,95 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-02-27 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: json
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ">="
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 1.5.0
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ">="
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: 1.5.0
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: oauth
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- - ~>
|
32
|
+
- - "~>"
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: 0.4.0
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- - ~>
|
39
|
+
- - "~>"
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: 0.4.0
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: rake
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
|
-
- - ~>
|
46
|
+
- - "~>"
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: 10.0.4
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
|
-
- - ~>
|
53
|
+
- - "~>"
|
61
54
|
- !ruby/object:Gem::Version
|
62
55
|
version: 10.0.4
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: jnunemaker-matchy
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- - ~>
|
60
|
+
- - "~>"
|
69
61
|
- !ruby/object:Gem::Version
|
70
62
|
version: 0.4.0
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- - ~>
|
67
|
+
- - "~>"
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: 0.4.0
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: shoulda
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
|
-
- - ~>
|
74
|
+
- - "~>"
|
85
75
|
- !ruby/object:Gem::Version
|
86
76
|
version: 3.4.0
|
87
77
|
type: :development
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- - ~>
|
81
|
+
- - "~>"
|
93
82
|
- !ruby/object:Gem::Version
|
94
83
|
version: 3.4.0
|
95
84
|
- !ruby/object:Gem::Dependency
|
96
85
|
name: mocha
|
97
86
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
87
|
requirements:
|
100
|
-
- - ~>
|
88
|
+
- - "~>"
|
101
89
|
- !ruby/object:Gem::Version
|
102
90
|
version: 0.13.3
|
103
91
|
type: :development
|
104
92
|
prerelease: false
|
105
93
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
94
|
requirements:
|
108
|
-
- - ~>
|
95
|
+
- - "~>"
|
109
96
|
- !ruby/object:Gem::Version
|
110
97
|
version: 0.13.3
|
111
98
|
- !ruby/object:Gem::Dependency
|
112
99
|
name: minitest
|
113
100
|
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
101
|
requirements:
|
116
102
|
- - '='
|
117
103
|
- !ruby/object:Gem::Version
|
@@ -119,7 +105,6 @@ dependencies:
|
|
119
105
|
type: :development
|
120
106
|
prerelease: false
|
121
107
|
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
108
|
requirements:
|
124
109
|
- - '='
|
125
110
|
- !ruby/object:Gem::Version
|
@@ -132,8 +117,8 @@ executables: []
|
|
132
117
|
extensions: []
|
133
118
|
extra_rdoc_files: []
|
134
119
|
files:
|
135
|
-
- .gitignore
|
136
|
-
- .travis.yml
|
120
|
+
- ".gitignore"
|
121
|
+
- ".travis.yml"
|
137
122
|
- Gemfile
|
138
123
|
- LICENSE
|
139
124
|
- README.md
|
@@ -212,27 +197,26 @@ files:
|
|
212
197
|
homepage: http://github.com/kytrinyx/etsy
|
213
198
|
licenses:
|
214
199
|
- MIT
|
200
|
+
metadata: {}
|
215
201
|
post_install_message:
|
216
202
|
rdoc_options: []
|
217
203
|
require_paths:
|
218
204
|
- lib
|
219
205
|
required_ruby_version: !ruby/object:Gem::Requirement
|
220
|
-
none: false
|
221
206
|
requirements:
|
222
|
-
- -
|
207
|
+
- - ">="
|
223
208
|
- !ruby/object:Gem::Version
|
224
209
|
version: '0'
|
225
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
|
-
none: false
|
227
211
|
requirements:
|
228
|
-
- -
|
212
|
+
- - ">="
|
229
213
|
- !ruby/object:Gem::Version
|
230
214
|
version: '0'
|
231
215
|
requirements: []
|
232
216
|
rubyforge_project:
|
233
|
-
rubygems_version:
|
217
|
+
rubygems_version: 2.2.0
|
234
218
|
signing_key:
|
235
|
-
specification_version:
|
219
|
+
specification_version: 4
|
236
220
|
summary: Provides a friendly ruby-like wrapper for the Etsy API
|
237
221
|
test_files:
|
238
222
|
- test/fixtures/address/getUserAddresses.json
|
@@ -284,4 +268,3 @@ test_files:
|
|
284
268
|
- test/unit/etsy/user_test.rb
|
285
269
|
- test/unit/etsy/verification_request_test.rb
|
286
270
|
- test/unit/etsy_test.rb
|
287
|
-
has_rdoc:
|