spree_api 4.4.1 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/spree/api/v2/product_list_includes.rb +10 -8
  3. data/app/controllers/spree/api/v2/platform/orders_controller.rb +1 -1
  4. data/app/controllers/spree/api/v2/platform/products_controller.rb +5 -1
  5. data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +1 -1
  6. data/app/controllers/spree/api/v2/storefront/digitals_controller.rb +5 -1
  7. data/app/controllers/spree/api/v2/storefront/stores_controller.rb +4 -0
  8. data/app/helpers/spree/api/v2/store_media_serializer_images_concern.rb +35 -0
  9. data/app/models/concerns/spree/webhooks/has_webhooks.rb +31 -7
  10. data/app/models/spree/api/webhooks/product_decorator.rb +21 -2
  11. data/app/models/spree/webhooks/subscriber.rb +4 -0
  12. data/app/serializers/spree/api/v2/platform/cms_section_image_one_serializer.rb +9 -0
  13. data/app/serializers/spree/api/v2/platform/cms_section_image_three_serializer.rb +9 -0
  14. data/app/serializers/spree/api/v2/platform/cms_section_image_two_serializer.rb +9 -0
  15. data/app/serializers/spree/api/v2/platform/hero_image_serializer.rb +10 -0
  16. data/app/serializers/spree/api/v2/platform/image_gallery_serializer.rb +10 -0
  17. data/app/serializers/spree/api/v2/platform/side_by_side_image_serializer.rb +10 -0
  18. data/app/serializers/spree/api/v2/platform/store_serializer.rb +1 -0
  19. data/app/serializers/spree/api/v2/platform/user_serializer.rb +1 -1
  20. data/app/serializers/spree/v2/storefront/cms_section_serializer.rb +3 -3
  21. data/app/serializers/spree/v2/storefront/order_serializer.rb +9 -0
  22. data/app/serializers/spree/v2/storefront/product_property_serializer.rb +1 -1
  23. data/app/serializers/spree/v2/storefront/product_serializer.rb +1 -1
  24. data/app/serializers/spree/v2/storefront/shipment_serializer.rb +3 -0
  25. data/app/serializers/spree/v2/storefront/store_serializer.rb +5 -10
  26. data/app/serializers/spree/v2/storefront/user_serializer.rb +1 -1
  27. data/app/serializers/spree/v2/storefront/variant_serializer.rb +1 -1
  28. data/app/services/spree/webhooks/subscribers/queue_requests.rb +8 -2
  29. data/config/routes.rb +1 -120
  30. data/docs/v2/platform/index.yaml +1597 -998
  31. data/docs/v2/storefront/index.yaml +357 -33
  32. data/lib/spree/api/configuration.rb +11 -0
  33. data/lib/spree/api/dependencies.rb +165 -0
  34. data/lib/spree/api/engine.rb +5 -16
  35. data/lib/spree/api/testing_support/v2/platform_contexts.rb +0 -1
  36. data/lib/spree/api.rb +0 -4
  37. data/lib/spree_api.rb +0 -1
  38. data/spree_api.gemspec +0 -2
  39. metadata +17 -178
  40. data/app/controllers/spree/api/base_controller.rb +0 -171
  41. data/app/controllers/spree/api/v1/addresses_controller.rb +0 -46
  42. data/app/controllers/spree/api/v1/checkouts_controller.rb +0 -106
  43. data/app/controllers/spree/api/v1/classifications_controller.rb +0 -21
  44. data/app/controllers/spree/api/v1/countries_controller.rb +0 -22
  45. data/app/controllers/spree/api/v1/credit_cards_controller.rb +0 -26
  46. data/app/controllers/spree/api/v1/customer_returns_controller.rb +0 -25
  47. data/app/controllers/spree/api/v1/images_controller.rb +0 -58
  48. data/app/controllers/spree/api/v1/inventory_units_controller.rb +0 -54
  49. data/app/controllers/spree/api/v1/line_items_controller.rb +0 -70
  50. data/app/controllers/spree/api/v1/option_types_controller.rb +0 -60
  51. data/app/controllers/spree/api/v1/option_values_controller.rb +0 -62
  52. data/app/controllers/spree/api/v1/orders_controller.rb +0 -160
  53. data/app/controllers/spree/api/v1/payments_controller.rb +0 -82
  54. data/app/controllers/spree/api/v1/product_properties_controller.rb +0 -73
  55. data/app/controllers/spree/api/v1/products_controller.rb +0 -131
  56. data/app/controllers/spree/api/v1/promotions_controller.rb +0 -30
  57. data/app/controllers/spree/api/v1/properties_controller.rb +0 -70
  58. data/app/controllers/spree/api/v1/reimbursements_controller.rb +0 -25
  59. data/app/controllers/spree/api/v1/return_authorizations_controller.rb +0 -70
  60. data/app/controllers/spree/api/v1/shipments_controller.rb +0 -196
  61. data/app/controllers/spree/api/v1/states_controller.rb +0 -36
  62. data/app/controllers/spree/api/v1/stock_items_controller.rb +0 -82
  63. data/app/controllers/spree/api/v1/stock_locations_controller.rb +0 -53
  64. data/app/controllers/spree/api/v1/stock_movements_controller.rb +0 -45
  65. data/app/controllers/spree/api/v1/stores_controller.rb +0 -56
  66. data/app/controllers/spree/api/v1/taxonomies_controller.rb +0 -67
  67. data/app/controllers/spree/api/v1/taxons_controller.rb +0 -100
  68. data/app/controllers/spree/api/v1/users_controller.rb +0 -97
  69. data/app/controllers/spree/api/v1/variants_controller.rb +0 -81
  70. data/app/controllers/spree/api/v1/zones_controller.rb +0 -55
  71. data/app/helpers/spree/api/api_helpers.rb +0 -190
  72. data/app/models/spree/api_configuration.rb +0 -10
  73. data/app/views/spree/api/errors/gateway_error.rabl +0 -2
  74. data/app/views/spree/api/errors/invalid_api_key.rabl +0 -2
  75. data/app/views/spree/api/errors/invalid_resource.rabl +0 -3
  76. data/app/views/spree/api/errors/must_specify_api_key.rabl +0 -2
  77. data/app/views/spree/api/errors/not_found.rabl +0 -2
  78. data/app/views/spree/api/errors/unauthorized.rabl +0 -2
  79. data/app/views/spree/api/v1/addresses/show.rabl +0 -10
  80. data/app/views/spree/api/v1/adjustments/show.rabl +0 -4
  81. data/app/views/spree/api/v1/countries/index.rabl +0 -7
  82. data/app/views/spree/api/v1/countries/show.rabl +0 -5
  83. data/app/views/spree/api/v1/credit_cards/index.rabl +0 -7
  84. data/app/views/spree/api/v1/credit_cards/show.rabl +0 -3
  85. data/app/views/spree/api/v1/customer_returns/index.rabl +0 -7
  86. data/app/views/spree/api/v1/images/index.rabl +0 -4
  87. data/app/views/spree/api/v1/images/new.rabl +0 -3
  88. data/app/views/spree/api/v1/images/show.rabl +0 -6
  89. data/app/views/spree/api/v1/inventory_units/show.rabl +0 -2
  90. data/app/views/spree/api/v1/line_items/new.rabl +0 -3
  91. data/app/views/spree/api/v1/line_items/show.rabl +0 -14
  92. data/app/views/spree/api/v1/option_types/index.rabl +0 -3
  93. data/app/views/spree/api/v1/option_types/new.rabl +0 -3
  94. data/app/views/spree/api/v1/option_types/show.rabl +0 -5
  95. data/app/views/spree/api/v1/option_values/index.rabl +0 -3
  96. data/app/views/spree/api/v1/option_values/new.rabl +0 -3
  97. data/app/views/spree/api/v1/option_values/show.rabl +0 -2
  98. data/app/views/spree/api/v1/orders/address.rabl +0 -0
  99. data/app/views/spree/api/v1/orders/canceled.rabl +0 -0
  100. data/app/views/spree/api/v1/orders/cart.rabl +0 -0
  101. data/app/views/spree/api/v1/orders/complete.rabl +0 -0
  102. data/app/views/spree/api/v1/orders/could_not_apply_coupon.rabl +0 -2
  103. data/app/views/spree/api/v1/orders/could_not_transition.rabl +0 -3
  104. data/app/views/spree/api/v1/orders/index.rabl +0 -7
  105. data/app/views/spree/api/v1/orders/insufficient_quantity.rabl +0 -2
  106. data/app/views/spree/api/v1/orders/invalid_shipping_method.rabl +0 -2
  107. data/app/views/spree/api/v1/orders/mine.rabl +0 -9
  108. data/app/views/spree/api/v1/orders/order.rabl +0 -10
  109. data/app/views/spree/api/v1/orders/payment.rabl +0 -3
  110. data/app/views/spree/api/v1/orders/show.rabl +0 -51
  111. data/app/views/spree/api/v1/payments/credit_over_limit.rabl +0 -2
  112. data/app/views/spree/api/v1/payments/index.rabl +0 -7
  113. data/app/views/spree/api/v1/payments/new.rabl +0 -5
  114. data/app/views/spree/api/v1/payments/show.rabl +0 -2
  115. data/app/views/spree/api/v1/payments/update_forbidden.rabl +0 -2
  116. data/app/views/spree/api/v1/product_properties/index.rabl +0 -7
  117. data/app/views/spree/api/v1/product_properties/new.rabl +0 -2
  118. data/app/views/spree/api/v1/product_properties/show.rabl +0 -2
  119. data/app/views/spree/api/v1/products/index.rabl +0 -9
  120. data/app/views/spree/api/v1/products/new.rabl +0 -3
  121. data/app/views/spree/api/v1/products/product.rabl +0 -1
  122. data/app/views/spree/api/v1/products/show.rabl +0 -36
  123. data/app/views/spree/api/v1/promotions/handler.rabl +0 -5
  124. data/app/views/spree/api/v1/promotions/show.rabl +0 -2
  125. data/app/views/spree/api/v1/properties/index.rabl +0 -7
  126. data/app/views/spree/api/v1/properties/new.rabl +0 -2
  127. data/app/views/spree/api/v1/properties/show.rabl +0 -2
  128. data/app/views/spree/api/v1/reimbursements/index.rabl +0 -7
  129. data/app/views/spree/api/v1/return_authorizations/index.rabl +0 -7
  130. data/app/views/spree/api/v1/return_authorizations/new.rabl +0 -3
  131. data/app/views/spree/api/v1/return_authorizations/show.rabl +0 -2
  132. data/app/views/spree/api/v1/shared/stock_location_required.rabl +0 -2
  133. data/app/views/spree/api/v1/shipments/big.rabl +0 -48
  134. data/app/views/spree/api/v1/shipments/cannot_ready_shipment.rabl +0 -2
  135. data/app/views/spree/api/v1/shipments/mine.rabl +0 -9
  136. data/app/views/spree/api/v1/shipments/show.rabl +0 -32
  137. data/app/views/spree/api/v1/shipments/small.rabl +0 -37
  138. data/app/views/spree/api/v1/shipping_rates/show.rabl +0 -2
  139. data/app/views/spree/api/v1/states/index.rabl +0 -12
  140. data/app/views/spree/api/v1/states/show.rabl +0 -2
  141. data/app/views/spree/api/v1/stock_items/index.rabl +0 -7
  142. data/app/views/spree/api/v1/stock_items/show.rabl +0 -5
  143. data/app/views/spree/api/v1/stock_locations/index.rabl +0 -7
  144. data/app/views/spree/api/v1/stock_locations/show.rabl +0 -8
  145. data/app/views/spree/api/v1/stock_movements/index.rabl +0 -7
  146. data/app/views/spree/api/v1/stock_movements/show.rabl +0 -5
  147. data/app/views/spree/api/v1/stores/index.rabl +0 -4
  148. data/app/views/spree/api/v1/stores/show.rabl +0 -2
  149. data/app/views/spree/api/v1/tags/index.rabl +0 -9
  150. data/app/views/spree/api/v1/taxonomies/index.rabl +0 -7
  151. data/app/views/spree/api/v1/taxonomies/jstree.rabl +0 -7
  152. data/app/views/spree/api/v1/taxonomies/nested.rabl +0 -11
  153. data/app/views/spree/api/v1/taxonomies/new.rabl +0 -3
  154. data/app/views/spree/api/v1/taxonomies/show.rabl +0 -15
  155. data/app/views/spree/api/v1/taxons/index.rabl +0 -10
  156. data/app/views/spree/api/v1/taxons/jstree.rabl +0 -7
  157. data/app/views/spree/api/v1/taxons/new.rabl +0 -3
  158. data/app/views/spree/api/v1/taxons/show.rabl +0 -6
  159. data/app/views/spree/api/v1/taxons/taxons.rabl +0 -5
  160. data/app/views/spree/api/v1/users/index.rabl +0 -7
  161. data/app/views/spree/api/v1/users/new.rabl +0 -3
  162. data/app/views/spree/api/v1/users/show.rabl +0 -11
  163. data/app/views/spree/api/v1/variants/big.rabl +0 -14
  164. data/app/views/spree/api/v1/variants/index.rabl +0 -9
  165. data/app/views/spree/api/v1/variants/new.rabl +0 -2
  166. data/app/views/spree/api/v1/variants/show.rabl +0 -3
  167. data/app/views/spree/api/v1/variants/small.rabl +0 -18
  168. data/app/views/spree/api/v1/zones/index.rabl +0 -7
  169. data/app/views/spree/api/v1/zones/show.rabl +0 -6
  170. data/config/initializers/rabl.rb +0 -9
  171. data/lib/spree/api/api_dependencies.rb +0 -163
  172. data/lib/spree/api/controller_setup.rb +0 -19
  173. data/lib/spree/api/responders/rabl_template.rb +0 -28
  174. data/lib/spree/api/responders.rb +0 -11
  175. data/lib/spree/api/testing_support/helpers.rb +0 -44
  176. data/lib/spree/api/testing_support/setup.rb +0 -16
@@ -0,0 +1,165 @@
1
+ module Spree
2
+ module Api
3
+ class ApiDependencies
4
+ include Spree::DependenciesHelper
5
+
6
+ INJECTION_POINTS = [
7
+ :storefront_cart_create_service, :storefront_cart_add_item_service, :storefront_cart_remove_line_item_service,
8
+ :storefront_cart_remove_item_service, :storefront_cart_set_item_quantity_service, :storefront_cart_recalculate_service,
9
+ :storefront_cms_page_serializer, :storefront_cms_page_finder,
10
+ :storefront_cart_update, :storefront_coupon_handler, :storefront_checkout_next_service, :storefront_checkout_advance_service,
11
+ :storefront_checkout_update_service, :storefront_checkout_complete_service, :storefront_checkout_add_store_credit_service,
12
+ :storefront_checkout_remove_store_credit_service, :storefront_checkout_get_shipping_rates_service,
13
+ :storefront_cart_compare_line_items_service, :storefront_cart_serializer, :storefront_credit_card_serializer,
14
+ :storefront_credit_card_finder, :storefront_shipment_serializer, :storefront_payment_method_serializer, :storefront_country_finder,
15
+ :storefront_country_serializer, :storefront_menu_serializer, :storefront_menu_finder, :storefront_current_order_finder,
16
+ :storefront_completed_order_finder, :storefront_order_sorter, :storefront_collection_paginator, :storefront_user_serializer,
17
+ :storefront_products_sorter, :storefront_products_finder, :storefront_product_serializer, :storefront_taxon_serializer,
18
+ :storefront_taxon_finder, :storefront_find_by_variant_finder, :storefront_cart_update_service, :storefront_cart_associate_service,
19
+ :storefront_cart_estimate_shipping_rates_service, :storefront_estimated_shipment_serializer,
20
+ :storefront_store_serializer, :storefront_address_serializer, :storefront_order_serializer,
21
+ :storefront_account_create_address_service, :storefront_account_update_address_service, :storefront_address_finder,
22
+ :storefront_account_create_service, :storefront_account_update_service, :storefront_collection_sorter, :error_handler,
23
+ :storefront_cart_empty_service, :storefront_cart_destroy_service, :storefront_credit_cards_destroy_service, :platform_products_sorter,
24
+ :storefront_cart_change_currency_service, :storefront_payment_serializer,
25
+ :storefront_payment_create_service, :storefront_address_create_service, :storefront_address_update_service,
26
+ :storefront_checkout_select_shipping_method_service,
27
+
28
+ :platform_admin_user_serializer, :platform_coupon_handler, :platform_order_update_service,
29
+ :platform_order_use_store_credit_service, :platform_order_remove_store_credit_service,
30
+ :platform_order_complete_service, :platform_order_empty_service, :platform_order_destroy_service,
31
+ :platform_order_next_service, :platform_order_advance_service,
32
+ :platform_line_item_create_service, :platform_line_item_update_service, :platform_line_item_destroy_service,
33
+ :platform_order_approve_service, :platform_order_cancel_service,
34
+ :platform_shipment_change_state_service, :platform_shipment_create_service, :platform_shipment_update_service,
35
+ :platform_shipment_add_item_service, :platform_shipment_remove_item_service
36
+ ].freeze
37
+
38
+ attr_accessor *INJECTION_POINTS
39
+
40
+ def initialize
41
+ set_storefront_defaults
42
+ set_platform_defaults
43
+ end
44
+
45
+ private
46
+
47
+ def set_storefront_defaults
48
+ # cart services
49
+ @storefront_cart_create_service = Spree::Dependencies.cart_create_service
50
+ @storefront_cart_add_item_service = Spree::Dependencies.cart_add_item_service
51
+ @storefront_cart_compare_line_items_service = Spree::Dependencies.cart_compare_line_items_service
52
+ @storefront_cart_update_service = Spree::Dependencies.cart_update_service
53
+ @storefront_cart_remove_line_item_service = Spree::Dependencies.cart_remove_line_item_service
54
+ @storefront_cart_remove_item_service = Spree::Dependencies.cart_remove_item_service
55
+ @storefront_cart_set_item_quantity_service = Spree::Dependencies.cart_set_item_quantity_service
56
+ @storefront_cart_recalculate_service = Spree::Dependencies.cart_recalculate_service
57
+ @storefront_cart_estimate_shipping_rates_service = Spree::Dependencies.cart_estimate_shipping_rates_service
58
+ @storefront_cart_empty_service = Spree::Dependencies.cart_empty_service
59
+ @storefront_cart_destroy_service = Spree::Dependencies.cart_destroy_service
60
+ @storefront_cart_associate_service = Spree::Dependencies.cart_associate_service
61
+ @storefront_cart_change_currency_service = Spree::Dependencies.cart_change_currency_service
62
+
63
+ # coupon code handler
64
+ @storefront_coupon_handler = Spree::Dependencies.coupon_handler
65
+
66
+ # checkout services
67
+ @storefront_checkout_next_service = Spree::Dependencies.checkout_next_service
68
+ @storefront_checkout_advance_service = Spree::Dependencies.checkout_advance_service
69
+ @storefront_checkout_update_service = Spree::Dependencies.checkout_update_service
70
+ @storefront_checkout_complete_service = Spree::Dependencies.checkout_complete_service
71
+ @storefront_checkout_add_store_credit_service = Spree::Dependencies.checkout_add_store_credit_service
72
+ @storefront_checkout_remove_store_credit_service = Spree::Dependencies.checkout_remove_store_credit_service
73
+ @storefront_checkout_get_shipping_rates_service = Spree::Dependencies.checkout_get_shipping_rates_service
74
+ @storefront_checkout_select_shipping_method_service = Spree::Dependencies.checkout_select_shipping_method_service
75
+
76
+ # account services
77
+ @storefront_account_create_service = Spree::Dependencies.account_create_service
78
+ @storefront_account_update_service = Spree::Dependencies.account_update_service
79
+
80
+ # address services
81
+ @storefront_address_create_service = Spree::Dependencies.address_create_service
82
+ @storefront_address_update_service = Spree::Dependencies.address_update_service
83
+
84
+ # credit card services
85
+ @storefront_credit_cards_destroy_service = Spree::Dependencies.credit_cards_destroy_service
86
+
87
+ # payment services
88
+ @storefront_payment_create_service = Spree::Dependencies.payment_create_service
89
+
90
+ # serializers
91
+ @storefront_address_serializer = 'Spree::V2::Storefront::AddressSerializer'
92
+ @storefront_cart_serializer = 'Spree::V2::Storefront::CartSerializer'
93
+ @storefront_cms_page_serializer = 'Spree::V2::Storefront::CmsPageSerializer'
94
+ @storefront_credit_card_serializer = 'Spree::V2::Storefront::CreditCardSerializer'
95
+ @storefront_country_serializer = 'Spree::V2::Storefront::CountrySerializer'
96
+ @storefront_menu_serializer = 'Spree::V2::Storefront::MenuSerializer'
97
+ @storefront_user_serializer = 'Spree::V2::Storefront::UserSerializer'
98
+ @storefront_shipment_serializer = 'Spree::V2::Storefront::ShipmentSerializer'
99
+ @storefront_taxon_serializer = 'Spree::V2::Storefront::TaxonSerializer'
100
+ @storefront_payment_method_serializer = 'Spree::V2::Storefront::PaymentMethodSerializer'
101
+ @storefront_payment_serializer = 'Spree::V2::Storefront::PaymentSerializer'
102
+ @storefront_product_serializer = 'Spree::V2::Storefront::ProductSerializer'
103
+ @storefront_estimated_shipment_serializer = 'Spree::V2::Storefront::EstimatedShippingRateSerializer'
104
+ @storefront_store_serializer = 'Spree::V2::Storefront::StoreSerializer'
105
+ @storefront_order_serializer = 'Spree::V2::Storefront::OrderSerializer'
106
+
107
+ # sorters
108
+ @storefront_collection_sorter = Spree::Dependencies.collection_sorter
109
+ @storefront_order_sorter = Spree::Dependencies.collection_sorter
110
+ @storefront_products_sorter = Spree::Dependencies.products_sorter
111
+ @platform_products_sorter = Spree::Dependencies.products_sorter
112
+
113
+ # paginators
114
+ @storefront_collection_paginator = Spree::Dependencies.collection_paginator
115
+
116
+ # finders
117
+ @storefront_address_finder = Spree::Dependencies.address_finder
118
+ @storefront_country_finder = Spree::Dependencies.country_finder
119
+ @storefront_cms_page_finder = Spree::Dependencies.cms_page_finder
120
+ @storefront_menu_finder = Spree::Dependencies.menu_finder
121
+ @storefront_current_order_finder = Spree::Dependencies.current_order_finder
122
+ @storefront_completed_order_finder = Spree::Dependencies.completed_order_finder
123
+ @storefront_credit_card_finder = Spree::Dependencies.credit_card_finder
124
+ @storefront_find_by_variant_finder = Spree::Dependencies.line_item_by_variant_finder
125
+ @storefront_products_finder = Spree::Dependencies.products_finder
126
+ @storefront_taxon_finder = Spree::Dependencies.taxon_finder
127
+
128
+ @error_handler = 'Spree::Api::ErrorHandler'
129
+ end
130
+
131
+ def set_platform_defaults
132
+ # serializers
133
+ @platform_admin_user_serializer = 'Spree::Api::V2::Platform::UserSerializer'
134
+
135
+ # coupon code handler
136
+ @platform_coupon_handler = Spree::Dependencies.coupon_handler
137
+
138
+ # order services
139
+ @platform_order_recalculate_service = Spree::Dependencies.cart_recalculate_service
140
+ @platform_order_update_service = Spree::Dependencies.checkout_update_service
141
+ @platform_order_empty_service = Spree::Dependencies.cart_empty_service
142
+ @platform_order_destroy_service = Spree::Dependencies.cart_destroy_service
143
+ @platform_order_next_service = Spree::Dependencies.checkout_next_service
144
+ @platform_order_advance_service = Spree::Dependencies.checkout_advance_service
145
+ @platform_order_complete_service = Spree::Dependencies.checkout_complete_service
146
+ @platform_order_use_store_credit_service = Spree::Dependencies.checkout_add_store_credit_service
147
+ @platform_order_remove_store_credit_service = Spree::Dependencies.checkout_remove_store_credit_service
148
+ @platform_order_approve_service = Spree::Dependencies.order_approve_service
149
+ @platform_order_cancel_service = Spree::Dependencies.order_cancel_service
150
+
151
+ # line item services
152
+ @platform_line_item_create_service = Spree::Dependencies.line_item_create_service
153
+ @platform_line_item_update_service = Spree::Dependencies.line_item_update_service
154
+ @platform_line_item_destroy_service = Spree::Dependencies.line_item_destroy_service
155
+
156
+ # shipment services
157
+ @platform_shipment_create_service = Spree::Dependencies.shipment_create_service
158
+ @platform_shipment_update_service = Spree::Dependencies.shipment_update_service
159
+ @platform_shipment_change_state_service = Spree::Dependencies.shipment_change_state_service
160
+ @platform_shipment_add_item_service = Spree::Dependencies.shipment_add_item_service
161
+ @platform_shipment_remove_item_service = Spree::Dependencies.shipment_remove_item_service
162
+ end
163
+ end
164
+ end
165
+ end
@@ -1,5 +1,8 @@
1
1
  require 'rails/engine'
2
2
 
3
+ require_relative 'dependencies'
4
+ require_relative 'configuration'
5
+
3
6
  module Spree
4
7
  module Api
5
8
  class Engine < Rails::Engine
@@ -7,8 +10,8 @@ module Spree
7
10
  engine_name 'spree_api'
8
11
 
9
12
  initializer 'spree.api.environment', before: :load_config_initializers do |_app|
10
- Spree::Api::Config = Spree::ApiConfiguration.new
11
- Spree::Api::Dependencies = Spree::ApiDependencies.new
13
+ Spree::Api::Config = Spree::Api::Configuration.new
14
+ Spree::Api::Dependencies = Spree::Api::ApiDependencies.new
12
15
  end
13
16
 
14
17
  initializer 'spree.api.checking_migrations' do
@@ -16,20 +19,6 @@ module Spree
16
19
  end
17
20
 
18
21
  def self.activate
19
- [
20
- Spree::Address, Spree::Asset, Spree::CmsPage, Spree::CreditCard, Spree::CustomerReturn,
21
- Spree::DigitalLink, Spree::Digital, Spree::InventoryUnit, Spree::LineItem, Spree::MenuItem,
22
- Spree::Menu, Spree::OptionType, Spree::OptionValue, Spree::Order, Spree::PaymentCaptureEvent,
23
- Spree::Payment, Spree::Price, Spree::Product, Spree::Promotion, Spree::Property, Spree::Prototype,
24
- Spree::Refund, Spree::Reimbursement, Spree::ReturnAuthorization, Spree::ReturnItem, Spree::Role,
25
- Spree::Shipment, Spree::ShippingCategory, Spree::ShippingMethod, Spree::ShippingRate,
26
- Spree::StockItem, Spree::StockLocation, Spree::StockMovement, Spree::StockTransfer,
27
- Spree::StoreCredit, Spree::Store, Spree::TaxCategory, Spree::TaxRate, Spree::Taxonomy,
28
- Spree::Taxon, Spree::Variant, Spree::WishedItem, Spree::Wishlist, Spree::Zone
29
- ].each do |webhookable_class|
30
- webhookable_class.include(Spree::Webhooks::HasWebhooks)
31
- end
32
-
33
22
  Dir.glob(File.join(File.dirname(__FILE__), '../../../app/models/spree/api/webhooks/*_decorator*.rb')) do |c|
34
23
  Rails.application.config.cache_classes ? require(c) : load(c)
35
24
  end
@@ -38,7 +38,6 @@ shared_context 'Platform API v2' do
38
38
  )
39
39
  end
40
40
 
41
-
42
41
  let(:valid_authorization) { "Bearer #{oauth_token.token}" }
43
42
  let(:valid_read_authorization) { "Bearer #{read_oauth_token.token}" }
44
43
  let(:valid_user_authorization) { "Bearer #{user_oauth_token.token}" }
data/lib/spree/api.rb CHANGED
@@ -1,12 +1,8 @@
1
1
  require 'spree/core'
2
2
 
3
- require 'rabl'
4
- require 'responders'
5
-
6
3
  module Spree
7
4
  module Api
8
5
  end
9
6
  end
10
7
 
11
- require 'spree/api/api_dependencies'
12
8
  require 'spree/api/engine'
data/lib/spree_api.rb CHANGED
@@ -1,4 +1,3 @@
1
1
  require 'spree/api'
2
- require 'spree/api/responders'
3
2
  require 'jsonapi/serializer'
4
3
  require 'doorkeeper'
data/spree_api.gemspec CHANGED
@@ -31,7 +31,5 @@ Gem::Specification.new do |s|
31
31
  s.add_dependency 'bcrypt', '~> 3.1'
32
32
  s.add_dependency 'doorkeeper', '~> 5.3'
33
33
  s.add_dependency 'jsonapi-serializer', '~> 2.1'
34
- s.add_dependency 'rabl', '~> 0.14', '>= 0.14.2'
35
- s.add_dependency 'responders'
36
34
  s.add_dependency 'spree_core', s.version
37
35
  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.4.1
4
+ version: 4.5.0
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: 2022-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n-tasks
@@ -108,54 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2.1'
111
- - !ruby/object:Gem::Dependency
112
- name: rabl
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0.14'
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: 0.14.2
121
- type: :runtime
122
- prerelease: false
123
- version_requirements: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - "~>"
126
- - !ruby/object:Gem::Version
127
- version: '0.14'
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: 0.14.2
131
- - !ruby/object:Gem::Dependency
132
- name: responders
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- version: '0'
138
- type: :runtime
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- version: '0'
145
111
  - !ruby/object:Gem::Dependency
146
112
  name: spree_core
147
113
  requirement: !ruby/object:Gem::Requirement
148
114
  requirements:
149
115
  - - '='
150
116
  - !ruby/object:Gem::Version
151
- version: 4.4.1
117
+ version: 4.5.0
152
118
  type: :runtime
153
119
  prerelease: false
154
120
  version_requirements: !ruby/object:Gem::Requirement
155
121
  requirements:
156
122
  - - '='
157
123
  - !ruby/object:Gem::Version
158
- version: 4.4.1
124
+ version: 4.5.0
159
125
  description: Spree's API
160
126
  email:
161
127
  - ryan@spreecommerce.com
@@ -176,37 +142,6 @@ files:
176
142
  - app/controllers/concerns/spree/api/v2/product_list_includes.rb
177
143
  - app/controllers/concerns/spree/api/v2/storefront/metadata_controller_concern.rb
178
144
  - app/controllers/concerns/spree/api/v2/storefront/order_concern.rb
179
- - app/controllers/spree/api/base_controller.rb
180
- - app/controllers/spree/api/v1/addresses_controller.rb
181
- - app/controllers/spree/api/v1/checkouts_controller.rb
182
- - app/controllers/spree/api/v1/classifications_controller.rb
183
- - app/controllers/spree/api/v1/countries_controller.rb
184
- - app/controllers/spree/api/v1/credit_cards_controller.rb
185
- - app/controllers/spree/api/v1/customer_returns_controller.rb
186
- - app/controllers/spree/api/v1/images_controller.rb
187
- - app/controllers/spree/api/v1/inventory_units_controller.rb
188
- - app/controllers/spree/api/v1/line_items_controller.rb
189
- - app/controllers/spree/api/v1/option_types_controller.rb
190
- - app/controllers/spree/api/v1/option_values_controller.rb
191
- - app/controllers/spree/api/v1/orders_controller.rb
192
- - app/controllers/spree/api/v1/payments_controller.rb
193
- - app/controllers/spree/api/v1/product_properties_controller.rb
194
- - app/controllers/spree/api/v1/products_controller.rb
195
- - app/controllers/spree/api/v1/promotions_controller.rb
196
- - app/controllers/spree/api/v1/properties_controller.rb
197
- - app/controllers/spree/api/v1/reimbursements_controller.rb
198
- - app/controllers/spree/api/v1/return_authorizations_controller.rb
199
- - app/controllers/spree/api/v1/shipments_controller.rb
200
- - app/controllers/spree/api/v1/states_controller.rb
201
- - app/controllers/spree/api/v1/stock_items_controller.rb
202
- - app/controllers/spree/api/v1/stock_locations_controller.rb
203
- - app/controllers/spree/api/v1/stock_movements_controller.rb
204
- - app/controllers/spree/api/v1/stores_controller.rb
205
- - app/controllers/spree/api/v1/taxonomies_controller.rb
206
- - app/controllers/spree/api/v1/taxons_controller.rb
207
- - app/controllers/spree/api/v1/users_controller.rb
208
- - app/controllers/spree/api/v1/variants_controller.rb
209
- - app/controllers/spree/api/v1/zones_controller.rb
210
145
  - app/controllers/spree/api/v2/base_controller.rb
211
146
  - app/controllers/spree/api/v2/platform/addresses_controller.rb
212
147
  - app/controllers/spree/api/v2/platform/adjustments_controller.rb
@@ -267,9 +202,9 @@ files:
267
202
  - app/controllers/spree/api/v2/storefront/stores_controller.rb
268
203
  - app/controllers/spree/api/v2/storefront/taxons_controller.rb
269
204
  - app/controllers/spree/api/v2/storefront/wishlists_controller.rb
270
- - app/helpers/spree/api/api_helpers.rb
271
205
  - app/helpers/spree/api/v2/collection_options_helpers.rb
272
206
  - app/helpers/spree/api/v2/display_money_helper.rb
207
+ - app/helpers/spree/api/v2/store_media_serializer_images_concern.rb
273
208
  - app/jobs/spree/webhooks/subscribers/make_request_job.rb
274
209
  - app/models/concerns/spree/user_api_authentication.rb
275
210
  - app/models/concerns/spree/user_api_methods.rb
@@ -281,7 +216,6 @@ files:
281
216
  - app/models/spree/api/webhooks/stock_item_decorator.rb
282
217
  - app/models/spree/api/webhooks/stock_movement_decorator.rb
283
218
  - app/models/spree/api/webhooks/variant_decorator.rb
284
- - app/models/spree/api_configuration.rb
285
219
  - app/models/spree/oauth_access_grant.rb
286
220
  - app/models/spree/oauth_access_token.rb
287
221
  - app/models/spree/oauth_application.rb
@@ -300,6 +234,9 @@ files:
300
234
  - app/serializers/spree/api/v2/platform/calculator_serializer.rb
301
235
  - app/serializers/spree/api/v2/platform/classification_serializer.rb
302
236
  - app/serializers/spree/api/v2/platform/cms_page_serializer.rb
237
+ - app/serializers/spree/api/v2/platform/cms_section_image_one_serializer.rb
238
+ - app/serializers/spree/api/v2/platform/cms_section_image_three_serializer.rb
239
+ - app/serializers/spree/api/v2/platform/cms_section_image_two_serializer.rb
303
240
  - app/serializers/spree/api/v2/platform/cms_section_serializer.rb
304
241
  - app/serializers/spree/api/v2/platform/country_serializer.rb
305
242
  - app/serializers/spree/api/v2/platform/credit_card_serializer.rb
@@ -307,8 +244,10 @@ files:
307
244
  - app/serializers/spree/api/v2/platform/digital_link_serializer.rb
308
245
  - app/serializers/spree/api/v2/platform/digital_serializer.rb
309
246
  - app/serializers/spree/api/v2/platform/feature_page_serializer.rb
247
+ - app/serializers/spree/api/v2/platform/hero_image_serializer.rb
310
248
  - app/serializers/spree/api/v2/platform/homepage_serializer.rb
311
249
  - app/serializers/spree/api/v2/platform/icon_serializer.rb
250
+ - app/serializers/spree/api/v2/platform/image_gallery_serializer.rb
312
251
  - app/serializers/spree/api/v2/platform/image_serializer.rb
313
252
  - app/serializers/spree/api/v2/platform/inventory_unit_serializer.rb
314
253
  - app/serializers/spree/api/v2/platform/line_item_serializer.rb
@@ -345,6 +284,7 @@ files:
345
284
  - app/serializers/spree/api/v2/platform/shipping_category_serializer.rb
346
285
  - app/serializers/spree/api/v2/platform/shipping_method_serializer.rb
347
286
  - app/serializers/spree/api/v2/platform/shipping_rate_serializer.rb
287
+ - app/serializers/spree/api/v2/platform/side_by_side_image_serializer.rb
348
288
  - app/serializers/spree/api/v2/platform/standard_page_serializer.rb
349
289
  - app/serializers/spree/api/v2/platform/state_change_serializer.rb
350
290
  - app/serializers/spree/api/v2/platform/state_serializer.rb
@@ -386,6 +326,7 @@ files:
386
326
  - app/serializers/spree/v2/storefront/menu_serializer.rb
387
327
  - app/serializers/spree/v2/storefront/option_type_serializer.rb
388
328
  - app/serializers/spree/v2/storefront/option_value_serializer.rb
329
+ - app/serializers/spree/v2/storefront/order_serializer.rb
389
330
  - app/serializers/spree/v2/storefront/payment_method_serializer.rb
390
331
  - app/serializers/spree/v2/storefront/payment_serializer.rb
391
332
  - app/serializers/spree/v2/storefront/product_property_serializer.rb
@@ -412,107 +353,9 @@ files:
412
353
  - app/services/spree/webhooks/subscribers/handle_request.rb
413
354
  - app/services/spree/webhooks/subscribers/make_request.rb
414
355
  - app/services/spree/webhooks/subscribers/queue_requests.rb
415
- - app/views/spree/api/errors/gateway_error.rabl
416
- - app/views/spree/api/errors/invalid_api_key.rabl
417
- - app/views/spree/api/errors/invalid_resource.rabl
418
- - app/views/spree/api/errors/must_specify_api_key.rabl
419
- - app/views/spree/api/errors/not_found.rabl
420
- - app/views/spree/api/errors/unauthorized.rabl
421
- - app/views/spree/api/v1/addresses/show.rabl
422
- - app/views/spree/api/v1/adjustments/show.rabl
423
- - app/views/spree/api/v1/countries/index.rabl
424
- - app/views/spree/api/v1/countries/show.rabl
425
- - app/views/spree/api/v1/credit_cards/index.rabl
426
- - app/views/spree/api/v1/credit_cards/show.rabl
427
- - app/views/spree/api/v1/customer_returns/index.rabl
428
- - app/views/spree/api/v1/images/index.rabl
429
- - app/views/spree/api/v1/images/new.rabl
430
- - app/views/spree/api/v1/images/show.rabl
431
- - app/views/spree/api/v1/inventory_units/show.rabl
432
- - app/views/spree/api/v1/line_items/new.rabl
433
- - app/views/spree/api/v1/line_items/show.rabl
434
- - app/views/spree/api/v1/option_types/index.rabl
435
- - app/views/spree/api/v1/option_types/new.rabl
436
- - app/views/spree/api/v1/option_types/show.rabl
437
- - app/views/spree/api/v1/option_values/index.rabl
438
- - app/views/spree/api/v1/option_values/new.rabl
439
- - app/views/spree/api/v1/option_values/show.rabl
440
- - app/views/spree/api/v1/orders/address.rabl
441
- - app/views/spree/api/v1/orders/canceled.rabl
442
- - app/views/spree/api/v1/orders/cart.rabl
443
- - app/views/spree/api/v1/orders/complete.rabl
444
- - app/views/spree/api/v1/orders/could_not_apply_coupon.rabl
445
- - app/views/spree/api/v1/orders/could_not_transition.rabl
446
- - app/views/spree/api/v1/orders/index.rabl
447
- - app/views/spree/api/v1/orders/insufficient_quantity.rabl
448
- - app/views/spree/api/v1/orders/invalid_shipping_method.rabl
449
- - app/views/spree/api/v1/orders/mine.rabl
450
- - app/views/spree/api/v1/orders/order.rabl
451
- - app/views/spree/api/v1/orders/payment.rabl
452
- - app/views/spree/api/v1/orders/show.rabl
453
- - app/views/spree/api/v1/payments/credit_over_limit.rabl
454
- - app/views/spree/api/v1/payments/index.rabl
455
- - app/views/spree/api/v1/payments/new.rabl
456
- - app/views/spree/api/v1/payments/show.rabl
457
- - app/views/spree/api/v1/payments/update_forbidden.rabl
458
- - app/views/spree/api/v1/product_properties/index.rabl
459
- - app/views/spree/api/v1/product_properties/new.rabl
460
- - app/views/spree/api/v1/product_properties/show.rabl
461
- - app/views/spree/api/v1/products/index.rabl
462
- - app/views/spree/api/v1/products/new.rabl
463
- - app/views/spree/api/v1/products/product.rabl
464
- - app/views/spree/api/v1/products/show.rabl
465
- - app/views/spree/api/v1/promotions/handler.rabl
466
- - app/views/spree/api/v1/promotions/show.rabl
467
- - app/views/spree/api/v1/properties/index.rabl
468
- - app/views/spree/api/v1/properties/new.rabl
469
- - app/views/spree/api/v1/properties/show.rabl
470
- - app/views/spree/api/v1/reimbursements/index.rabl
471
- - app/views/spree/api/v1/return_authorizations/index.rabl
472
- - app/views/spree/api/v1/return_authorizations/new.rabl
473
- - app/views/spree/api/v1/return_authorizations/show.rabl
474
- - app/views/spree/api/v1/shared/stock_location_required.rabl
475
- - app/views/spree/api/v1/shipments/big.rabl
476
- - app/views/spree/api/v1/shipments/cannot_ready_shipment.rabl
477
- - app/views/spree/api/v1/shipments/mine.rabl
478
- - app/views/spree/api/v1/shipments/show.rabl
479
- - app/views/spree/api/v1/shipments/small.rabl
480
- - app/views/spree/api/v1/shipping_rates/show.rabl
481
- - app/views/spree/api/v1/states/index.rabl
482
- - app/views/spree/api/v1/states/show.rabl
483
- - app/views/spree/api/v1/stock_items/index.rabl
484
- - app/views/spree/api/v1/stock_items/show.rabl
485
- - app/views/spree/api/v1/stock_locations/index.rabl
486
- - app/views/spree/api/v1/stock_locations/show.rabl
487
- - app/views/spree/api/v1/stock_movements/index.rabl
488
- - app/views/spree/api/v1/stock_movements/show.rabl
489
- - app/views/spree/api/v1/stores/index.rabl
490
- - app/views/spree/api/v1/stores/show.rabl
491
- - app/views/spree/api/v1/tags/index.rabl
492
- - app/views/spree/api/v1/taxonomies/index.rabl
493
- - app/views/spree/api/v1/taxonomies/jstree.rabl
494
- - app/views/spree/api/v1/taxonomies/nested.rabl
495
- - app/views/spree/api/v1/taxonomies/new.rabl
496
- - app/views/spree/api/v1/taxonomies/show.rabl
497
- - app/views/spree/api/v1/taxons/index.rabl
498
- - app/views/spree/api/v1/taxons/jstree.rabl
499
- - app/views/spree/api/v1/taxons/new.rabl
500
- - app/views/spree/api/v1/taxons/show.rabl
501
- - app/views/spree/api/v1/taxons/taxons.rabl
502
- - app/views/spree/api/v1/users/index.rabl
503
- - app/views/spree/api/v1/users/new.rabl
504
- - app/views/spree/api/v1/users/show.rabl
505
- - app/views/spree/api/v1/variants/big.rabl
506
- - app/views/spree/api/v1/variants/index.rabl
507
- - app/views/spree/api/v1/variants/new.rabl
508
- - app/views/spree/api/v1/variants/show.rabl
509
- - app/views/spree/api/v1/variants/small.rabl
510
- - app/views/spree/api/v1/zones/index.rabl
511
- - app/views/spree/api/v1/zones/show.rabl
512
356
  - config/i18n-tasks.yml
513
357
  - config/initializers/doorkeeper.rb
514
358
  - config/initializers/json_api_mime_types.rb
515
- - config/initializers/rabl.rb
516
359
  - config/initializers/user_class_extensions.rb
517
360
  - config/locales/en.yml
518
361
  - config/routes.rb
@@ -529,21 +372,17 @@ files:
529
372
  - docs/v2/platform/index.yaml
530
373
  - docs/v2/storefront/index.yaml
531
374
  - lib/spree/api.rb
532
- - lib/spree/api/api_dependencies.rb
533
- - lib/spree/api/controller_setup.rb
375
+ - lib/spree/api/configuration.rb
376
+ - lib/spree/api/dependencies.rb
534
377
  - lib/spree/api/engine.rb
535
- - lib/spree/api/responders.rb
536
- - lib/spree/api/responders/rabl_template.rb
537
378
  - lib/spree/api/testing_support/caching.rb
538
379
  - lib/spree/api/testing_support/factories.rb
539
380
  - lib/spree/api/testing_support/factories/oauth_application_factory.rb
540
381
  - lib/spree/api/testing_support/factories/webhook_event_factory.rb
541
382
  - lib/spree/api/testing_support/factories/webhook_subscriber_factory.rb
542
- - lib/spree/api/testing_support/helpers.rb
543
383
  - lib/spree/api/testing_support/jobs.rb
544
384
  - lib/spree/api/testing_support/matchers/webhooks.rb
545
385
  - lib/spree/api/testing_support/serializers.rb
546
- - lib/spree/api/testing_support/setup.rb
547
386
  - lib/spree/api/testing_support/spree_webhooks.rb
548
387
  - lib/spree/api/testing_support/v2/base.rb
549
388
  - lib/spree/api/testing_support/v2/current_order.rb
@@ -559,9 +398,9 @@ licenses:
559
398
  - BSD-3-Clause
560
399
  metadata:
561
400
  bug_tracker_uri: https://github.com/spree/spree/issues
562
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.4.1
401
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.5.0
563
402
  documentation_uri: https://dev-docs.spreecommerce.org/
564
- source_code_uri: https://github.com/spree/spree/tree/v4.4.1
403
+ source_code_uri: https://github.com/spree/spree/tree/v4.5.0
565
404
  post_install_message:
566
405
  rdoc_options: []
567
406
  require_paths:
@@ -577,7 +416,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
577
416
  - !ruby/object:Gem::Version
578
417
  version: '0'
579
418
  requirements: []
580
- rubygems_version: 3.5.3
419
+ rubygems_version: 3.2.32
581
420
  signing_key:
582
421
  specification_version: 4
583
422
  summary: Spree's API