spree_api 4.5.5 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/spree/api/v2/product_list_includes.rb +2 -1
- data/app/controllers/spree/api/v2/base_controller.rb +2 -0
- data/app/controllers/spree/api/v2/data_feeds/google_controller.rb +24 -0
- data/app/controllers/spree/api/v2/platform/data_feeds_controller.rb +15 -0
- data/app/controllers/spree/api/v2/resource_controller.rb +1 -1
- data/app/controllers/spree/api/v2/storefront/products_controller.rb +1 -1
- data/app/controllers/spree/api/v2/storefront/taxons_controller.rb +4 -3
- data/app/helpers/spree/api/v2/collection_options_helpers.rb +1 -1
- data/app/models/spree/webhooks/event.rb +8 -0
- data/app/models/spree/webhooks/event_signature.rb +33 -0
- data/app/models/spree/webhooks/subscriber.rb +2 -1
- data/app/serializers/spree/api/v2/platform/data_feed_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/user_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/product_serializer.rb +4 -0
- data/app/serializers/spree/v2/storefront/taxon_serializer.rb +4 -0
- data/app/serializers/spree/v2/storefront/user_serializer.rb +1 -1
- data/app/services/spree/webhooks/subscribers/handle_request.rb +5 -1
- data/app/services/spree/webhooks/subscribers/make_request.rb +3 -2
- data/brakeman.ignore +7 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20221221122100_add_secret_key_to_spree_webhooks_subscribers.rb +5 -0
- data/db/migrate/20230116204600_backfill_secret_key_for_spree_webhooks_subscribers.rb +5 -0
- data/db/migrate/20230116205000_change_secret_key_to_non_null_column.rb +5 -0
- data/docs/oauth/index.yml +5 -5
- data/docs/v2/platform/index.yaml +329 -1
- data/docs/v2/storefront/index.yaml +129 -105
- data/lib/spree/api/dependencies.rb +86 -129
- metadata +15 -7
@@ -1,165 +1,122 @@
|
|
1
1
|
module Spree
|
2
2
|
module Api
|
3
3
|
class ApiDependencies
|
4
|
-
|
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
|
4
|
+
INJECTION_POINTS_WITH_DEFAULTS = {
|
48
5
|
# cart services
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
6
|
+
storefront_cart_create_service: -> { Spree::Dependencies.cart_create_service },
|
7
|
+
storefront_cart_add_item_service: -> { Spree::Dependencies.cart_add_item_service },
|
8
|
+
storefront_cart_compare_line_items_service: -> { Spree::Dependencies.cart_compare_line_items_service },
|
9
|
+
storefront_cart_update_service: -> { Spree::Dependencies.cart_update_service },
|
10
|
+
storefront_cart_remove_line_item_service: -> { Spree::Dependencies.cart_remove_line_item_service },
|
11
|
+
storefront_cart_remove_item_service: -> { Spree::Dependencies.cart_remove_item_service },
|
12
|
+
storefront_cart_set_item_quantity_service: -> { Spree::Dependencies.cart_set_item_quantity_service },
|
13
|
+
storefront_cart_recalculate_service: -> { Spree::Dependencies.cart_recalculate_service },
|
14
|
+
storefront_cart_estimate_shipping_rates_service: -> { Spree::Dependencies.cart_estimate_shipping_rates_service },
|
15
|
+
storefront_cart_empty_service: -> { Spree::Dependencies.cart_empty_service },
|
16
|
+
storefront_cart_destroy_service: -> { Spree::Dependencies.cart_destroy_service },
|
17
|
+
storefront_cart_associate_service: -> { Spree::Dependencies.cart_associate_service },
|
18
|
+
storefront_cart_change_currency_service: -> { Spree::Dependencies.cart_change_currency_service },
|
62
19
|
|
63
20
|
# coupon code handler
|
64
|
-
|
21
|
+
storefront_coupon_handler: -> { Spree::Dependencies.coupon_handler },
|
65
22
|
|
66
23
|
# checkout services
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
24
|
+
storefront_checkout_next_service: -> { Spree::Dependencies.checkout_next_service },
|
25
|
+
storefront_checkout_advance_service: -> { Spree::Dependencies.checkout_advance_service },
|
26
|
+
storefront_checkout_update_service: -> { Spree::Dependencies.checkout_update_service },
|
27
|
+
storefront_checkout_complete_service: -> { Spree::Dependencies.checkout_complete_service },
|
28
|
+
storefront_checkout_add_store_credit_service: -> { Spree::Dependencies.checkout_add_store_credit_service },
|
29
|
+
storefront_checkout_remove_store_credit_service: -> { Spree::Dependencies.checkout_remove_store_credit_service },
|
30
|
+
storefront_checkout_get_shipping_rates_service: -> { Spree::Dependencies.checkout_get_shipping_rates_service },
|
31
|
+
storefront_checkout_select_shipping_method_service: -> { Spree::Dependencies.checkout_select_shipping_method_service },
|
75
32
|
|
76
33
|
# account services
|
77
|
-
|
78
|
-
|
34
|
+
storefront_account_create_service: -> { Spree::Dependencies.account_create_service },
|
35
|
+
storefront_account_update_service: -> { Spree::Dependencies.account_update_service },
|
79
36
|
|
80
37
|
# address services
|
81
|
-
|
82
|
-
|
38
|
+
storefront_address_create_service: -> { Spree::Dependencies.address_create_service },
|
39
|
+
storefront_address_update_service: -> { Spree::Dependencies.address_update_service },
|
83
40
|
|
84
41
|
# credit card services
|
85
|
-
|
42
|
+
storefront_credit_cards_destroy_service: -> { Spree::Dependencies.credit_cards_destroy_service },
|
86
43
|
|
87
44
|
# payment services
|
88
|
-
|
45
|
+
storefront_payment_create_service: -> { Spree::Dependencies.payment_create_service },
|
89
46
|
|
90
47
|
# serializers
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
48
|
+
storefront_address_serializer: 'Spree::V2::Storefront::AddressSerializer',
|
49
|
+
storefront_cart_serializer: 'Spree::V2::Storefront::CartSerializer',
|
50
|
+
storefront_cms_page_serializer: 'Spree::V2::Storefront::CmsPageSerializer',
|
51
|
+
storefront_credit_card_serializer: 'Spree::V2::Storefront::CreditCardSerializer',
|
52
|
+
storefront_country_serializer: 'Spree::V2::Storefront::CountrySerializer',
|
53
|
+
storefront_menu_serializer: 'Spree::V2::Storefront::MenuSerializer',
|
54
|
+
storefront_user_serializer: 'Spree::V2::Storefront::UserSerializer',
|
55
|
+
storefront_shipment_serializer: 'Spree::V2::Storefront::ShipmentSerializer',
|
56
|
+
storefront_taxon_serializer: 'Spree::V2::Storefront::TaxonSerializer',
|
57
|
+
storefront_payment_method_serializer: 'Spree::V2::Storefront::PaymentMethodSerializer',
|
58
|
+
storefront_payment_serializer: 'Spree::V2::Storefront::PaymentSerializer',
|
59
|
+
storefront_product_serializer: 'Spree::V2::Storefront::ProductSerializer',
|
60
|
+
storefront_estimated_shipment_serializer: 'Spree::V2::Storefront::EstimatedShippingRateSerializer',
|
61
|
+
storefront_store_serializer: 'Spree::V2::Storefront::StoreSerializer',
|
62
|
+
storefront_order_serializer: 'Spree::V2::Storefront::OrderSerializer',
|
106
63
|
|
107
64
|
# sorters
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
65
|
+
storefront_collection_sorter: -> { Spree::Dependencies.collection_sorter },
|
66
|
+
storefront_order_sorter: -> { Spree::Dependencies.collection_sorter },
|
67
|
+
storefront_products_sorter: -> { Spree::Dependencies.products_sorter },
|
68
|
+
platform_products_sorter: -> { Spree::Dependencies.products_sorter },
|
112
69
|
|
113
70
|
# paginators
|
114
|
-
|
71
|
+
storefront_collection_paginator: -> { Spree::Dependencies.collection_paginator },
|
115
72
|
|
116
73
|
# finders
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
def set_platform_defaults
|
74
|
+
storefront_address_finder: -> { Spree::Dependencies.address_finder },
|
75
|
+
storefront_country_finder: -> { Spree::Dependencies.country_finder },
|
76
|
+
storefront_cms_page_finder: -> { Spree::Dependencies.cms_page_finder },
|
77
|
+
storefront_menu_finder: -> { Spree::Dependencies.menu_finder },
|
78
|
+
storefront_current_order_finder: -> { Spree::Dependencies.current_order_finder },
|
79
|
+
storefront_completed_order_finder: -> { Spree::Dependencies.completed_order_finder },
|
80
|
+
storefront_credit_card_finder: -> { Spree::Dependencies.credit_card_finder },
|
81
|
+
storefront_find_by_variant_finder: -> { Spree::Dependencies.line_item_by_variant_finder },
|
82
|
+
storefront_products_finder: -> { Spree::Dependencies.products_finder },
|
83
|
+
storefront_taxon_finder: -> { Spree::Dependencies.taxon_finder },
|
84
|
+
|
85
|
+
error_handler: 'Spree::Api::ErrorHandler',
|
86
|
+
|
132
87
|
# serializers
|
133
|
-
|
88
|
+
platform_admin_user_serializer: 'Spree::Api::V2::Platform::UserSerializer',
|
134
89
|
|
135
90
|
# coupon code handler
|
136
|
-
|
91
|
+
platform_coupon_handler: -> { Spree::Dependencies.coupon_handler },
|
137
92
|
|
138
93
|
# order services
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
94
|
+
platform_order_recalculate_service: -> { Spree::Dependencies.cart_recalculate_service },
|
95
|
+
platform_order_update_service: -> { Spree::Dependencies.checkout_update_service },
|
96
|
+
platform_order_empty_service: -> { Spree::Dependencies.cart_empty_service },
|
97
|
+
platform_order_destroy_service: -> { Spree::Dependencies.cart_destroy_service },
|
98
|
+
platform_order_next_service: -> { Spree::Dependencies.checkout_next_service },
|
99
|
+
platform_order_advance_service: -> { Spree::Dependencies.checkout_advance_service },
|
100
|
+
platform_order_complete_service: -> { Spree::Dependencies.checkout_complete_service },
|
101
|
+
platform_order_use_store_credit_service: -> { Spree::Dependencies.checkout_add_store_credit_service },
|
102
|
+
platform_order_remove_store_credit_service: -> { Spree::Dependencies.checkout_remove_store_credit_service },
|
103
|
+
platform_order_approve_service: -> { Spree::Dependencies.order_approve_service },
|
104
|
+
platform_order_cancel_service: -> { Spree::Dependencies.order_cancel_service },
|
150
105
|
|
151
106
|
# line item services
|
152
|
-
|
153
|
-
|
154
|
-
|
107
|
+
platform_line_item_create_service: -> { Spree::Dependencies.line_item_create_service },
|
108
|
+
platform_line_item_update_service: -> { Spree::Dependencies.line_item_update_service },
|
109
|
+
platform_line_item_destroy_service: -> { Spree::Dependencies.line_item_destroy_service },
|
155
110
|
|
156
111
|
# shipment services
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
112
|
+
platform_shipment_create_service: -> { Spree::Dependencies.shipment_create_service },
|
113
|
+
platform_shipment_update_service: -> { Spree::Dependencies.shipment_update_service },
|
114
|
+
platform_shipment_change_state_service: -> { Spree::Dependencies.shipment_change_state_service },
|
115
|
+
platform_shipment_add_item_service: -> { Spree::Dependencies.shipment_add_item_service },
|
116
|
+
platform_shipment_remove_item_service: -> { Spree::Dependencies.shipment_remove_item_service },
|
117
|
+
}
|
118
|
+
|
119
|
+
include Spree::DependenciesHelper
|
163
120
|
end
|
164
121
|
end
|
165
122
|
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
|
+
version: 4.6.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:
|
11
|
+
date: 2023-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n-tasks
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 4.
|
117
|
+
version: 4.6.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 4.
|
124
|
+
version: 4.6.0
|
125
125
|
description: Spree's API
|
126
126
|
email:
|
127
127
|
- ryan@spreecommerce.com
|
@@ -143,12 +143,14 @@ files:
|
|
143
143
|
- app/controllers/concerns/spree/api/v2/storefront/metadata_controller_concern.rb
|
144
144
|
- app/controllers/concerns/spree/api/v2/storefront/order_concern.rb
|
145
145
|
- app/controllers/spree/api/v2/base_controller.rb
|
146
|
+
- app/controllers/spree/api/v2/data_feeds/google_controller.rb
|
146
147
|
- app/controllers/spree/api/v2/platform/addresses_controller.rb
|
147
148
|
- app/controllers/spree/api/v2/platform/adjustments_controller.rb
|
148
149
|
- app/controllers/spree/api/v2/platform/classifications_controller.rb
|
149
150
|
- app/controllers/spree/api/v2/platform/cms_pages_controller.rb
|
150
151
|
- app/controllers/spree/api/v2/platform/cms_sections_controller.rb
|
151
152
|
- app/controllers/spree/api/v2/platform/countries_controller.rb
|
153
|
+
- app/controllers/spree/api/v2/platform/data_feeds_controller.rb
|
152
154
|
- app/controllers/spree/api/v2/platform/digital_links_controller.rb
|
153
155
|
- app/controllers/spree/api/v2/platform/digitals_controller.rb
|
154
156
|
- app/controllers/spree/api/v2/platform/line_items_controller.rb
|
@@ -221,6 +223,7 @@ files:
|
|
221
223
|
- app/models/spree/oauth_application.rb
|
222
224
|
- app/models/spree/webhooks/base.rb
|
223
225
|
- app/models/spree/webhooks/event.rb
|
226
|
+
- app/models/spree/webhooks/event_signature.rb
|
224
227
|
- app/models/spree/webhooks/subscriber.rb
|
225
228
|
- app/presenters/spree/api/products/filters_presenter.rb
|
226
229
|
- app/serializers/concerns/spree/api/v2/image_transformation_concern.rb
|
@@ -241,6 +244,7 @@ files:
|
|
241
244
|
- app/serializers/spree/api/v2/platform/country_serializer.rb
|
242
245
|
- app/serializers/spree/api/v2/platform/credit_card_serializer.rb
|
243
246
|
- app/serializers/spree/api/v2/platform/customer_return_serializer.rb
|
247
|
+
- app/serializers/spree/api/v2/platform/data_feed_serializer.rb
|
244
248
|
- app/serializers/spree/api/v2/platform/digital_link_serializer.rb
|
245
249
|
- app/serializers/spree/api/v2/platform/digital_serializer.rb
|
246
250
|
- app/serializers/spree/api/v2/platform/feature_page_serializer.rb
|
@@ -353,6 +357,7 @@ files:
|
|
353
357
|
- app/services/spree/webhooks/subscribers/handle_request.rb
|
354
358
|
- app/services/spree/webhooks/subscribers/make_request.rb
|
355
359
|
- app/services/spree/webhooks/subscribers/queue_requests.rb
|
360
|
+
- brakeman.ignore
|
356
361
|
- config/i18n-tasks.yml
|
357
362
|
- config/initializers/doorkeeper.rb
|
358
363
|
- config/initializers/json_api_mime_types.rb
|
@@ -368,6 +373,9 @@ files:
|
|
368
373
|
- db/migrate/20210902162826_create_spree_webhooks_tables.rb
|
369
374
|
- db/migrate/20210919183228_enable_polymorphic_resource_owner.rb
|
370
375
|
- db/migrate/20211025162826_create_spree_webhooks_events.rb
|
376
|
+
- db/migrate/20221221122100_add_secret_key_to_spree_webhooks_subscribers.rb
|
377
|
+
- db/migrate/20230116204600_backfill_secret_key_for_spree_webhooks_subscribers.rb
|
378
|
+
- db/migrate/20230116205000_change_secret_key_to_non_null_column.rb
|
371
379
|
- docs/oauth/index.yml
|
372
380
|
- docs/v2/platform/index.yaml
|
373
381
|
- docs/v2/storefront/index.yaml
|
@@ -398,9 +406,9 @@ licenses:
|
|
398
406
|
- BSD-3-Clause
|
399
407
|
metadata:
|
400
408
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
401
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v4.
|
409
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v4.6.0
|
402
410
|
documentation_uri: https://dev-docs.spreecommerce.org/
|
403
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.
|
411
|
+
source_code_uri: https://github.com/spree/spree/tree/v4.6.0
|
404
412
|
post_install_message:
|
405
413
|
rdoc_options: []
|
406
414
|
require_paths:
|
@@ -416,7 +424,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
416
424
|
- !ruby/object:Gem::Version
|
417
425
|
version: '0'
|
418
426
|
requirements: []
|
419
|
-
rubygems_version: 3.
|
427
|
+
rubygems_version: 3.4.1
|
420
428
|
signing_key:
|
421
429
|
specification_version: 4
|
422
430
|
summary: Spree's API
|