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
data/config/routes.rb CHANGED
@@ -128,7 +128,7 @@ Spree::Core::Engine.add_routes do
128
128
 
129
129
  namespace :v2 do
130
130
  namespace :storefront do
131
- resource :cart, controller: :cart, only: %i[show create] do
131
+ resource :cart, controller: :cart, only: %i[show create destroy] do
132
132
  post :add_item
133
133
  patch :empty
134
134
  delete 'remove_line_item/:line_item_id', to: 'cart#remove_line_item', as: :cart_remove_line_item
@@ -149,11 +149,11 @@ Spree::Core::Engine.add_routes do
149
149
  get :shipping_rates
150
150
  end
151
151
 
152
- resource :account, controller: :account, only: %i[show]
152
+ resource :account, controller: :account, only: %i[show create update]
153
153
 
154
154
  namespace :account do
155
155
  resources :addresses, controller: :addresses
156
- resources :credit_cards, controller: :credit_cards, only: %i[index show]
156
+ resources :credit_cards, controller: :credit_cards, only: %i[index show destroy]
157
157
  resources :orders, controller: :orders, only: %i[index show]
158
158
  end
159
159
 
@@ -163,6 +163,118 @@ Spree::Core::Engine.add_routes do
163
163
  resources :products, only: %i[index show]
164
164
  resources :taxons, only: %i[index show], id: /.+/
165
165
  get '/stores/:code', to: 'stores#show', as: :store
166
+
167
+ resources :menus, only: %i[index show]
168
+ resources :cms_pages, only: %i[index show]
169
+ end
170
+
171
+ namespace :platform do
172
+ # Promotions API
173
+ resources :promotions
174
+
175
+ # Returns API
176
+ resources :customer_returns
177
+ resources :reimbursements
178
+ resources :return_authorizations do
179
+ member do
180
+ put :add
181
+ put :cancel
182
+ put :receive
183
+ end
184
+ end
185
+
186
+ # Product Catalog API
187
+ resources :products
188
+ resources :taxonomies
189
+ resources :taxons
190
+ resources :classifications do
191
+ member do
192
+ put :reposition
193
+ end
194
+ end
195
+ resources :images
196
+ resources :variants
197
+ resources :properties
198
+ resources :product_properties
199
+ resources :option_types
200
+ resources :option_values
201
+
202
+ # Order API
203
+ resources :orders do
204
+ member do
205
+ put :next
206
+ put :advance
207
+ put :approve
208
+ put :cancel
209
+ put :empty
210
+ put :apply_coupon_code
211
+ put :remove_coupon_code
212
+ end
213
+ end
214
+ resources :line_items
215
+ resources :payments do
216
+ member do
217
+ put :authorize
218
+ put :capture
219
+ put :purchase
220
+ put :void
221
+ put :credit
222
+ end
223
+ end
224
+
225
+ # Geo API
226
+ resources :zones
227
+ resources :countries, only: [:index, :show]
228
+ resources :states, only: [:index, :show]
229
+
230
+ # Shipment API
231
+ resources :shipments do
232
+ collection do
233
+ post 'transfer_to_location'
234
+ post 'transfer_to_shipment'
235
+ end
236
+ member do
237
+ put :ready
238
+ put :ship
239
+ put :add
240
+ put :remove
241
+ end
242
+ end
243
+
244
+ # Inventory API
245
+ resources :inventory_units
246
+ resources :stock_items
247
+ resources :stock_locations
248
+ resources :stock_movements
249
+
250
+ # User API
251
+ resources :users
252
+ resources :credit_cards
253
+ resources :addresses
254
+
255
+ # Menu API
256
+ resources :menus
257
+ resource :menu_items do
258
+ member do
259
+ patch :reposition
260
+ end
261
+ end
262
+
263
+ # CMS Pages API
264
+ resources :cms_pages do
265
+ member do
266
+ patch :toggle_visibility
267
+ end
268
+ end
269
+
270
+ resource :cms_sections do
271
+ member do
272
+ patch :reposition
273
+ end
274
+ end
275
+
276
+ # Store API
277
+ resources :stores
166
278
  end
167
279
  end
168
280
 
@@ -0,0 +1,9 @@
1
+ class ChangeIntegerIdColumnsType < ActiveRecord::Migration[5.2]
2
+ def change
3
+ change_column :spree_oauth_access_grants, :resource_owner_id, :bigint
4
+ change_column :spree_oauth_access_grants, :application_id, :bigint
5
+
6
+ change_column :spree_oauth_access_tokens, :resource_owner_id, :bigint
7
+ change_column :spree_oauth_access_tokens, :application_id, :bigint
8
+ end
9
+ end
data/docs/oauth/index.yml CHANGED
@@ -6,8 +6,8 @@ servers:
6
6
  description: localhost
7
7
  info:
8
8
  version: 1.0.0
9
- title: Spree OAuth 2.0 Authentication
10
- description: "For API v2 Spree uses [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) gem for handling OAuth athentication. \n\nSpree supports new token creation and refreshing of existing tokens."
9
+ title: Authentication
10
+ description: "Spree uses oAuth based Authentication via short-lived Bearer tokens. You can either create a new one or refresh existing token."
11
11
  contact:
12
12
  name: Spark Solutions
13
13
  url: 'https://sparksolutions.co'