spree_api 3.2.9 → 3.3.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/api/base_controller.rb +11 -12
- data/app/controllers/spree/api/v1/checkouts_controller.rb +5 -8
- data/app/controllers/spree/api/v1/customer_returns_controller.rb +24 -0
- data/app/controllers/spree/api/v1/orders_controller.rb +13 -24
- data/app/controllers/spree/api/v1/payments_controller.rb +2 -3
- data/app/controllers/spree/api/v1/reimbursements_controller.rb +24 -0
- data/app/controllers/spree/api/v1/shipments_controller.rb +4 -4
- data/app/controllers/spree/api/v1/zones_controller.rb +8 -3
- data/app/helpers/spree/api/api_helpers.rb +13 -1
- data/app/models/concerns/spree/user_api_authentication.rb +19 -0
- data/app/models/concerns/spree/user_api_methods.rb +7 -0
- data/app/views/spree/api/v1/customer_returns/index.v1.rabl +7 -0
- data/app/views/spree/api/v1/line_items/show.v1.rabl +0 -1
- data/app/views/spree/api/v1/reimbursements/index.v1.rabl +7 -0
- data/config/initializers/user_class_extensions.rb +7 -0
- data/config/routes.rb +3 -0
- data/spec/controllers/spree/api/base_controller_spec.rb +84 -0
- data/spec/controllers/spree/api/v1/addresses_controller_spec.rb +56 -0
- data/spec/controllers/spree/api/v1/checkouts_controller_spec.rb +361 -0
- data/spec/controllers/spree/api/v1/classifications_controller_spec.rb +48 -0
- data/spec/controllers/spree/api/v1/countries_controller_spec.rb +48 -0
- data/spec/controllers/spree/api/v1/credit_cards_controller_spec.rb +80 -0
- data/spec/controllers/spree/api/v1/customer_returns_controller_spec.rb +27 -0
- data/spec/controllers/spree/api/v1/images_controller_spec.rb +114 -0
- data/spec/controllers/spree/api/v1/inventory_units_controller_spec.rb +48 -0
- data/spec/controllers/spree/api/v1/line_items_controller_spec.rb +210 -0
- data/spec/controllers/spree/api/v1/option_types_controller_spec.rb +122 -0
- data/spec/controllers/spree/api/v1/option_values_controller_spec.rb +141 -0
- data/spec/controllers/spree/api/v1/orders_controller_spec.rb +735 -0
- data/spec/controllers/spree/api/v1/payments_controller_spec.rb +234 -0
- data/spec/controllers/spree/api/v1/product_properties_controller_spec.rb +156 -0
- data/spec/controllers/spree/api/v1/products_controller_spec.rb +409 -0
- data/spec/controllers/spree/api/v1/promotion_application_spec.rb +50 -0
- data/spec/controllers/spree/api/v1/promotions_controller_spec.rb +64 -0
- data/spec/controllers/spree/api/v1/properties_controller_spec.rb +102 -0
- data/spec/controllers/spree/api/v1/reimbursements_controller_spec.rb +24 -0
- data/spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb +161 -0
- data/spec/controllers/spree/api/v1/shipments_controller_spec.rb +187 -0
- data/spec/controllers/spree/api/v1/states_controller_spec.rb +86 -0
- data/spec/controllers/spree/api/v1/stock_items_controller_spec.rb +151 -0
- data/spec/controllers/spree/api/v1/stock_locations_controller_spec.rb +113 -0
- data/spec/controllers/spree/api/v1/stock_movements_controller_spec.rb +84 -0
- data/spec/controllers/spree/api/v1/stores_controller_spec.rb +133 -0
- data/spec/controllers/spree/api/v1/tags_controller_spec.rb +102 -0
- data/spec/controllers/spree/api/v1/taxonomies_controller_spec.rb +114 -0
- data/spec/controllers/spree/api/v1/taxons_controller_spec.rb +177 -0
- data/spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb +26 -0
- data/spec/controllers/spree/api/v1/users_controller_spec.rb +153 -0
- data/spec/controllers/spree/api/v1/variants_controller_spec.rb +205 -0
- data/spec/controllers/spree/api/v1/zones_controller_spec.rb +91 -0
- data/spec/models/spree/legacy_user_spec.rb +19 -0
- data/spec/requests/rabl_cache_spec.rb +32 -0
- data/spec/requests/ransackable_attributes_spec.rb +79 -0
- data/spec/requests/version_spec.rb +19 -0
- data/spec/shared_examples/protect_product_actions.rb +17 -0
- data/spec/spec_helper.rb +63 -0
- data/spec/support/controller_hacks.rb +40 -0
- data/spec/support/database_cleaner.rb +14 -0
- data/spec/support/have_attributes_matcher.rb +13 -0
- data/spree_api.gemspec +4 -3
- metadata +105 -13
- data/app/views/spree/api/v1/config/money.v1.rabl +0 -2
- data/app/views/spree/api/v1/config/show.v1.rabl +0 -2
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'active_support/all'
|
2
|
+
module ControllerHacks
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
routes { Spree::Core::Engine.routes }
|
7
|
+
end
|
8
|
+
|
9
|
+
def api_get(action, params={}, session=nil, flash=nil)
|
10
|
+
api_process(action, params, session, flash, "GET")
|
11
|
+
end
|
12
|
+
|
13
|
+
def api_post(action, params={}, session=nil, flash=nil)
|
14
|
+
api_process(action, params, session, flash, "POST")
|
15
|
+
end
|
16
|
+
|
17
|
+
def api_put(action, params={}, session=nil, flash=nil)
|
18
|
+
api_process(action, params, session, flash, "PUT")
|
19
|
+
end
|
20
|
+
|
21
|
+
def api_delete(action, params={}, session=nil, flash=nil)
|
22
|
+
api_process(action, params, session, flash, "DELETE")
|
23
|
+
end
|
24
|
+
|
25
|
+
def api_process(action, params={}, session=nil, flash=nil, method="get")
|
26
|
+
scoping = respond_to?(:resource_scoping) ? resource_scoping : {}
|
27
|
+
process(
|
28
|
+
action,
|
29
|
+
method: method,
|
30
|
+
params: params.merge(scoping),
|
31
|
+
session: session,
|
32
|
+
flash: flash,
|
33
|
+
format: :json
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
RSpec.configure do |config|
|
39
|
+
config.include ControllerHacks, type: :controller
|
40
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.before(:suite) do
|
3
|
+
DatabaseCleaner.strategy = :transaction
|
4
|
+
DatabaseCleaner.clean_with(:truncation)
|
5
|
+
end
|
6
|
+
|
7
|
+
config.before(:each) do
|
8
|
+
DatabaseCleaner.start
|
9
|
+
end
|
10
|
+
|
11
|
+
config.after(:each) do
|
12
|
+
DatabaseCleaner.clean
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
RSpec::Matchers.define :have_attributes do |expected_attributes|
|
6
|
+
match do |actual|
|
7
|
+
# actual is a Hash object representing an object, like this:
|
8
|
+
# { "name" => "Product #1" }
|
9
|
+
actual_attributes = actual.keys.map(&:to_sym)
|
10
|
+
expected_attributes.map(&:to_sym).all? { |attr| actual_attributes.include?(attr) }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
data/spree_api.gemspec
CHANGED
@@ -9,15 +9,16 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.homepage = 'https://spreecommerce.com'
|
10
10
|
s.license = 'BSD-3-Clause'
|
11
11
|
|
12
|
-
s.required_ruby_version = '>= 2.2.
|
12
|
+
s.required_ruby_version = '>= 2.2.7'
|
13
13
|
|
14
|
-
s.files = `git ls-files`.split($\)
|
14
|
+
s.files = `git ls-files`.split($\)
|
15
15
|
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
16
17
|
s.name = "spree_api"
|
17
18
|
s.require_paths = ["lib"]
|
18
19
|
s.version = Spree.version
|
19
20
|
|
20
21
|
s.add_dependency 'spree_core', s.version
|
21
22
|
s.add_dependency 'rabl', '~> 0.13.1'
|
22
|
-
s.add_dependency 'versioncake', '~> 3.
|
23
|
+
s.add_dependency 'versioncake', '~> 3.3.0'
|
23
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.3.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.3.0.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rabl
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: 3.3.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
54
|
+
version: 3.3.0
|
55
55
|
description: Spree's API
|
56
56
|
email:
|
57
57
|
- ryan@spreecommerce.com
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- app/controllers/spree/api/v1/classifications_controller.rb
|
70
70
|
- app/controllers/spree/api/v1/countries_controller.rb
|
71
71
|
- app/controllers/spree/api/v1/credit_cards_controller.rb
|
72
|
+
- app/controllers/spree/api/v1/customer_returns_controller.rb
|
72
73
|
- app/controllers/spree/api/v1/images_controller.rb
|
73
74
|
- app/controllers/spree/api/v1/inventory_units_controller.rb
|
74
75
|
- app/controllers/spree/api/v1/line_items_controller.rb
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- app/controllers/spree/api/v1/products_controller.rb
|
81
82
|
- app/controllers/spree/api/v1/promotions_controller.rb
|
82
83
|
- app/controllers/spree/api/v1/properties_controller.rb
|
84
|
+
- app/controllers/spree/api/v1/reimbursements_controller.rb
|
83
85
|
- app/controllers/spree/api/v1/return_authorizations_controller.rb
|
84
86
|
- app/controllers/spree/api/v1/shipments_controller.rb
|
85
87
|
- app/controllers/spree/api/v1/states_controller.rb
|
@@ -94,6 +96,8 @@ files:
|
|
94
96
|
- app/controllers/spree/api/v1/variants_controller.rb
|
95
97
|
- app/controllers/spree/api/v1/zones_controller.rb
|
96
98
|
- app/helpers/spree/api/api_helpers.rb
|
99
|
+
- app/models/concerns/spree/user_api_authentication.rb
|
100
|
+
- app/models/concerns/spree/user_api_methods.rb
|
97
101
|
- app/models/spree/api_configuration.rb
|
98
102
|
- app/views/spree/api/errors/gateway_error.v1.rabl
|
99
103
|
- app/views/spree/api/errors/invalid_api_key.v1.rabl
|
@@ -103,12 +107,11 @@ files:
|
|
103
107
|
- app/views/spree/api/errors/unauthorized.v1.rabl
|
104
108
|
- app/views/spree/api/v1/addresses/show.v1.rabl
|
105
109
|
- app/views/spree/api/v1/adjustments/show.v1.rabl
|
106
|
-
- app/views/spree/api/v1/config/money.v1.rabl
|
107
|
-
- app/views/spree/api/v1/config/show.v1.rabl
|
108
110
|
- app/views/spree/api/v1/countries/index.v1.rabl
|
109
111
|
- app/views/spree/api/v1/countries/show.v1.rabl
|
110
112
|
- app/views/spree/api/v1/credit_cards/index.v1.rabl
|
111
113
|
- app/views/spree/api/v1/credit_cards/show.v1.rabl
|
114
|
+
- app/views/spree/api/v1/customer_returns/index.v1.rabl
|
112
115
|
- app/views/spree/api/v1/images/index.v1.rabl
|
113
116
|
- app/views/spree/api/v1/images/new.v1.rabl
|
114
117
|
- app/views/spree/api/v1/images/show.v1.rabl
|
@@ -150,6 +153,7 @@ files:
|
|
150
153
|
- app/views/spree/api/v1/properties/index.v1.rabl
|
151
154
|
- app/views/spree/api/v1/properties/new.v1.rabl
|
152
155
|
- app/views/spree/api/v1/properties/show.v1.rabl
|
156
|
+
- app/views/spree/api/v1/reimbursements/index.v1.rabl
|
153
157
|
- app/views/spree/api/v1/return_authorizations/index.v1.rabl
|
154
158
|
- app/views/spree/api/v1/return_authorizations/new.v1.rabl
|
155
159
|
- app/views/spree/api/v1/return_authorizations/show.v1.rabl
|
@@ -192,6 +196,7 @@ files:
|
|
192
196
|
- app/views/spree/api/v1/zones/index.v1.rabl
|
193
197
|
- app/views/spree/api/v1/zones/show.v1.rabl
|
194
198
|
- config/initializers/metal_load_paths.rb
|
199
|
+
- config/initializers/user_class_extensions.rb
|
195
200
|
- config/locales/en.yml
|
196
201
|
- config/routes.rb
|
197
202
|
- db/migrate/20100107141738_add_api_key_to_spree_users.rb
|
@@ -208,7 +213,50 @@ files:
|
|
208
213
|
- lib/spree/api/testing_support/setup.rb
|
209
214
|
- lib/spree_api.rb
|
210
215
|
- script/rails
|
216
|
+
- spec/controllers/spree/api/base_controller_spec.rb
|
217
|
+
- spec/controllers/spree/api/v1/addresses_controller_spec.rb
|
218
|
+
- spec/controllers/spree/api/v1/checkouts_controller_spec.rb
|
219
|
+
- spec/controllers/spree/api/v1/classifications_controller_spec.rb
|
220
|
+
- spec/controllers/spree/api/v1/countries_controller_spec.rb
|
221
|
+
- spec/controllers/spree/api/v1/credit_cards_controller_spec.rb
|
222
|
+
- spec/controllers/spree/api/v1/customer_returns_controller_spec.rb
|
223
|
+
- spec/controllers/spree/api/v1/images_controller_spec.rb
|
224
|
+
- spec/controllers/spree/api/v1/inventory_units_controller_spec.rb
|
225
|
+
- spec/controllers/spree/api/v1/line_items_controller_spec.rb
|
226
|
+
- spec/controllers/spree/api/v1/option_types_controller_spec.rb
|
227
|
+
- spec/controllers/spree/api/v1/option_values_controller_spec.rb
|
228
|
+
- spec/controllers/spree/api/v1/orders_controller_spec.rb
|
229
|
+
- spec/controllers/spree/api/v1/payments_controller_spec.rb
|
230
|
+
- spec/controllers/spree/api/v1/product_properties_controller_spec.rb
|
231
|
+
- spec/controllers/spree/api/v1/products_controller_spec.rb
|
232
|
+
- spec/controllers/spree/api/v1/promotion_application_spec.rb
|
233
|
+
- spec/controllers/spree/api/v1/promotions_controller_spec.rb
|
234
|
+
- spec/controllers/spree/api/v1/properties_controller_spec.rb
|
235
|
+
- spec/controllers/spree/api/v1/reimbursements_controller_spec.rb
|
236
|
+
- spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb
|
237
|
+
- spec/controllers/spree/api/v1/shipments_controller_spec.rb
|
238
|
+
- spec/controllers/spree/api/v1/states_controller_spec.rb
|
239
|
+
- spec/controllers/spree/api/v1/stock_items_controller_spec.rb
|
240
|
+
- spec/controllers/spree/api/v1/stock_locations_controller_spec.rb
|
241
|
+
- spec/controllers/spree/api/v1/stock_movements_controller_spec.rb
|
242
|
+
- spec/controllers/spree/api/v1/stores_controller_spec.rb
|
243
|
+
- spec/controllers/spree/api/v1/tags_controller_spec.rb
|
244
|
+
- spec/controllers/spree/api/v1/taxonomies_controller_spec.rb
|
245
|
+
- spec/controllers/spree/api/v1/taxons_controller_spec.rb
|
246
|
+
- spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
|
247
|
+
- spec/controllers/spree/api/v1/users_controller_spec.rb
|
248
|
+
- spec/controllers/spree/api/v1/variants_controller_spec.rb
|
249
|
+
- spec/controllers/spree/api/v1/zones_controller_spec.rb
|
211
250
|
- spec/fixtures/thinking-cat.jpg
|
251
|
+
- spec/models/spree/legacy_user_spec.rb
|
252
|
+
- spec/requests/rabl_cache_spec.rb
|
253
|
+
- spec/requests/ransackable_attributes_spec.rb
|
254
|
+
- spec/requests/version_spec.rb
|
255
|
+
- spec/shared_examples/protect_product_actions.rb
|
256
|
+
- spec/spec_helper.rb
|
257
|
+
- spec/support/controller_hacks.rb
|
258
|
+
- spec/support/database_cleaner.rb
|
259
|
+
- spec/support/have_attributes_matcher.rb
|
212
260
|
- spree_api.gemspec
|
213
261
|
homepage: https://spreecommerce.com
|
214
262
|
licenses:
|
@@ -222,16 +270,60 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
270
|
requirements:
|
223
271
|
- - ">="
|
224
272
|
- !ruby/object:Gem::Version
|
225
|
-
version: 2.2.
|
273
|
+
version: 2.2.7
|
226
274
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
275
|
requirements:
|
228
|
-
- - "
|
276
|
+
- - ">"
|
229
277
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
278
|
+
version: 1.3.1
|
231
279
|
requirements: []
|
232
280
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.6.
|
281
|
+
rubygems_version: 2.6.12
|
234
282
|
signing_key:
|
235
283
|
specification_version: 4
|
236
284
|
summary: Spree's API
|
237
|
-
test_files:
|
285
|
+
test_files:
|
286
|
+
- spec/controllers/spree/api/base_controller_spec.rb
|
287
|
+
- spec/controllers/spree/api/v1/addresses_controller_spec.rb
|
288
|
+
- spec/controllers/spree/api/v1/checkouts_controller_spec.rb
|
289
|
+
- spec/controllers/spree/api/v1/classifications_controller_spec.rb
|
290
|
+
- spec/controllers/spree/api/v1/countries_controller_spec.rb
|
291
|
+
- spec/controllers/spree/api/v1/credit_cards_controller_spec.rb
|
292
|
+
- spec/controllers/spree/api/v1/customer_returns_controller_spec.rb
|
293
|
+
- spec/controllers/spree/api/v1/images_controller_spec.rb
|
294
|
+
- spec/controllers/spree/api/v1/inventory_units_controller_spec.rb
|
295
|
+
- spec/controllers/spree/api/v1/line_items_controller_spec.rb
|
296
|
+
- spec/controllers/spree/api/v1/option_types_controller_spec.rb
|
297
|
+
- spec/controllers/spree/api/v1/option_values_controller_spec.rb
|
298
|
+
- spec/controllers/spree/api/v1/orders_controller_spec.rb
|
299
|
+
- spec/controllers/spree/api/v1/payments_controller_spec.rb
|
300
|
+
- spec/controllers/spree/api/v1/product_properties_controller_spec.rb
|
301
|
+
- spec/controllers/spree/api/v1/products_controller_spec.rb
|
302
|
+
- spec/controllers/spree/api/v1/promotion_application_spec.rb
|
303
|
+
- spec/controllers/spree/api/v1/promotions_controller_spec.rb
|
304
|
+
- spec/controllers/spree/api/v1/properties_controller_spec.rb
|
305
|
+
- spec/controllers/spree/api/v1/reimbursements_controller_spec.rb
|
306
|
+
- spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb
|
307
|
+
- spec/controllers/spree/api/v1/shipments_controller_spec.rb
|
308
|
+
- spec/controllers/spree/api/v1/states_controller_spec.rb
|
309
|
+
- spec/controllers/spree/api/v1/stock_items_controller_spec.rb
|
310
|
+
- spec/controllers/spree/api/v1/stock_locations_controller_spec.rb
|
311
|
+
- spec/controllers/spree/api/v1/stock_movements_controller_spec.rb
|
312
|
+
- spec/controllers/spree/api/v1/stores_controller_spec.rb
|
313
|
+
- spec/controllers/spree/api/v1/tags_controller_spec.rb
|
314
|
+
- spec/controllers/spree/api/v1/taxonomies_controller_spec.rb
|
315
|
+
- spec/controllers/spree/api/v1/taxons_controller_spec.rb
|
316
|
+
- spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb
|
317
|
+
- spec/controllers/spree/api/v1/users_controller_spec.rb
|
318
|
+
- spec/controllers/spree/api/v1/variants_controller_spec.rb
|
319
|
+
- spec/controllers/spree/api/v1/zones_controller_spec.rb
|
320
|
+
- spec/fixtures/thinking-cat.jpg
|
321
|
+
- spec/models/spree/legacy_user_spec.rb
|
322
|
+
- spec/requests/rabl_cache_spec.rb
|
323
|
+
- spec/requests/ransackable_attributes_spec.rb
|
324
|
+
- spec/requests/version_spec.rb
|
325
|
+
- spec/shared_examples/protect_product_actions.rb
|
326
|
+
- spec/spec_helper.rb
|
327
|
+
- spec/support/controller_hacks.rb
|
328
|
+
- spec/support/database_cleaner.rb
|
329
|
+
- spec/support/have_attributes_matcher.rb
|