spree_api 1.3.5 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/Rakefile +1 -1
- data/app/controllers/spree/api/addresses_controller.rb +0 -1
- data/app/controllers/spree/api/base_controller.rb +21 -9
- data/app/controllers/spree/api/checkouts_controller.rb +40 -20
- data/app/controllers/spree/api/countries_controller.rb +0 -1
- data/app/controllers/spree/api/inventory_units_controller.rb +1 -1
- data/app/controllers/spree/api/option_types_controller.rb +46 -0
- data/app/controllers/spree/api/option_values_controller.rb +56 -0
- data/app/controllers/spree/api/orders_controller.rb +1 -21
- data/app/controllers/spree/api/product_properties_controller.rb +0 -1
- data/app/controllers/spree/api/products_controller.rb +12 -27
- data/app/controllers/spree/api/properties_controller.rb +61 -0
- data/app/controllers/spree/api/shipments_controller.rb +51 -1
- data/app/controllers/spree/api/states_controller.rb +32 -0
- data/app/controllers/spree/api/stock_items_controller.rb +70 -0
- data/app/controllers/spree/api/stock_locations_controller.rb +45 -0
- data/app/controllers/spree/api/stock_movements_controller.rb +55 -0
- data/app/controllers/spree/api/taxonomies_controller.rb +5 -0
- data/app/controllers/spree/api/taxons_controller.rb +16 -2
- data/app/controllers/spree/api/variants_controller.rb +1 -1
- data/app/controllers/spree/api/zones_controller.rb +0 -1
- data/app/helpers/spree/api/api_helpers.rb +34 -7
- data/app/models/spree/api_configuration.rb +1 -2
- data/app/models/spree/line_item_decorator.rb +1 -1
- data/app/models/spree/order_decorator.rb +6 -169
- data/app/overrides/api_admin_user_edit_form.rb +7 -6
- data/app/views/spree/admin/users/_api_fields.html.erb +7 -8
- data/app/views/spree/api/addresses/show.v1.rabl +2 -2
- data/app/views/spree/api/adjustments/show.v1.rabl +2 -0
- data/app/views/spree/api/credit_cards/show.v1.rabl +2 -0
- data/app/views/spree/api/option_types/index.v1.rabl +3 -0
- data/app/views/spree/api/option_types/show.v1.rabl +5 -0
- data/app/views/spree/api/option_values/index.v1.rabl +3 -0
- data/app/views/spree/api/option_values/show.v1.rabl +2 -0
- data/app/views/spree/api/orders/could_not_apply_coupon.v1.rabl +2 -0
- data/app/views/spree/api/orders/delivery.v1.rabl +2 -2
- data/app/views/spree/api/orders/payment.v1.rabl +3 -0
- data/app/views/spree/api/orders/show.v1.rabl +8 -0
- data/app/views/spree/api/properties/index.v1.rabl +7 -0
- data/app/views/spree/api/properties/new.v1.rabl +2 -0
- data/app/views/spree/api/properties/show.v1.rabl +2 -0
- data/app/views/spree/api/shared/stock_location_required.v1.rabl +2 -0
- data/app/views/spree/api/shipments/show.v1.rabl +7 -0
- data/app/views/spree/api/states/index.v1.rabl +14 -0
- data/app/views/spree/api/states/show.v1.rabl +2 -0
- data/app/views/spree/api/stock_items/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_items/show.v1.rabl +5 -0
- data/app/views/spree/api/stock_locations/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_locations/show.v1.rabl +8 -0
- data/app/views/spree/api/stock_movements/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_movements/show.v1.rabl +5 -0
- data/app/views/spree/api/taxonomies/jstree.rabl +8 -0
- data/app/views/spree/api/taxons/jstree.rabl +8 -0
- data/app/views/spree/api/variants/index.v1.rabl +14 -1
- data/app/views/spree/api/variants/variant.v1.rabl +0 -4
- data/config/locales/en.yml +1 -0
- data/config/routes.rb +29 -3
- data/lib/spree/api.rb +0 -2
- data/lib/spree/api/controller_setup.rb +6 -1
- data/lib/spree/api/testing_support/helpers.rb +1 -1
- data/lib/spree/api/testing_support/setup.rb +13 -0
- data/spec/controllers/spree/api/base_controller_spec.rb +14 -1
- data/spec/controllers/spree/api/checkouts_controller_spec.rb +59 -28
- data/spec/controllers/spree/api/line_items_controller_spec.rb +1 -5
- data/spec/controllers/spree/api/option_types_controller_spec.rb +116 -0
- data/spec/controllers/spree/api/option_values_controller_spec.rb +128 -0
- data/spec/controllers/spree/api/orders_controller_spec.rb +11 -93
- data/spec/controllers/spree/api/product_properties_controller_spec.rb +2 -2
- data/spec/controllers/spree/api/products_controller_spec.rb +18 -76
- data/spec/controllers/spree/api/properties_controller_spec.rb +89 -0
- data/spec/controllers/spree/api/return_authorizations_controller_spec.rb +1 -9
- data/spec/controllers/spree/api/shipments_controller_spec.rb +80 -5
- data/spec/controllers/spree/api/states_controller_spec.rb +76 -0
- data/spec/controllers/spree/api/stock_items_controller_spec.rb +88 -0
- data/spec/controllers/spree/api/stock_locations_controller_spec.rb +86 -0
- data/spec/controllers/spree/api/stock_movements_controller_spec.rb +72 -0
- data/spec/controllers/spree/api/taxonomies_controller_spec.rb +7 -0
- data/spec/controllers/spree/api/taxons_controller_spec.rb +29 -2
- data/spec/controllers/spree/api/unauthenticated_products_controller_spec.rb +1 -1
- data/spec/controllers/spree/api/variants_controller_spec.rb +5 -16
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/models/spree/order_spec.rb +7 -328
- data/spec/spec_helper.rb +18 -2
- data/spree_api.gemspec +2 -1
- metadata +67 -16
- data/.rspec +0 -1
- data/app/controllers/spree/base_controller_decorator.rb +0 -15
- data/app/overrides/api_key_spree_layout.rb +0 -7
- data/app/views/spree/api/_key.html.erb +0 -4
- data/db/migrate/20131017162334_add_index_to_user_spree_api_key.rb +0 -7
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
if ENV["COVERAGE"]
|
2
|
+
# Run Coverage report
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start do
|
5
|
+
add_group 'Controllers', 'app/controllers'
|
6
|
+
add_group 'Helpers', 'app/helpers'
|
7
|
+
add_group 'Mailers', 'app/mailers'
|
8
|
+
add_group 'Models', 'app/models'
|
9
|
+
add_group 'Views', 'app/views'
|
10
|
+
add_group 'Libraries', 'lib'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
1
14
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
15
|
ENV["RAILS_ENV"] ||= 'test'
|
3
16
|
require File.expand_path("../dummy/config/environment", __FILE__)
|
@@ -8,7 +21,8 @@ require 'rspec/autorun'
|
|
8
21
|
# in spec/support/ and its subdirectories.
|
9
22
|
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
10
23
|
|
11
|
-
require 'spree/
|
24
|
+
require 'spree/testing_support/factories'
|
25
|
+
require 'spree/testing_support/preferences'
|
12
26
|
|
13
27
|
require 'spree/api/testing_support/helpers'
|
14
28
|
require 'spree/api/testing_support/setup'
|
@@ -20,9 +34,11 @@ RSpec.configure do |config|
|
|
20
34
|
config.include FactoryGirl::Syntax::Methods
|
21
35
|
config.include Spree::Api::TestingSupport::Helpers, :type => :controller
|
22
36
|
config.extend Spree::Api::TestingSupport::Setup, :type => :controller
|
23
|
-
config.include Spree::
|
37
|
+
config.include Spree::TestingSupport::Preferences, :type => :controller
|
24
38
|
|
25
39
|
config.before do
|
26
40
|
Spree::Api::Config[:requires_authentication] = true
|
27
41
|
end
|
42
|
+
|
43
|
+
config.fail_fast = ENV['FAIL_FAST'] || false
|
28
44
|
end
|
data/spree_api.gemspec
CHANGED
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:
|
4
|
+
version: 2.0.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: 2013-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.0.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:
|
26
|
+
version: 2.0.0.rc1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rabl
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.4
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: versioncake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - '='
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
47
|
+
version: 1.0.0
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - '='
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
54
|
+
version: 1.0.0
|
41
55
|
description: Spree's API
|
42
56
|
email:
|
43
57
|
- ryan@spreecommerce.com
|
@@ -45,8 +59,7 @@ executables: []
|
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
47
61
|
files:
|
48
|
-
-
|
49
|
-
- ".rspec"
|
62
|
+
- .gitignore
|
50
63
|
- Gemfile
|
51
64
|
- LICENSE
|
52
65
|
- Rakefile
|
@@ -57,18 +70,24 @@ files:
|
|
57
70
|
- app/controllers/spree/api/images_controller.rb
|
58
71
|
- app/controllers/spree/api/inventory_units_controller.rb
|
59
72
|
- app/controllers/spree/api/line_items_controller.rb
|
73
|
+
- app/controllers/spree/api/option_types_controller.rb
|
74
|
+
- app/controllers/spree/api/option_values_controller.rb
|
60
75
|
- app/controllers/spree/api/orders_controller.rb
|
61
76
|
- app/controllers/spree/api/payments_controller.rb
|
62
77
|
- app/controllers/spree/api/product_properties_controller.rb
|
63
78
|
- app/controllers/spree/api/products_controller.rb
|
79
|
+
- app/controllers/spree/api/properties_controller.rb
|
64
80
|
- app/controllers/spree/api/return_authorizations_controller.rb
|
65
81
|
- app/controllers/spree/api/shipments_controller.rb
|
82
|
+
- app/controllers/spree/api/states_controller.rb
|
83
|
+
- app/controllers/spree/api/stock_items_controller.rb
|
84
|
+
- app/controllers/spree/api/stock_locations_controller.rb
|
85
|
+
- app/controllers/spree/api/stock_movements_controller.rb
|
66
86
|
- app/controllers/spree/api/taxonomies_controller.rb
|
67
87
|
- app/controllers/spree/api/taxons_controller.rb
|
68
88
|
- app/controllers/spree/api/users_controller.rb
|
69
89
|
- app/controllers/spree/api/variants_controller.rb
|
70
90
|
- app/controllers/spree/api/zones_controller.rb
|
71
|
-
- app/controllers/spree/base_controller_decorator.rb
|
72
91
|
- app/helpers/spree/api/api_helpers.rb
|
73
92
|
- app/models/spree/api_configuration.rb
|
74
93
|
- app/models/spree/line_item_decorator.rb
|
@@ -76,12 +95,12 @@ files:
|
|
76
95
|
- app/models/spree/order_decorator.rb
|
77
96
|
- app/models/spree/user_decorator.rb
|
78
97
|
- app/overrides/api_admin_user_edit_form.rb
|
79
|
-
- app/overrides/api_key_spree_layout.rb
|
80
98
|
- app/views/spree/admin/users/_api_fields.html.erb
|
81
|
-
- app/views/spree/api/_key.html.erb
|
82
99
|
- app/views/spree/api/addresses/show.v1.rabl
|
100
|
+
- app/views/spree/api/adjustments/show.v1.rabl
|
83
101
|
- app/views/spree/api/countries/index.v1.rabl
|
84
102
|
- app/views/spree/api/countries/show.v1.rabl
|
103
|
+
- app/views/spree/api/credit_cards/show.v1.rabl
|
85
104
|
- app/views/spree/api/errors/gateway_error.v1.rabl
|
86
105
|
- app/views/spree/api/errors/invalid_api_key.v1.rabl
|
87
106
|
- app/views/spree/api/errors/invalid_resource.v1.rabl
|
@@ -92,10 +111,15 @@ files:
|
|
92
111
|
- app/views/spree/api/inventory_units/show.rabl
|
93
112
|
- app/views/spree/api/line_items/new.v1.rabl
|
94
113
|
- app/views/spree/api/line_items/show.v1.rabl
|
114
|
+
- app/views/spree/api/option_types/index.v1.rabl
|
115
|
+
- app/views/spree/api/option_types/show.v1.rabl
|
116
|
+
- app/views/spree/api/option_values/index.v1.rabl
|
117
|
+
- app/views/spree/api/option_values/show.v1.rabl
|
95
118
|
- app/views/spree/api/orders/address.v1.rabl
|
96
119
|
- app/views/spree/api/orders/canceled.v1.rabl
|
97
120
|
- app/views/spree/api/orders/cart.v1.rabl
|
98
121
|
- app/views/spree/api/orders/complete.v1.rabl
|
122
|
+
- app/views/spree/api/orders/could_not_apply_coupon.v1.rabl
|
99
123
|
- app/views/spree/api/orders/could_not_transition.v1.rabl
|
100
124
|
- app/views/spree/api/orders/delivery.v1.rabl
|
101
125
|
- app/views/spree/api/orders/index.v1.rabl
|
@@ -113,16 +137,30 @@ files:
|
|
113
137
|
- app/views/spree/api/products/new.v1.rabl
|
114
138
|
- app/views/spree/api/products/product.v1.rabl
|
115
139
|
- app/views/spree/api/products/show.v1.rabl
|
140
|
+
- app/views/spree/api/properties/index.v1.rabl
|
141
|
+
- app/views/spree/api/properties/new.v1.rabl
|
142
|
+
- app/views/spree/api/properties/show.v1.rabl
|
116
143
|
- app/views/spree/api/return_authorizations/index.v1.rabl
|
117
144
|
- app/views/spree/api/return_authorizations/new.v1.rabl
|
118
145
|
- app/views/spree/api/return_authorizations/show.v1.rabl
|
146
|
+
- app/views/spree/api/shared/stock_location_required.v1.rabl
|
119
147
|
- app/views/spree/api/shipments/cannot_ready_shipment.v1.rabl
|
120
148
|
- app/views/spree/api/shipments/show.v1.rabl
|
149
|
+
- app/views/spree/api/states/index.v1.rabl
|
150
|
+
- app/views/spree/api/states/show.v1.rabl
|
151
|
+
- app/views/spree/api/stock_items/index.v1.rabl
|
152
|
+
- app/views/spree/api/stock_items/show.v1.rabl
|
153
|
+
- app/views/spree/api/stock_locations/index.v1.rabl
|
154
|
+
- app/views/spree/api/stock_locations/show.v1.rabl
|
155
|
+
- app/views/spree/api/stock_movements/index.v1.rabl
|
156
|
+
- app/views/spree/api/stock_movements/show.v1.rabl
|
121
157
|
- app/views/spree/api/taxonomies/index.v1.rabl
|
158
|
+
- app/views/spree/api/taxonomies/jstree.rabl
|
122
159
|
- app/views/spree/api/taxonomies/nested.v1.rabl
|
123
160
|
- app/views/spree/api/taxonomies/new.v1.rabl
|
124
161
|
- app/views/spree/api/taxonomies/show.v1.rabl
|
125
162
|
- app/views/spree/api/taxons/index.v1.rabl
|
163
|
+
- app/views/spree/api/taxons/jstree.rabl
|
126
164
|
- app/views/spree/api/taxons/new.v1.rabl
|
127
165
|
- app/views/spree/api/taxons/show.v1.rabl
|
128
166
|
- app/views/spree/api/taxons/taxons.v1.rabl
|
@@ -141,7 +179,6 @@ files:
|
|
141
179
|
- db/migrate/20100107141738_add_api_key_to_spree_users.rb
|
142
180
|
- db/migrate/20120411123334_resize_api_key_field.rb
|
143
181
|
- db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb
|
144
|
-
- db/migrate/20131017162334_add_index_to_user_spree_api_key.rb
|
145
182
|
- lib/spree/api.rb
|
146
183
|
- lib/spree/api/controller_setup.rb
|
147
184
|
- lib/spree/api/engine.rb
|
@@ -159,12 +196,19 @@ files:
|
|
159
196
|
- spec/controllers/spree/api/images_controller_spec.rb
|
160
197
|
- spec/controllers/spree/api/inventory_units_controller_spec.rb
|
161
198
|
- spec/controllers/spree/api/line_items_controller_spec.rb
|
199
|
+
- spec/controllers/spree/api/option_types_controller_spec.rb
|
200
|
+
- spec/controllers/spree/api/option_values_controller_spec.rb
|
162
201
|
- spec/controllers/spree/api/orders_controller_spec.rb
|
163
202
|
- spec/controllers/spree/api/payments_controller_spec.rb
|
164
203
|
- spec/controllers/spree/api/product_properties_controller_spec.rb
|
165
204
|
- spec/controllers/spree/api/products_controller_spec.rb
|
205
|
+
- spec/controllers/spree/api/properties_controller_spec.rb
|
166
206
|
- spec/controllers/spree/api/return_authorizations_controller_spec.rb
|
167
207
|
- spec/controllers/spree/api/shipments_controller_spec.rb
|
208
|
+
- spec/controllers/spree/api/states_controller_spec.rb
|
209
|
+
- spec/controllers/spree/api/stock_items_controller_spec.rb
|
210
|
+
- spec/controllers/spree/api/stock_locations_controller_spec.rb
|
211
|
+
- spec/controllers/spree/api/stock_movements_controller_spec.rb
|
168
212
|
- spec/controllers/spree/api/taxonomies_controller_spec.rb
|
169
213
|
- spec/controllers/spree/api/taxons_controller_spec.rb
|
170
214
|
- spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
|
@@ -189,17 +233,17 @@ require_paths:
|
|
189
233
|
- lib
|
190
234
|
required_ruby_version: !ruby/object:Gem::Requirement
|
191
235
|
requirements:
|
192
|
-
- -
|
236
|
+
- - ! '>='
|
193
237
|
- !ruby/object:Gem::Version
|
194
238
|
version: '0'
|
195
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
240
|
requirements:
|
197
|
-
- -
|
241
|
+
- - ! '>'
|
198
242
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
243
|
+
version: 1.3.1
|
200
244
|
requirements: []
|
201
245
|
rubyforge_project:
|
202
|
-
rubygems_version: 2.
|
246
|
+
rubygems_version: 2.0.3
|
203
247
|
signing_key:
|
204
248
|
specification_version: 4
|
205
249
|
summary: Spree's API
|
@@ -211,12 +255,19 @@ test_files:
|
|
211
255
|
- spec/controllers/spree/api/images_controller_spec.rb
|
212
256
|
- spec/controllers/spree/api/inventory_units_controller_spec.rb
|
213
257
|
- spec/controllers/spree/api/line_items_controller_spec.rb
|
258
|
+
- spec/controllers/spree/api/option_types_controller_spec.rb
|
259
|
+
- spec/controllers/spree/api/option_values_controller_spec.rb
|
214
260
|
- spec/controllers/spree/api/orders_controller_spec.rb
|
215
261
|
- spec/controllers/spree/api/payments_controller_spec.rb
|
216
262
|
- spec/controllers/spree/api/product_properties_controller_spec.rb
|
217
263
|
- spec/controllers/spree/api/products_controller_spec.rb
|
264
|
+
- spec/controllers/spree/api/properties_controller_spec.rb
|
218
265
|
- spec/controllers/spree/api/return_authorizations_controller_spec.rb
|
219
266
|
- spec/controllers/spree/api/shipments_controller_spec.rb
|
267
|
+
- spec/controllers/spree/api/states_controller_spec.rb
|
268
|
+
- spec/controllers/spree/api/stock_items_controller_spec.rb
|
269
|
+
- spec/controllers/spree/api/stock_locations_controller_spec.rb
|
270
|
+
- spec/controllers/spree/api/stock_movements_controller_spec.rb
|
220
271
|
- spec/controllers/spree/api/taxonomies_controller_spec.rb
|
221
272
|
- spec/controllers/spree/api/taxons_controller_spec.rb
|
222
273
|
- spec/controllers/spree/api/unauthenticated_products_controller_spec.rb
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require_dependency 'spree/base_controller'
|
2
|
-
|
3
|
-
Spree::BaseController.class_eval do
|
4
|
-
before_filter :ensure_api_key
|
5
|
-
|
6
|
-
# Need to generate an API key for a user due to some actions potentially
|
7
|
-
# requiring authentication to the Spree API
|
8
|
-
def ensure_api_key
|
9
|
-
if user = try_spree_current_user
|
10
|
-
if user.respond_to?(:spree_api_key) && user.spree_api_key.blank?
|
11
|
-
user.generate_spree_api_key!
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|