spiffy_stores_api 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.gitignore +10 -0
- data/.travis.yml +14 -0
- data/CHANGELOG +3 -0
- data/Gemfile +5 -0
- data/Gemfile_ar40 +5 -0
- data/Gemfile_ar41 +5 -0
- data/Gemfile_ar50 +5 -0
- data/Gemfile_ar_master +5 -0
- data/README.md +200 -0
- data/Rakefile +39 -0
- data/lib/active_resource/base_ext.rb +21 -0
- data/lib/active_resource/connection_ext.rb +10 -0
- data/lib/active_resource/detailed_log_subscriber.rb +19 -0
- data/lib/active_resource/disable_prefix_check.rb +36 -0
- data/lib/active_resource/json_errors.rb +31 -0
- data/lib/active_resource/to_query.rb +10 -0
- data/lib/spiffy_stores_api.rb +29 -0
- data/lib/spiffy_stores_api/connection.rb +33 -0
- data/lib/spiffy_stores_api/countable.rb +14 -0
- data/lib/spiffy_stores_api/json_format.rb +18 -0
- data/lib/spiffy_stores_api/limits.rb +86 -0
- data/lib/spiffy_stores_api/metafields.rb +19 -0
- data/lib/spiffy_stores_api/resources.rb +2 -0
- data/lib/spiffy_stores_api/resources/address.rb +4 -0
- data/lib/spiffy_stores_api/resources/article.rb +20 -0
- data/lib/spiffy_stores_api/resources/base.rb +86 -0
- data/lib/spiffy_stores_api/resources/blog.rb +9 -0
- data/lib/spiffy_stores_api/resources/collect.rb +5 -0
- data/lib/spiffy_stores_api/resources/country.rb +4 -0
- data/lib/spiffy_stores_api/resources/customer.rb +24 -0
- data/lib/spiffy_stores_api/resources/image.rb +16 -0
- data/lib/spiffy_stores_api/resources/metafield.rb +12 -0
- data/lib/spiffy_stores_api/resources/order.rb +23 -0
- data/lib/spiffy_stores_api/resources/page.rb +5 -0
- data/lib/spiffy_stores_api/resources/product.rb +32 -0
- data/lib/spiffy_stores_api/resources/province.rb +5 -0
- data/lib/spiffy_stores_api/resources/script_tag.rb +4 -0
- data/lib/spiffy_stores_api/resources/standard_collection.rb +18 -0
- data/lib/spiffy_stores_api/resources/store.rb +18 -0
- data/lib/spiffy_stores_api/resources/super_collection.rb +14 -0
- data/lib/spiffy_stores_api/resources/variant.rb +8 -0
- data/lib/spiffy_stores_api/resources/webhook.rb +4 -0
- data/lib/spiffy_stores_api/session.rb +145 -0
- data/lib/spiffy_stores_api/version.rb +3 -0
- data/spiffy_stores_api.gemspec +34 -0
- data/test/active_resource/json_errors_test.rb +19 -0
- data/test/article_test.rb +73 -0
- data/test/base_test.rb +112 -0
- data/test/blog_test.rb +8 -0
- data/test/collect_test.rb +9 -0
- data/test/countable_test.rb +13 -0
- data/test/customer_test.rb +50 -0
- data/test/fixtures/article.json +15 -0
- data/test/fixtures/articles.json +39 -0
- data/test/fixtures/asset.json +9 -0
- data/test/fixtures/assets.json +136 -0
- data/test/fixtures/authors.json +1 -0
- data/test/fixtures/blog.json +12 -0
- data/test/fixtures/blogs.json +13 -0
- data/test/fixtures/collect.json +10 -0
- data/test/fixtures/custom_collection.json +17 -0
- data/test/fixtures/customers.json +64 -0
- data/test/fixtures/customers_search.json +66 -0
- data/test/fixtures/image.json +10 -0
- data/test/fixtures/images.json +20 -0
- data/test/fixtures/metafield.json +13 -0
- data/test/fixtures/metafields.json +26 -0
- data/test/fixtures/o_auth_revoke.json +5 -0
- data/test/fixtures/order.json +297 -0
- data/test/fixtures/orders.json +299 -0
- data/test/fixtures/product.json +116 -0
- data/test/fixtures/redirect.json +7 -0
- data/test/fixtures/script_tag.json +10 -0
- data/test/fixtures/script_tags.json +18 -0
- data/test/fixtures/smart_collection.json +21 -0
- data/test/fixtures/store.json +35 -0
- data/test/fixtures/tags.json +1 -0
- data/test/fixtures/transaction.json +29 -0
- data/test/fixtures/variant.json +23 -0
- data/test/fixtures/variants.json +88 -0
- data/test/fixtures/webhook.json +10 -0
- data/test/fixtures/webhooks.json +18 -0
- data/test/metafield_test.rb +46 -0
- data/test/store_test.rb +58 -0
- data/test/test_helper.rb +90 -0
- metadata +219 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'fakeweb'
|
4
|
+
require 'mocha/setup'
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
8
|
+
require 'spiffy_stores_api'
|
9
|
+
|
10
|
+
FakeWeb.allow_net_connect = false
|
11
|
+
|
12
|
+
# setup SpiffyStoresAPI with fake api_key and secret
|
13
|
+
module Test
|
14
|
+
module Unit
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Test::Unit::TestCase < Minitest::Test
|
19
|
+
def self.test(string, &block)
|
20
|
+
define_method("test_#{string}", &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.should(string, &block)
|
24
|
+
self.test("should_#{string}", &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.context(string)
|
28
|
+
yield
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup
|
32
|
+
ActiveResource::Base.format = :json
|
33
|
+
SpiffyStoresAPI.constants.each do |const|
|
34
|
+
begin
|
35
|
+
const = "SpiffyStoresAPI::#{const}".constantize
|
36
|
+
const.format = :json if const.respond_to?(:format=)
|
37
|
+
rescue NameError
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
SpiffyStoresAPI::Base.clear_session
|
42
|
+
SpiffyStoresAPI::Base.site = "https://this-is-my-test-shop.spiffystores.com/api"
|
43
|
+
SpiffyStoresAPI::Base.password = nil
|
44
|
+
SpiffyStoresAPI::Base.user = nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def teardown
|
48
|
+
FakeWeb.clean_registry
|
49
|
+
end
|
50
|
+
|
51
|
+
# Custom Assertions
|
52
|
+
def assert_not(expression)
|
53
|
+
refute expression, "Expected <#{expression}> to be false!"
|
54
|
+
end
|
55
|
+
|
56
|
+
def assert_nothing_raised
|
57
|
+
yield
|
58
|
+
end
|
59
|
+
|
60
|
+
def assert_not_includes(array, value)
|
61
|
+
refute array.include?(value)
|
62
|
+
end
|
63
|
+
|
64
|
+
def assert_includes(array, value)
|
65
|
+
assert array.include?(value)
|
66
|
+
end
|
67
|
+
|
68
|
+
def load_fixture(name, format=:json)
|
69
|
+
File.read(File.dirname(__FILE__) + "/fixtures/#{name}.#{format}")
|
70
|
+
end
|
71
|
+
|
72
|
+
def assert_request_body(expected)
|
73
|
+
assert_equal expected, FakeWeb.last_request.body
|
74
|
+
end
|
75
|
+
|
76
|
+
def fake(endpoint, options={})
|
77
|
+
body = options.has_key?(:body) ? options.delete(:body) : load_fixture(endpoint)
|
78
|
+
format = options.delete(:format) || :json
|
79
|
+
method = options.delete(:method) || :get
|
80
|
+
extension = ".#{options.delete(:extension)||'json'}" unless options[:extension]==false
|
81
|
+
|
82
|
+
url = if options.has_key?(:url)
|
83
|
+
options[:url]
|
84
|
+
else
|
85
|
+
"https://this-is-my-test-shop.spiffystores.com/api/#{endpoint}#{extension}"
|
86
|
+
end
|
87
|
+
|
88
|
+
FakeWeb.register_uri(method, url, {:body => body, :status => 200, :content_type => "text/#{format}", :content_length => 1}.merge(options))
|
89
|
+
end
|
90
|
+
end
|
metadata
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spiffy_stores_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.11.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Spiffy Stores
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activeresource
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mocha
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.9.8
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.8
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fakeweb
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: The SpiffyStores API gem allows Ruby developers to programmatically access
|
98
|
+
the admin section of SpiffyStores stores. The API is implemented as JSON or XML
|
99
|
+
over HTTP using all four verbs (GET/POST/PUT/DELETE). Each resource, like Order,
|
100
|
+
Product, or Collection, has its own URL and is manipulated in isolation.
|
101
|
+
email: brian@spiffy.com.au
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files:
|
105
|
+
- README.md
|
106
|
+
files:
|
107
|
+
- ".document"
|
108
|
+
- ".gitignore"
|
109
|
+
- ".travis.yml"
|
110
|
+
- CHANGELOG
|
111
|
+
- Gemfile
|
112
|
+
- Gemfile_ar40
|
113
|
+
- Gemfile_ar41
|
114
|
+
- Gemfile_ar50
|
115
|
+
- Gemfile_ar_master
|
116
|
+
- README.md
|
117
|
+
- Rakefile
|
118
|
+
- lib/active_resource/base_ext.rb
|
119
|
+
- lib/active_resource/connection_ext.rb
|
120
|
+
- lib/active_resource/detailed_log_subscriber.rb
|
121
|
+
- lib/active_resource/disable_prefix_check.rb
|
122
|
+
- lib/active_resource/json_errors.rb
|
123
|
+
- lib/active_resource/to_query.rb
|
124
|
+
- lib/spiffy_stores_api.rb
|
125
|
+
- lib/spiffy_stores_api/connection.rb
|
126
|
+
- lib/spiffy_stores_api/countable.rb
|
127
|
+
- lib/spiffy_stores_api/json_format.rb
|
128
|
+
- lib/spiffy_stores_api/limits.rb
|
129
|
+
- lib/spiffy_stores_api/metafields.rb
|
130
|
+
- lib/spiffy_stores_api/resources.rb
|
131
|
+
- lib/spiffy_stores_api/resources/address.rb
|
132
|
+
- lib/spiffy_stores_api/resources/article.rb
|
133
|
+
- lib/spiffy_stores_api/resources/base.rb
|
134
|
+
- lib/spiffy_stores_api/resources/blog.rb
|
135
|
+
- lib/spiffy_stores_api/resources/collect.rb
|
136
|
+
- lib/spiffy_stores_api/resources/country.rb
|
137
|
+
- lib/spiffy_stores_api/resources/customer.rb
|
138
|
+
- lib/spiffy_stores_api/resources/image.rb
|
139
|
+
- lib/spiffy_stores_api/resources/metafield.rb
|
140
|
+
- lib/spiffy_stores_api/resources/order.rb
|
141
|
+
- lib/spiffy_stores_api/resources/page.rb
|
142
|
+
- lib/spiffy_stores_api/resources/product.rb
|
143
|
+
- lib/spiffy_stores_api/resources/province.rb
|
144
|
+
- lib/spiffy_stores_api/resources/script_tag.rb
|
145
|
+
- lib/spiffy_stores_api/resources/standard_collection.rb
|
146
|
+
- lib/spiffy_stores_api/resources/store.rb
|
147
|
+
- lib/spiffy_stores_api/resources/super_collection.rb
|
148
|
+
- lib/spiffy_stores_api/resources/variant.rb
|
149
|
+
- lib/spiffy_stores_api/resources/webhook.rb
|
150
|
+
- lib/spiffy_stores_api/session.rb
|
151
|
+
- lib/spiffy_stores_api/version.rb
|
152
|
+
- spiffy_stores_api.gemspec
|
153
|
+
- test/active_resource/json_errors_test.rb
|
154
|
+
- test/article_test.rb
|
155
|
+
- test/base_test.rb
|
156
|
+
- test/blog_test.rb
|
157
|
+
- test/collect_test.rb
|
158
|
+
- test/countable_test.rb
|
159
|
+
- test/customer_test.rb
|
160
|
+
- test/fixtures/article.json
|
161
|
+
- test/fixtures/articles.json
|
162
|
+
- test/fixtures/asset.json
|
163
|
+
- test/fixtures/assets.json
|
164
|
+
- test/fixtures/authors.json
|
165
|
+
- test/fixtures/blog.json
|
166
|
+
- test/fixtures/blogs.json
|
167
|
+
- test/fixtures/collect.json
|
168
|
+
- test/fixtures/custom_collection.json
|
169
|
+
- test/fixtures/customers.json
|
170
|
+
- test/fixtures/customers_search.json
|
171
|
+
- test/fixtures/image.json
|
172
|
+
- test/fixtures/images.json
|
173
|
+
- test/fixtures/metafield.json
|
174
|
+
- test/fixtures/metafields.json
|
175
|
+
- test/fixtures/o_auth_revoke.json
|
176
|
+
- test/fixtures/order.json
|
177
|
+
- test/fixtures/orders.json
|
178
|
+
- test/fixtures/product.json
|
179
|
+
- test/fixtures/redirect.json
|
180
|
+
- test/fixtures/script_tag.json
|
181
|
+
- test/fixtures/script_tags.json
|
182
|
+
- test/fixtures/smart_collection.json
|
183
|
+
- test/fixtures/store.json
|
184
|
+
- test/fixtures/tags.json
|
185
|
+
- test/fixtures/transaction.json
|
186
|
+
- test/fixtures/variant.json
|
187
|
+
- test/fixtures/variants.json
|
188
|
+
- test/fixtures/webhook.json
|
189
|
+
- test/fixtures/webhooks.json
|
190
|
+
- test/metafield_test.rb
|
191
|
+
- test/store_test.rb
|
192
|
+
- test/test_helper.rb
|
193
|
+
homepage: https://www.spiffystores.com.au
|
194
|
+
licenses:
|
195
|
+
- MIT
|
196
|
+
metadata: {}
|
197
|
+
post_install_message:
|
198
|
+
rdoc_options:
|
199
|
+
- "--charset=UTF-8"
|
200
|
+
require_paths:
|
201
|
+
- lib
|
202
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '2.2'
|
207
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - ">="
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '0'
|
212
|
+
requirements: []
|
213
|
+
rubyforge_project:
|
214
|
+
rubygems_version: 2.7.7
|
215
|
+
signing_key:
|
216
|
+
specification_version: 4
|
217
|
+
summary: SpiffyStoresAPI is a lightweight gem for accessing the Spiffy Stores admin
|
218
|
+
REST web services
|
219
|
+
test_files: []
|