spree_api 4.2.7 → 4.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +14 -1
  3. data/app/controllers/concerns/spree/api/v2/product_list_includes.rb +23 -0
  4. data/app/controllers/spree/api/v1/classifications_controller.rb +4 -3
  5. data/app/controllers/spree/api/v1/orders_controller.rb +5 -1
  6. data/app/controllers/spree/api/v1/products_controller.rb +2 -2
  7. data/app/controllers/spree/api/v1/taxonomies_controller.rb +1 -1
  8. data/app/controllers/spree/api/v2/base_controller.rb +29 -6
  9. data/app/controllers/spree/api/v2/platform/addresses_controller.rb +19 -0
  10. data/app/controllers/spree/api/v2/platform/classifications_controller.rb +43 -0
  11. data/app/controllers/spree/api/v2/platform/cms_pages_controller.rb +15 -0
  12. data/app/controllers/spree/api/v2/platform/cms_sections_controller.rb +34 -0
  13. data/app/controllers/spree/api/v2/platform/countries_controller.rb +19 -0
  14. data/app/controllers/spree/api/v2/platform/menu_items_controller.rb +35 -0
  15. data/app/controllers/spree/api/v2/platform/menus_controller.rb +19 -0
  16. data/app/controllers/spree/api/v2/platform/option_types_controller.rb +15 -0
  17. data/app/controllers/spree/api/v2/platform/option_values_controller.rb +19 -0
  18. data/app/controllers/spree/api/v2/platform/products_controller.rb +21 -0
  19. data/app/controllers/spree/api/v2/platform/resource_controller.rb +112 -0
  20. data/app/controllers/spree/api/v2/platform/taxons_controller.rb +30 -0
  21. data/app/controllers/spree/api/v2/platform/users_controller.rb +28 -0
  22. data/app/controllers/spree/api/v2/resource_controller.rb +18 -6
  23. data/app/controllers/spree/api/v2/storefront/account/addresses_controller.rb +2 -14
  24. data/app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb +13 -11
  25. data/app/controllers/spree/api/v2/storefront/account/orders_controller.rb +2 -2
  26. data/app/controllers/spree/api/v2/storefront/account_controller.rb +32 -1
  27. data/app/controllers/spree/api/v2/storefront/cart_controller.rb +28 -6
  28. data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +2 -1
  29. data/app/controllers/spree/api/v2/storefront/cms_pages_controller.rb +41 -0
  30. data/app/controllers/spree/api/v2/storefront/countries_controller.rb +9 -14
  31. data/app/controllers/spree/api/v2/storefront/menus_controller.rb +35 -0
  32. data/app/controllers/spree/api/v2/storefront/order_status_controller.rb +1 -1
  33. data/app/controllers/spree/api/v2/storefront/products_controller.rb +6 -12
  34. data/app/controllers/spree/api/v2/storefront/stores_controller.rb +1 -1
  35. data/app/controllers/spree/api/v2/storefront/taxons_controller.rb +7 -8
  36. data/app/helpers/spree/api/v2/display_money_helper.rb +2 -2
  37. data/app/models/spree/api_configuration.rb +1 -0
  38. data/app/models/spree/api_dependencies.rb +19 -5
  39. data/app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb +16 -0
  40. data/app/serializers/spree/api/v2/base_serializer.rb +32 -0
  41. data/app/serializers/spree/api/v2/platform/address_serializer.rb +15 -0
  42. data/app/serializers/spree/api/v2/platform/base_serializer.rb +10 -0
  43. data/app/serializers/spree/api/v2/platform/classification_serializer.rb +14 -0
  44. data/app/serializers/spree/api/v2/platform/cms_page_serializer.rb +13 -0
  45. data/app/serializers/spree/api/v2/platform/cms_section_serializer.rb +11 -0
  46. data/app/serializers/spree/api/v2/platform/country_serializer.rb +13 -0
  47. data/app/serializers/spree/api/v2/platform/image_serializer.rb +15 -0
  48. data/app/serializers/spree/api/v2/platform/menu_item_serializer.rb +22 -0
  49. data/app/serializers/spree/api/v2/platform/menu_serializer.rb +13 -0
  50. data/app/serializers/spree/api/v2/platform/option_type_serializer.rb +13 -0
  51. data/app/serializers/spree/api/v2/platform/option_value_serializer.rb +13 -0
  52. data/app/serializers/spree/api/v2/platform/product_property_serializer.rb +11 -0
  53. data/app/serializers/spree/api/v2/platform/product_serializer.rb +78 -0
  54. data/app/serializers/spree/api/v2/platform/state_serializer.rb +13 -0
  55. data/app/serializers/spree/api/v2/platform/stock_item_serializer.rb +20 -0
  56. data/app/serializers/spree/api/v2/platform/stock_location_serializer.rb +16 -0
  57. data/app/serializers/spree/api/v2/platform/store_serializer.rb +14 -0
  58. data/app/serializers/spree/api/v2/platform/tax_category_serializer.rb +13 -0
  59. data/app/serializers/spree/api/v2/platform/taxon_image_serializer.rb +13 -0
  60. data/app/serializers/spree/api/v2/platform/taxon_serializer.rb +38 -0
  61. data/app/serializers/spree/api/v2/platform/taxonomy_serializer.rb +14 -0
  62. data/app/serializers/spree/api/v2/platform/user_serializer.rb +21 -0
  63. data/app/serializers/spree/api/v2/platform/variant_serializer.rb +57 -0
  64. data/app/serializers/spree/v2/storefront/base_serializer.rb +3 -2
  65. data/app/serializers/spree/v2/storefront/cms_page_serializer.rb +14 -0
  66. data/app/serializers/spree/v2/storefront/cms_section_serializer.rb +28 -0
  67. data/app/serializers/spree/v2/storefront/country_serializer.rb +4 -4
  68. data/app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb +2 -0
  69. data/app/serializers/spree/v2/storefront/menu_item_serializer.rb +37 -0
  70. data/app/serializers/spree/v2/storefront/menu_serializer.rb +13 -0
  71. data/app/serializers/spree/v2/storefront/product_property_serializer.rb +1 -1
  72. data/app/serializers/spree/v2/storefront/product_serializer.rb +4 -1
  73. data/app/serializers/spree/v2/storefront/store_serializer.rb +10 -0
  74. data/app/serializers/spree/v2/storefront/taxon_serializer.rb +6 -5
  75. data/config/initializers/doorkeeper.rb +8 -1
  76. data/config/initializers/rabl.rb +9 -0
  77. data/config/routes.rb +115 -3
  78. data/db/migrate/20210727102516_change_integer_id_columns_type.rb +9 -0
  79. data/docs/oauth/index.yml +2 -2
  80. data/docs/v2/platform/index.yaml +1501 -0
  81. data/docs/v2/storefront/index.yaml +48 -2
  82. data/lib/spree/api/engine.rb +6 -17
  83. data/lib/spree/api/testing_support/v2/base.rb +1 -1
  84. data/lib/spree/api/testing_support/v2/platform_contexts.rb +214 -0
  85. data/lib/spree/api/testing_support/v2/serializers_params.rb +14 -0
  86. data/lib/spree/api.rb +1 -0
  87. data/spree_api.gemspec +3 -0
  88. metadata +101 -11
  89. data/app/assets/javascripts/spree/api/main.js +0 -36
  90. data/app/assets/javascripts/spree/api/storefront/cart.js +0 -49
@@ -172,6 +172,12 @@ paths:
172
172
  email:
173
173
  type: string
174
174
  example: john@snow.org
175
+ bill_address_id:
176
+ type: integer
177
+ example: 1
178
+ ship_address_id:
179
+ type: integer
180
+ example: 1
175
181
  password:
176
182
  type: string
177
183
  example: spree123
@@ -255,7 +261,7 @@ paths:
255
261
  summary: Remove Address
256
262
  patch:
257
263
  description: Update selected Address for the signed in User
258
- summary: List of Addresses
264
+ summary: Update Address
259
265
  tags:
260
266
  - Account
261
267
  operationId: Update Address
@@ -308,6 +314,23 @@ paths:
308
314
  description: Filter based on payment method ID
309
315
  - $ref: '#/components/parameters/CreditCardIncludeParam'
310
316
  - $ref: '#/components/parameters/SparseFieldsParam'
317
+ '/api/v2/storefront/account/credit_cards/{id}':
318
+ delete:
319
+ description: 'Removes selected credit card for the signed in User. It uses soft-delete.'
320
+ tags:
321
+ - Account
322
+ operationId: Remove Credit Card
323
+ parameters:
324
+ - $ref: '#/components/parameters/CreditCardIncludeParam'
325
+ - $ref: '#/components/parameters/SparseFieldsParam'
326
+ responses:
327
+ '204':
328
+ description: Requested Credit Card has been removed from the User Account
329
+ '404':
330
+ $ref: '#/components/responses/404NotFound'
331
+ security:
332
+ - bearerAuth: []
333
+ summary: Remove Credit Card
311
334
  /api/v2/storefront/account/credit_cards/default:
312
335
  get:
313
336
  description: Return the User's default Credit Card
@@ -471,6 +494,22 @@ paths:
471
494
  - $ref: '#/components/parameters/CartIncludeParam'
472
495
  - $ref: '#/components/parameters/SparseFieldsParam'
473
496
  summary: Create a Cart
497
+ delete:
498
+ description: |-
499
+ Deletes Cart.
500
+ Endpoint can be called after PATCH /api/v2/storefront/cart/empty, or individually.
501
+ Shipments are canceled, payments are voided, then Line Items, Shipments & Payments are deleted.
502
+ tags:
503
+ - Cart
504
+ operationId: Deletes Cart
505
+ responses:
506
+ '204':
507
+ description: Current Cart has been removed.
508
+ '404':
509
+ $ref: '#/components/responses/404NotFound'
510
+ security:
511
+ - bearerAuth: [ ]
512
+ summary: Deletes Cart
474
513
  get:
475
514
  description: Returns contents of the currently used Cart
476
515
  tags:
@@ -1101,6 +1140,12 @@ paths:
1101
1140
  type: string
1102
1141
  example: Red
1103
1142
  description: 'Find Prodcuts with Variants that have the specified option (eg. color, size) and value (eg. red, XS)'
1143
+ - in: query
1144
+ name: 'filter[properties][brand-name]'
1145
+ schema:
1146
+ type: string
1147
+ example: alpha
1148
+ description: 'Find Prodcuts with Property Brand Name with value Alpha'
1104
1149
  - in: query
1105
1150
  name: 'filter[show_deleted]'
1106
1151
  schema:
@@ -1117,11 +1162,12 @@ paths:
1117
1162
  name: sort
1118
1163
  schema:
1119
1164
  type: string
1120
- example: '-updated_at,price'
1165
+ example: '-updated_at,price,-name'
1121
1166
  description: |-
1122
1167
  Sort products based on: <ul>
1123
1168
  <li>price (ascending/descenging)</li>
1124
1169
  <li>updated_at (ascending/descenging)</li>
1170
+ <li>name (ascending/descenging)</li>
1125
1171
  </ul> Use <q>-</q> sign to set descenging sort, eg. <q>-updated_at</q>
1126
1172
  - $ref: '#/components/parameters/PageParam'
1127
1173
  - $ref: '#/components/parameters/PerPageParam'
@@ -6,23 +6,6 @@ module Spree
6
6
  isolate_namespace Spree
7
7
  engine_name 'spree_api'
8
8
 
9
- Rabl.configure do |config|
10
- config.include_json_root = false
11
- config.include_child_root = false
12
-
13
- # Motivation here it make it call as_json when rendering timestamps
14
- # and therefore display miliseconds. Otherwise it would fall to
15
- # JSON.dump which doesn't display the miliseconds
16
- config.json_engine = ActiveSupport::JSON
17
- end
18
-
19
- # sets the manifests / assets to be precompiled, even when initialize_on_precompile is false
20
- initializer 'spree.assets.precompile', group: :all do |app|
21
- app.config.assets.precompile += %w[
22
- spree/api/all*
23
- ]
24
- end
25
-
26
9
  initializer 'spree.api.environment', before: :load_config_initializers do |_app|
27
10
  Spree::Api::Config = Spree::ApiConfiguration.new
28
11
  Spree::Api::Dependencies = Spree::ApiDependencies.new
@@ -32,6 +15,12 @@ module Spree
32
15
  Migrations.new(config, engine_name).check
33
16
  end
34
17
 
18
+ initializer 'spree.api.checking_deprecated_preferences' do
19
+ Spree::Api::Config.deprecated_preferences.each do |pref|
20
+ warn "[DEPRECATION] Spree::Api::Config[:#{pref[:name]}] is deprecated. #{pref[:message]}"
21
+ end
22
+ end
23
+
35
24
  def self.root
36
25
  @root ||= Pathname.new(File.expand_path('../../..', __dir__))
37
26
  end
@@ -4,7 +4,7 @@ shared_context 'API v2 tokens' do
4
4
  let(:headers_order_token) { { 'X-Spree-Order-Token' => order.token } }
5
5
  end
6
6
 
7
- [200, 201, 400, 401, 404, 403, 422].each do |status_code|
7
+ [200, 201, 204, 400, 401, 404, 403, 422].each do |status_code|
8
8
  shared_examples "returns #{status_code} HTTP status" do
9
9
  it "returns #{status_code}" do
10
10
  expect(response.status).to eq(status_code)
@@ -0,0 +1,214 @@
1
+ class String
2
+ def articleize
3
+ %w(a e i o u).include?(self[0].downcase) ? "an #{self}" : "a #{self}"
4
+ end
5
+ end
6
+
7
+ shared_context 'Platform API v2' do
8
+ let(:store) { Spree::Store.default }
9
+ let(:admin_app) { Doorkeeper::Application.find_or_create_by!(name: 'Admin Panel', scopes: 'admin', redirect_uri: '') }
10
+ let(:read_app) { Doorkeeper::Application.find_or_create_by!(name: 'Read App', scopes: 'read', redirect_uri: '') }
11
+ let(:oauth_token) do
12
+ Doorkeeper::AccessToken.create!(
13
+ application_id: admin_app.id,
14
+ scopes: admin_app.scopes
15
+ )
16
+ end
17
+ let(:read_oauth_token) do
18
+ Doorkeeper::AccessToken.create!(
19
+ application_id: read_app.id,
20
+ scopes: read_app.scopes
21
+ )
22
+ end
23
+ let(:user_oauth_token) do
24
+ Doorkeeper::AccessToken.create!(
25
+ resource_owner_id: user.id,
26
+ application_id: admin_app.id,
27
+ scopes: admin_app.scopes
28
+ )
29
+ end
30
+
31
+ let(:valid_authorization) { "Bearer #{oauth_token.token}" }
32
+ let(:valid_read_authorization) { "Bearer #{read_oauth_token.token}" }
33
+ let(:valid_user_authorization) { "Bearer #{user_oauth_token.token}" }
34
+ let(:bogus_authorization) { "Bearer #{::Base64.strict_encode64('bogus:bogus')}" }
35
+
36
+ let(:Authorization) { valid_authorization }
37
+ end
38
+
39
+ shared_context 'jsonapi pagination' do
40
+ let(:page) { 1 }
41
+ let(:per_page) { '' }
42
+ parameter name: :page, in: :query, type: :integer, example: 1
43
+ parameter name: :per_page, in: :query, type: :integer, example: 50
44
+ end
45
+
46
+ JSON_API_INCLUDES_DESCRIPTION = 'Select which associated resources you would like to fetch'\
47
+ ', see: <a href="https://jsonapi.org/format/#fetching-includes">'\
48
+ 'https://jsonapi.org/format/#fetching-includes</a>'.freeze
49
+ JSON_API_FILTER_DESCRIPTION = ''
50
+
51
+ def json_api_include_parameter(example = '')
52
+ let(:include) { nil }
53
+ parameter name: :include, in: :query, type: :string, descripton: JSON_API_INCLUDES_DESCRIPTION, example: example
54
+ end
55
+
56
+ def json_api_filter_parameter(example = '')
57
+ let(:filter) { nil }
58
+ parameter name: :filter, in: :query, type: :string, descripton: JSON_API_FILTER_DESCRIPTION, example: example
59
+ end
60
+
61
+ shared_examples 'authentication failed' do
62
+ response '401', 'Authentication Failed' do
63
+ let(:Authorization) { bogus_authorization }
64
+ schema '$ref' => '#/components/schemas/error'
65
+ run_test!
66
+ end
67
+ end
68
+
69
+ shared_examples 'record not found' do
70
+ response '404', 'Record not found' do
71
+ let(:id) { 'invalid' }
72
+ schema '$ref' => '#/components/schemas/error'
73
+ run_test!
74
+ end
75
+ end
76
+
77
+ shared_examples 'record found' do
78
+ response '200', 'Record found' do
79
+ schema '$ref' => '#/components/schemas/resource'
80
+ run_test!
81
+ end
82
+ end
83
+
84
+ shared_examples 'record deleted' do
85
+ response '204', 'Record deleted' do
86
+ run_test!
87
+ end
88
+ end
89
+
90
+ shared_examples 'records returned' do
91
+ response '200', 'Records returned' do
92
+ schema '$ref' => '#/components/schemas/resources_list'
93
+ run_test!
94
+ end
95
+ end
96
+
97
+ shared_examples 'record created' do
98
+ response '201', 'record created' do
99
+ schema '$ref' => '#/components/schemas/resource'
100
+ run_test!
101
+ end
102
+ end
103
+
104
+ shared_examples 'record updated' do
105
+ response '200', 'record updated' do
106
+ schema '$ref' => '#/components/schemas/resource'
107
+ run_test!
108
+ end
109
+ end
110
+
111
+ shared_examples 'invalid request' do |param_name|
112
+ response '422', 'invalid request' do
113
+ let(param_name) { invalid_param_value }
114
+ schema '$ref' => '#/components/schemas/validation_errors'
115
+ run_test!
116
+ end
117
+ end
118
+
119
+ # index action
120
+ shared_examples 'GET records list' do |resource_name, include_example, filter_example|
121
+ get "Returns a list of #{resource_name.pluralize}" do
122
+ tags resource_name.pluralize
123
+ security [ bearer_auth: [] ]
124
+ include_context 'jsonapi pagination'
125
+ json_api_include_parameter(include_example)
126
+ json_api_filter_parameter(filter_example)
127
+
128
+ before { records_list }
129
+
130
+ it_behaves_like 'records returned'
131
+ it_behaves_like 'authentication failed'
132
+ end
133
+ end
134
+
135
+ # show
136
+ shared_examples 'GET record' do |resource_name, include_example|
137
+ get "Returns #{resource_name.articleize}" do
138
+ tags resource_name.pluralize
139
+ security [ bearer_auth: [] ]
140
+ parameter name: :id, in: :path, type: :string
141
+ json_api_include_parameter(include_example)
142
+
143
+ it_behaves_like 'record found'
144
+ it_behaves_like 'record not found'
145
+ it_behaves_like 'authentication failed'
146
+ end
147
+ end
148
+
149
+ # create
150
+ shared_examples 'POST create record' do |resource_name, include_example|
151
+ param_name = resource_name.parameterize.to_sym
152
+
153
+ post "Creates #{resource_name.articleize}" do
154
+ tags resource_name.pluralize
155
+ consumes 'application/json'
156
+ security [ bearer_auth: [] ]
157
+ parameter name: param_name, in: :body, schema: { '$ref' => "#/components/schemas/#{param_name}_params" }
158
+ json_api_include_parameter(include_example)
159
+
160
+ let(param_name) { valid_create_param_value }
161
+
162
+ it_behaves_like 'record created'
163
+ it_behaves_like 'invalid request', param_name
164
+ end
165
+ end
166
+
167
+ # update
168
+ shared_examples 'PUT update record' do |resource_name, include_example|
169
+ param_name = resource_name.parameterize.to_sym
170
+
171
+ put "Updates #{resource_name.articleize}" do
172
+ tags resource_name.pluralize
173
+ security [ bearer_auth: [] ]
174
+ consumes 'application/json'
175
+ parameter name: :id, in: :path, type: :string
176
+ parameter name: param_name, in: :body, schema: { '$ref' => "#/components/schemas/#{param_name}_params" }
177
+ json_api_include_parameter(include_example)
178
+
179
+ let(param_name) { valid_update_param_value }
180
+
181
+ it_behaves_like 'record updated'
182
+ it_behaves_like 'invalid request', param_name
183
+ it_behaves_like 'record not found'
184
+ it_behaves_like 'authentication failed'
185
+ end
186
+ end
187
+
188
+ # destroy
189
+ shared_examples 'DELETE record' do |resource_name|
190
+ delete "Deletes #{resource_name.articleize}" do
191
+ tags resource_name.pluralize
192
+ security [ bearer_auth: [] ]
193
+ parameter name: :id, in: :path, type: :string
194
+
195
+ it_behaves_like 'record deleted'
196
+ it_behaves_like 'record not found'
197
+ it_behaves_like 'authentication failed'
198
+ end
199
+ end
200
+
201
+ shared_examples 'CRUD examples' do |resource_name, include_example, filter_example|
202
+ resource_path = resource_name.pluralize.parameterize
203
+
204
+ path "/api/v2/platform/#{resource_path}" do
205
+ include_examples 'GET records list', resource_name, include_example, filter_example
206
+ include_examples 'POST create record', resource_name, include_example
207
+ end
208
+
209
+ path "/api/v2/platform/#{resource_path}/{id}" do
210
+ include_examples 'GET record', resource_name, include_example
211
+ include_examples 'PUT update record', resource_name, include_example
212
+ include_examples 'DELETE record', resource_name
213
+ end
214
+ end
@@ -0,0 +1,14 @@
1
+ shared_context 'API v2 serializers params' do
2
+ let(:store) { Spree::Store.default || create(:store, default: true) }
3
+ let(:currency) { store.default_currency }
4
+ let(:locale) { store.default_locale }
5
+
6
+ let(:serializer_params) do
7
+ {
8
+ store: store,
9
+ currency: currency,
10
+ user: nil,
11
+ locale: locale
12
+ }
13
+ end
14
+ end
data/lib/spree/api.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'spree/core'
2
2
 
3
3
  require 'rabl'
4
+ require 'responders'
4
5
 
5
6
  module Spree
6
7
  module Api
data/spree_api.gemspec CHANGED
@@ -25,9 +25,12 @@ Gem::Specification.new do |s|
25
25
  s.require_paths = ["lib"]
26
26
 
27
27
  s.add_development_dependency 'jsonapi-rspec'
28
+ s.add_development_dependency 'rswag-specs'
29
+ s.add_development_dependency 'multi_json'
28
30
 
29
31
  s.add_dependency 'spree_core', s.version
30
32
  s.add_dependency 'rabl', '~> 0.14', '>= 0.14.2'
31
33
  s.add_dependency 'jsonapi-serializer', '~> 2.1'
32
34
  s.add_dependency 'doorkeeper', '~> 5.2', '>= 5.2.1'
35
+ s.add_dependency 'responders'
33
36
  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: 4.2.7
4
+ version: 4.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: 2024-04-21 00:00:00.000000000 Z
11
+ date: 2021-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-rspec
@@ -24,20 +24,48 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rswag-specs
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: spree_core
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
59
  - - '='
32
60
  - !ruby/object:Gem::Version
33
- version: 4.2.7
61
+ version: 4.3.0.rc1
34
62
  type: :runtime
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
66
  - - '='
39
67
  - !ruby/object:Gem::Version
40
- version: 4.2.7
68
+ version: 4.3.0.rc1
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rabl
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +120,20 @@ dependencies:
92
120
  - - ">="
93
121
  - !ruby/object:Gem::Version
94
122
  version: 5.2.1
123
+ - !ruby/object:Gem::Dependency
124
+ name: responders
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ type: :runtime
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
95
137
  description: Spree's API
96
138
  email:
97
139
  - ryan@spreecommerce.com
@@ -103,8 +145,7 @@ files:
103
145
  - Gemfile
104
146
  - LICENSE
105
147
  - Rakefile
106
- - app/assets/javascripts/spree/api/main.js
107
- - app/assets/javascripts/spree/api/storefront/cart.js
148
+ - app/controllers/concerns/spree/api/v2/product_list_includes.rb
108
149
  - app/controllers/concerns/spree/api/v2/storefront/order_concern.rb
109
150
  - app/controllers/spree/api/base_controller.rb
110
151
  - app/controllers/spree/api/errors_controller.rb
@@ -139,6 +180,19 @@ files:
139
180
  - app/controllers/spree/api/v1/variants_controller.rb
140
181
  - app/controllers/spree/api/v1/zones_controller.rb
141
182
  - app/controllers/spree/api/v2/base_controller.rb
183
+ - app/controllers/spree/api/v2/platform/addresses_controller.rb
184
+ - app/controllers/spree/api/v2/platform/classifications_controller.rb
185
+ - app/controllers/spree/api/v2/platform/cms_pages_controller.rb
186
+ - app/controllers/spree/api/v2/platform/cms_sections_controller.rb
187
+ - app/controllers/spree/api/v2/platform/countries_controller.rb
188
+ - app/controllers/spree/api/v2/platform/menu_items_controller.rb
189
+ - app/controllers/spree/api/v2/platform/menus_controller.rb
190
+ - app/controllers/spree/api/v2/platform/option_types_controller.rb
191
+ - app/controllers/spree/api/v2/platform/option_values_controller.rb
192
+ - app/controllers/spree/api/v2/platform/products_controller.rb
193
+ - app/controllers/spree/api/v2/platform/resource_controller.rb
194
+ - app/controllers/spree/api/v2/platform/taxons_controller.rb
195
+ - app/controllers/spree/api/v2/platform/users_controller.rb
142
196
  - app/controllers/spree/api/v2/resource_controller.rb
143
197
  - app/controllers/spree/api/v2/storefront/account/addresses_controller.rb
144
198
  - app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb
@@ -146,7 +200,9 @@ files:
146
200
  - app/controllers/spree/api/v2/storefront/account_controller.rb
147
201
  - app/controllers/spree/api/v2/storefront/cart_controller.rb
148
202
  - app/controllers/spree/api/v2/storefront/checkout_controller.rb
203
+ - app/controllers/spree/api/v2/storefront/cms_pages_controller.rb
149
204
  - app/controllers/spree/api/v2/storefront/countries_controller.rb
205
+ - app/controllers/spree/api/v2/storefront/menus_controller.rb
150
206
  - app/controllers/spree/api/v2/storefront/order_status_controller.rb
151
207
  - app/controllers/spree/api/v2/storefront/products_controller.rb
152
208
  - app/controllers/spree/api/v2/storefront/stores_controller.rb
@@ -158,14 +214,43 @@ files:
158
214
  - app/models/concerns/spree/user_api_methods.rb
159
215
  - app/models/spree/api_configuration.rb
160
216
  - app/models/spree/api_dependencies.rb
217
+ - app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb
218
+ - app/serializers/spree/api/v2/base_serializer.rb
219
+ - app/serializers/spree/api/v2/platform/address_serializer.rb
220
+ - app/serializers/spree/api/v2/platform/base_serializer.rb
221
+ - app/serializers/spree/api/v2/platform/classification_serializer.rb
222
+ - app/serializers/spree/api/v2/platform/cms_page_serializer.rb
223
+ - app/serializers/spree/api/v2/platform/cms_section_serializer.rb
224
+ - app/serializers/spree/api/v2/platform/country_serializer.rb
225
+ - app/serializers/spree/api/v2/platform/image_serializer.rb
226
+ - app/serializers/spree/api/v2/platform/menu_item_serializer.rb
227
+ - app/serializers/spree/api/v2/platform/menu_serializer.rb
228
+ - app/serializers/spree/api/v2/platform/option_type_serializer.rb
229
+ - app/serializers/spree/api/v2/platform/option_value_serializer.rb
230
+ - app/serializers/spree/api/v2/platform/product_property_serializer.rb
231
+ - app/serializers/spree/api/v2/platform/product_serializer.rb
232
+ - app/serializers/spree/api/v2/platform/state_serializer.rb
233
+ - app/serializers/spree/api/v2/platform/stock_item_serializer.rb
234
+ - app/serializers/spree/api/v2/platform/stock_location_serializer.rb
235
+ - app/serializers/spree/api/v2/platform/store_serializer.rb
236
+ - app/serializers/spree/api/v2/platform/tax_category_serializer.rb
237
+ - app/serializers/spree/api/v2/platform/taxon_image_serializer.rb
238
+ - app/serializers/spree/api/v2/platform/taxon_serializer.rb
239
+ - app/serializers/spree/api/v2/platform/taxonomy_serializer.rb
240
+ - app/serializers/spree/api/v2/platform/user_serializer.rb
241
+ - app/serializers/spree/api/v2/platform/variant_serializer.rb
161
242
  - app/serializers/spree/v2/storefront/address_serializer.rb
162
243
  - app/serializers/spree/v2/storefront/base_serializer.rb
163
244
  - app/serializers/spree/v2/storefront/cart_serializer.rb
245
+ - app/serializers/spree/v2/storefront/cms_page_serializer.rb
246
+ - app/serializers/spree/v2/storefront/cms_section_serializer.rb
164
247
  - app/serializers/spree/v2/storefront/country_serializer.rb
165
248
  - app/serializers/spree/v2/storefront/credit_card_serializer.rb
166
249
  - app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
167
250
  - app/serializers/spree/v2/storefront/image_serializer.rb
168
251
  - app/serializers/spree/v2/storefront/line_item_serializer.rb
252
+ - app/serializers/spree/v2/storefront/menu_item_serializer.rb
253
+ - app/serializers/spree/v2/storefront/menu_serializer.rb
169
254
  - app/serializers/spree/v2/storefront/option_type_serializer.rb
170
255
  - app/serializers/spree/v2/storefront/option_value_serializer.rb
171
256
  - app/serializers/spree/v2/storefront/payment_method_serializer.rb
@@ -287,6 +372,7 @@ files:
287
372
  - app/views/spree/api/v1/zones/show.rabl
288
373
  - config/initializers/doorkeeper.rb
289
374
  - config/initializers/json_api_mime_types.rb
375
+ - config/initializers/rabl.rb
290
376
  - config/initializers/user_class_extensions.rb
291
377
  - config/locales/en.yml
292
378
  - config/routes.rb
@@ -295,7 +381,9 @@ files:
295
381
  - db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb
296
382
  - db/migrate/20131017162334_add_index_to_user_spree_api_key.rb
297
383
  - db/migrate/20180320110726_create_doorkeeper_tables.rb
384
+ - db/migrate/20210727102516_change_integer_id_columns_type.rb
298
385
  - docs/oauth/index.yml
386
+ - docs/v2/platform/index.yaml
299
387
  - docs/v2/storefront/index.yaml
300
388
  - lib/spree/api.rb
301
389
  - lib/spree/api/controller_setup.rb
@@ -307,6 +395,8 @@ files:
307
395
  - lib/spree/api/testing_support/setup.rb
308
396
  - lib/spree/api/testing_support/v2/base.rb
309
397
  - lib/spree/api/testing_support/v2/current_order.rb
398
+ - lib/spree/api/testing_support/v2/platform_contexts.rb
399
+ - lib/spree/api/testing_support/v2/serializers_params.rb
310
400
  - lib/spree_api.rb
311
401
  - script/rails
312
402
  - spec/fixtures/thinking-cat.jpg
@@ -316,9 +406,9 @@ licenses:
316
406
  - BSD-3-Clause
317
407
  metadata:
318
408
  bug_tracker_uri: https://github.com/spree/spree/issues
319
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.7
409
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.3.0.rc1
320
410
  documentation_uri: https://guides.spreecommerce.org/
321
- source_code_uri: https://github.com/spree/spree/tree/v4.2.7
411
+ source_code_uri: https://github.com/spree/spree/tree/v4.3.0.rc1
322
412
  post_install_message:
323
413
  rdoc_options: []
324
414
  require_paths:
@@ -330,11 +420,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
330
420
  version: '2.5'
331
421
  required_rubygems_version: !ruby/object:Gem::Requirement
332
422
  requirements:
333
- - - ">="
423
+ - - ">"
334
424
  - !ruby/object:Gem::Version
335
- version: '0'
425
+ version: 1.3.1
336
426
  requirements: []
337
- rubygems_version: 3.5.3
427
+ rubygems_version: 3.2.3
338
428
  signing_key:
339
429
  specification_version: 4
340
430
  summary: Spree's API
@@ -1,36 +0,0 @@
1
- //= require spree
2
-
3
- var SpreeAPI = {
4
- oauthToken: null, // user Bearer token to authorize operations for the given user
5
- orderToken: null // order token to authorize operations on current order (cart)
6
- }
7
-
8
- SpreeAPI.Storefront = {}
9
- SpreeAPI.Platform = {}
10
-
11
- // API routes
12
- Spree.routes.api_v2_storefront_cart_create = Spree.pathFor('api/v2/storefront/cart')
13
- Spree.routes.api_v2_storefront_cart_add_item = Spree.pathFor('api/v2/storefront/cart/add_item')
14
- Spree.routes.api_v2_storefront_cart_apply_coupon_code = Spree.pathFor('api/v2/storefront/cart/apply_coupon_code')
15
-
16
- // helpers
17
- SpreeAPI.handle500error = function () {
18
- alert('Internal Server Error')
19
- }
20
-
21
- SpreeAPI.prepareHeaders = function (headers) {
22
- if (typeof headers === 'undefined') {
23
- headers = {}
24
- }
25
-
26
- // if signed in we need to pass the Bearer authorization token
27
- // so backend will recognize that actions are authorized in scope of this user
28
- if (SpreeAPI.oauthToken) {
29
- headers['Authorization'] = 'Bearer ' + SpreeAPI.oauthToken
30
- }
31
-
32
- // default headers, required for POST/PATCH/DELETE requests
33
- headers['Accept'] = 'application/json'
34
- headers['Content-Type'] = 'application/json'
35
- return headers
36
- }