spree_api 4.3.0.rc1 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/spree/api/v2/caching.rb +33 -0
  3. data/app/controllers/spree/api/v2/base_controller.rb +3 -1
  4. data/app/controllers/spree/api/v2/platform/menu_items_controller.rb +2 -2
  5. data/app/controllers/spree/api/v2/platform/menus_controller.rb +4 -0
  6. data/app/controllers/spree/api/v2/platform/products_controller.rb +12 -0
  7. data/app/controllers/spree/api/v2/platform/resource_controller.rb +3 -0
  8. data/app/controllers/spree/api/v2/resource_controller.rb +6 -1
  9. data/app/controllers/spree/api/v2/storefront/account/addresses_controller.rb +3 -1
  10. data/app/controllers/spree/api/v2/storefront/account/orders_controller.rb +4 -0
  11. data/app/controllers/spree/api/v2/storefront/cart_controller.rb +39 -1
  12. data/app/controllers/spree/api/v2/storefront/countries_controller.rb +7 -0
  13. data/app/controllers/spree/api/v2/storefront/products_controller.rb +12 -0
  14. data/app/models/spree/api_configuration.rb +4 -2
  15. data/app/models/spree/api_dependencies.rb +6 -2
  16. data/app/presenters/spree/api/products/filters_presenter.rb +39 -0
  17. data/app/serializers/concerns/spree/api/v2/image_transformation_concern.rb +15 -0
  18. data/app/serializers/concerns/spree/api/v2/taxon_image_transformation_concern.rb +15 -0
  19. data/app/serializers/spree/api/v2/base_serializer.rb +1 -1
  20. data/app/serializers/spree/api/v2/platform/icon_serializer.rb +16 -0
  21. data/app/serializers/spree/api/v2/platform/image_serializer.rb +3 -1
  22. data/app/serializers/spree/api/v2/platform/menu_item_serializer.rb +28 -5
  23. data/app/serializers/spree/api/v2/platform/product_serializer.rb +11 -11
  24. data/app/serializers/spree/api/v2/platform/taxon_image_serializer.rb +3 -1
  25. data/app/serializers/spree/api/v2/platform/user_serializer.rb +16 -0
  26. data/app/serializers/spree/v2/storefront/icon_serializer.rb +14 -0
  27. data/app/serializers/spree/v2/storefront/image_serializer.rb +3 -1
  28. data/app/serializers/spree/v2/storefront/menu_item_serializer.rb +12 -6
  29. data/app/serializers/spree/v2/storefront/payment_method_serializer.rb +4 -0
  30. data/app/serializers/spree/v2/storefront/product_serializer.rb +18 -12
  31. data/app/serializers/spree/v2/storefront/taxon_image_serializer.rb +3 -1
  32. data/config/locales/en.yml +1 -1
  33. data/config/routes.rb +3 -1
  34. data/docs/oauth/index.yml +2 -2
  35. data/docs/v2/platform/index.yaml +2442 -244
  36. data/docs/v2/storefront/index.yaml +11541 -1152
  37. data/lib/spree/api/testing_support/v2/platform_contexts.rb +15 -5
  38. data/spree_api.gemspec +1 -1
  39. metadata +16 -10
@@ -6,7 +6,7 @@ module Spree
6
6
 
7
7
  set_type :product
8
8
 
9
- attributes :name, :description, :available_on, :slug, :meta_description, :meta_keywords, :updated_at
9
+ attributes :name, :description, :available_on, :slug, :meta_description, :meta_keywords, :updated_at, :sku
10
10
 
11
11
  attribute :purchasable do |product|
12
12
  product.purchasable?
@@ -48,22 +48,28 @@ module Spree
48
48
  has_many :option_types
49
49
  has_many :product_properties
50
50
 
51
- has_many :taxons do |object, params|
51
+ has_many :taxons, serializer: :taxon, record_type: :taxon do |object, params|
52
52
  object.taxons_for_store(params[:store])
53
53
  end
54
54
 
55
55
  # all images from all variants
56
56
  has_many :images,
57
- object_method_name: :variant_images,
58
- id_method_name: :variant_image_ids,
59
- record_type: :image,
60
- serializer: :image
61
-
62
- has_one :default_variant,
63
- object_method_name: :default_variant,
64
- id_method_name: :default_variant_id,
65
- record_type: :variant,
66
- serializer: :variant
57
+ object_method_name: :variant_images,
58
+ id_method_name: :variant_image_ids,
59
+ record_type: :image,
60
+ serializer: :image
61
+
62
+ has_one :default_variant,
63
+ object_method_name: :default_variant,
64
+ id_method_name: :default_variant_id,
65
+ record_type: :variant,
66
+ serializer: :variant
67
+
68
+ has_one :primary_variant,
69
+ object_method_name: :master,
70
+ id_method_name: :master_id,
71
+ record_type: :variant,
72
+ serializer: :variant
67
73
  end
68
74
  end
69
75
  end
@@ -2,9 +2,11 @@ module Spree
2
2
  module V2
3
3
  module Storefront
4
4
  class TaxonImageSerializer < BaseSerializer
5
+ include ::Spree::Api::V2::TaxonImageTransformationConcern
6
+
5
7
  set_type :taxon_image
6
8
 
7
- attributes :viewable_type, :viewable_id, :styles
9
+ attributes :styles, :alt, :original_url
8
10
  end
9
11
  end
10
12
  end
@@ -26,7 +26,7 @@ en:
26
26
  cannot_ready: "Cannot ready shipment."
27
27
  stock_location_required: "A stock_location_id parameter must be provided in order to retrieve stock movements."
28
28
  invalid_taxonomy_id: "Invalid taxonomy id."
29
- shipment_transfer_errors_occurred: "Following errors occured while attempting this action:"
29
+ shipment_transfer_errors_occurred: "Following errors occurred while attempting this action:"
30
30
  negative_quantity: "quantity is negative"
31
31
  wrong_shipment_target: "target shipment is the same as original shipment"
32
32
 
data/config/routes.rb CHANGED
@@ -137,6 +137,8 @@ Spree::Core::Engine.add_routes do
137
137
  delete 'remove_coupon_code/:coupon_code', to: 'cart#remove_coupon_code', as: :cart_remove_coupon_code
138
138
  delete 'remove_coupon_code', to: 'cart#remove_coupon_code', as: :cart_remove_coupon_code_without_code
139
139
  get :estimate_shipping_rates
140
+ patch :associate
141
+ patch :change_currency
140
142
  end
141
143
 
142
144
  resource :checkout, controller: :checkout, only: %i[update] do
@@ -254,7 +256,7 @@ Spree::Core::Engine.add_routes do
254
256
 
255
257
  # Menu API
256
258
  resources :menus
257
- resource :menu_items do
259
+ resources :menu_items do
258
260
  member do
259
261
  patch :reposition
260
262
  end
data/docs/oauth/index.yml CHANGED
@@ -18,13 +18,13 @@ info:
18
18
  paths:
19
19
  /spree_oauth/token:
20
20
  post:
21
- description: Creates or refreshes a Bearer token required to authorize calls API calls
21
+ description: Creates or refreshes a Bearer token required to authorize API calls
22
22
  tags:
23
23
  - Token
24
24
  operationId: Create or Refresh Token
25
25
  responses:
26
26
  '200':
27
- description: Token was succesfully created or refreshed
27
+ description: Token was successfully created or refreshed
28
28
  content:
29
29
  application/json:
30
30
  schema: