spree_api 6.0.0.rc7 → 6.0.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.
- checksums.yaml +4 -4
- data/app/controllers/concerns/spree/api/v3/admin/maintenance_tasks_switch.rb +35 -0
- data/app/controllers/spree/api/v3/admin/invitation_acceptances_controller.rb +8 -4
- data/app/controllers/spree/api/v3/admin/maintenance_task_runs/cancellations_controller.rb +42 -0
- data/app/controllers/spree/api/v3/admin/maintenance_task_runs_controller.rb +92 -0
- data/app/controllers/spree/api/v3/admin/sellers_controller.rb +1 -1
- data/app/controllers/spree/api/v3/admin/store_controller.rb +23 -7
- data/app/controllers/spree/api/v3/admin/upgrade_steps_controller.rb +114 -0
- data/app/controllers/spree/api/v3/seller/invitation_acceptances_controller.rb +15 -5
- data/app/controllers/spree/api/v3/store/customers_controller.rb +1 -0
- data/app/controllers/spree/api/v3/store/store_controller.rb +25 -0
- data/app/serializers/spree/api/v3/address_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/address_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/category_serializer.rb +1 -3
- data/app/serializers/spree/api/v3/admin/claim_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/collection_serializer.rb +1 -4
- data/app/serializers/spree/api/v3/admin/company_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/credit_card_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/customer_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/delivery_method_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/fulfillment_serializer.rb +1 -0
- data/app/serializers/spree/api/v3/admin/gift_card_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/invitation_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/line_item_serializer.rb +1 -0
- data/app/serializers/spree/api/v3/admin/maintenance_task_run_serializer.rb +72 -0
- data/app/serializers/spree/api/v3/admin/media_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/newsletter_subscriber_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/option_type_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/option_value_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/order_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/payment_method_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/payment_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/admin/payment_source_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/product_serializer.rb +1 -3
- data/app/serializers/spree/api/v3/admin/return_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/seller_payout_serializer.rb +2 -1
- data/app/serializers/spree/api/v3/admin/seller_serializer.rb +4 -0
- data/app/serializers/spree/api/v3/admin/store_credit_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/admin/store_serializer.rb +3 -4
- data/app/serializers/spree/api/v3/admin/variant_serializer.rb +1 -3
- data/app/serializers/spree/api/v3/base_serializer.rb +28 -0
- data/app/serializers/spree/api/v3/category_serializer.rb +1 -4
- data/app/serializers/spree/api/v3/claim_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/collection_serializer.rb +1 -4
- data/app/serializers/spree/api/v3/company_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/credit_card_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/customer_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/delivery_method_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/fulfillment_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/gift_card_serializer.rb +1 -0
- data/app/serializers/spree/api/v3/line_item_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/media_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/newsletter_subscriber_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/option_type_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/option_value_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/order_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/payment_method_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/payment_serializer.rb +3 -1
- data/app/serializers/spree/api/v3/payment_source_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/product_serializer.rb +1 -4
- data/app/serializers/spree/api/v3/return_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/seller/invitation_serializer.rb +22 -1
- data/app/serializers/spree/api/v3/seller/profile_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/seller_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/store_credit_serializer.rb +2 -0
- data/app/serializers/spree/api/v3/store_serializer.rb +16 -0
- data/app/serializers/spree/api/v3/variant_serializer.rb +1 -4
- data/app/services/spree/api/v3/request_schema.rb +15 -7
- data/config/routes.rb +14 -2
- data/lib/spree/api/dependencies.rb +2 -1
- data/lib/spree/api/enum_types.rb +2 -1
- data/lib/typelizer/open_enums.rb +21 -2
- metadata +13 -6
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Admin
|
|
5
|
+
# Admin API serializer for {Spree::MaintenanceTaskRun} — the progress
|
|
6
|
+
# the dashboard polls while a task runs, and the audit trail it shows
|
|
7
|
+
# afterwards (docs/plans/6.0-maintenance-tasks.md).
|
|
8
|
+
#
|
|
9
|
+
# Admin-only by design: there is no store counterpart, because nothing
|
|
10
|
+
# about operator-run data work is customer-facing.
|
|
11
|
+
class MaintenanceTaskRunSerializer < BaseSerializer
|
|
12
|
+
typelize task_name: :string,
|
|
13
|
+
status: [:string, enum: Spree::MaintenanceTaskRun.statuses, enum_type_name: 'MaintenanceTaskRunStatus'],
|
|
14
|
+
dry_run: :boolean,
|
|
15
|
+
initiated_via: :string,
|
|
16
|
+
tick_count: :number,
|
|
17
|
+
tick_total: [:number, nullable: true],
|
|
18
|
+
duration: [:number, nullable: true],
|
|
19
|
+
tallies: 'Record<string, number>',
|
|
20
|
+
arguments: 'Record<string, unknown>',
|
|
21
|
+
error_class: [:string, nullable: true],
|
|
22
|
+
error_message: [:string, nullable: true],
|
|
23
|
+
error_backtrace: [:string, nullable: true],
|
|
24
|
+
active: :boolean,
|
|
25
|
+
admin_user_id: [:string, nullable: true],
|
|
26
|
+
started_at: [:string, nullable: true],
|
|
27
|
+
ended_at: [:string, nullable: true]
|
|
28
|
+
|
|
29
|
+
attributes :status, :dry_run, :initiated_via,
|
|
30
|
+
:tick_count, :tick_total, :error_class, :error_message,
|
|
31
|
+
:started_at, :ended_at, :created_at, :updated_at
|
|
32
|
+
|
|
33
|
+
# The task's short name, as `GET /upgrade_steps` gives it.
|
|
34
|
+
attribute :task_name, &:task_api_type
|
|
35
|
+
|
|
36
|
+
# to_f before rounding: the column is a decimal, and a BigDecimal
|
|
37
|
+
# serializes as a quoted string — a client reading `duration` wants a
|
|
38
|
+
# number, and the schema says it gets one.
|
|
39
|
+
attribute :duration do |run|
|
|
40
|
+
run.duration&.to_f&.round(3)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
attribute :tallies do |run|
|
|
44
|
+
run.tallies || {}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
attribute :arguments do |run|
|
|
48
|
+
run.arguments || {}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# The failure detail an operator needs to fix the cause. Held back
|
|
52
|
+
# from read-only callers — a backtrace names internal paths and
|
|
53
|
+
# class names that a read scope has no business seeing.
|
|
54
|
+
attribute :error_backtrace do |run|
|
|
55
|
+
run.error_backtrace if params[:show_backtrace]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
attribute :active, &:active?
|
|
59
|
+
|
|
60
|
+
attribute :admin_user_id do |run|
|
|
61
|
+
run.admin_user&.prefixed_id
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Who fired it. Pass `expand=admin_user` for the record itself.
|
|
65
|
+
one :admin_user,
|
|
66
|
+
resource: proc { Spree.api.admin_admin_user_serializer },
|
|
67
|
+
if: proc { expand?('admin_user') }
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -25,6 +25,8 @@ module Spree
|
|
|
25
25
|
attribute(:logo_url) { |payment_method| payment_method.class.logo_url }
|
|
26
26
|
attribute(:docs_url) { |payment_method| payment_method.class.docs_url }
|
|
27
27
|
attribute(:third_party) { |payment_method| payment_method.class.third_party? }
|
|
28
|
+
|
|
29
|
+
expandable_custom_fields admin: true
|
|
28
30
|
end
|
|
29
31
|
end
|
|
30
32
|
end
|
|
@@ -45,7 +45,7 @@ module Spree
|
|
|
45
45
|
Spree.api.admin_payment_source_serializer
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
serializer.new(payment.source).to_h
|
|
48
|
+
serializer.new(payment.source, params: nested_params('source')).to_h
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
many :capture_events,
|
|
@@ -65,6 +65,8 @@ module Spree
|
|
|
65
65
|
many :payment_splits,
|
|
66
66
|
resource: proc { Spree.api.admin_payment_split_serializer },
|
|
67
67
|
if: proc { expand?('payment_splits') }
|
|
68
|
+
|
|
69
|
+
expandable_custom_fields admin: true
|
|
68
70
|
end
|
|
69
71
|
end
|
|
70
72
|
end
|
|
@@ -108,9 +108,7 @@ module Spree
|
|
|
108
108
|
resource: proc { Spree.api.admin_collection_serializer },
|
|
109
109
|
if: proc { expand?('collections') }
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
resource: proc { Spree.api.admin_custom_field_serializer },
|
|
113
|
-
if: proc { expand?('custom_fields') }
|
|
111
|
+
expandable_custom_fields admin: true
|
|
114
112
|
|
|
115
113
|
many :product_publications,
|
|
116
114
|
resource: proc { Spree.api.admin_product_publication_serializer },
|
|
@@ -17,7 +17,8 @@ module Spree
|
|
|
17
17
|
reference: 'string | null',
|
|
18
18
|
period_start: 'string | null',
|
|
19
19
|
period_end: 'string | null',
|
|
20
|
-
transfers_count: :number
|
|
20
|
+
transfers_count: :number,
|
|
21
|
+
metadata: 'Record<string, unknown>'
|
|
21
22
|
|
|
22
23
|
attributes :status, :currency, :reference, :metadata,
|
|
23
24
|
period_start: :iso8601, period_end: :iso8601,
|
|
@@ -6,6 +6,8 @@ module Spree
|
|
|
6
6
|
# shopper also gets, plus the operational state and the settlement and
|
|
7
7
|
# tax configuration only the operator sets.
|
|
8
8
|
class SellerSerializer < V3::SellerSerializer
|
|
9
|
+
include Concerns::ExternalReferencesAttribute
|
|
10
|
+
|
|
9
11
|
typelize status: [:string, enum: Spree::Seller.statuses, enum_type_name: 'SellerStatus'],
|
|
10
12
|
legal_name: [:string, nullable: true],
|
|
11
13
|
registration_number: [:string, nullable: true],
|
|
@@ -75,6 +77,8 @@ module Spree
|
|
|
75
77
|
one :returns_address,
|
|
76
78
|
resource: proc { Spree.api.admin_address_serializer },
|
|
77
79
|
if: proc { |seller| seller.returns_address.present? }
|
|
80
|
+
|
|
81
|
+
expandable_custom_fields admin: true
|
|
78
82
|
end
|
|
79
83
|
end
|
|
80
84
|
end
|
|
@@ -2,10 +2,10 @@ module Spree
|
|
|
2
2
|
module Api
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
|
-
class StoreSerializer < V3::
|
|
6
|
-
typelize
|
|
5
|
+
class StoreSerializer < V3::StoreSerializer
|
|
6
|
+
typelize url: :string, code: :string, api_url: :string,
|
|
7
7
|
default_currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'], default_locale: [:string, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'],
|
|
8
|
-
default_country_code: [:string, nullable: true],
|
|
8
|
+
default_country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
|
|
9
9
|
supported_currencies: [:string, multi: true, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
10
10
|
supported_locales: [:string, multi: true, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'],
|
|
11
11
|
available_locales: [:string, multi: true, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'],
|
|
@@ -20,7 +20,6 @@ module Spree
|
|
|
20
20
|
metadata: 'Record<string, unknown>'
|
|
21
21
|
|
|
22
22
|
attributes :metadata,
|
|
23
|
-
:name,
|
|
24
23
|
:code,
|
|
25
24
|
:default_currency,
|
|
26
25
|
:default_locale,
|
|
@@ -112,9 +112,7 @@ module Spree
|
|
|
112
112
|
resource: proc { Spree.api.admin_price_serializer },
|
|
113
113
|
if: proc { expand?('prices') }
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
resource: proc { Spree.api.admin_custom_field_serializer },
|
|
117
|
-
if: proc { expand?('custom_fields') }
|
|
115
|
+
expandable_custom_fields admin: true
|
|
118
116
|
|
|
119
117
|
many :stock_levels,
|
|
120
118
|
resource: proc { Spree.api.admin_stock_level_serializer },
|
|
@@ -152,6 +152,12 @@ module Spree
|
|
|
152
152
|
}.freeze
|
|
153
153
|
private_constant :PREFERENCE_LIST_NAMES
|
|
154
154
|
|
|
155
|
+
# Settings declared with a code format share the code list request
|
|
156
|
+
# bodies take, so a value read back is the type a write takes.
|
|
157
|
+
FORMAT_CODE_LISTS = { 'iso-country' => :country, 'currency' => :currency, 'locale' => :locale,
|
|
158
|
+
'timezone' => :time_zone }.freeze
|
|
159
|
+
private_constant :FORMAT_CODE_LISTS
|
|
160
|
+
|
|
155
161
|
def self.preference_type_hint(schema, name)
|
|
156
162
|
types = Array(schema['type'])
|
|
157
163
|
options = {}
|
|
@@ -165,6 +171,9 @@ module Spree
|
|
|
165
171
|
if schema['enum']
|
|
166
172
|
options[:enum] = schema['enum'].compact
|
|
167
173
|
options[:enum_type_name] = PREFERENCE_LIST_NAMES[name.to_sym] if PREFERENCE_LIST_NAMES.key?(name.to_sym)
|
|
174
|
+
elsif (code_list = FORMAT_CODE_LISTS[(schema['items'] || schema)['format']])
|
|
175
|
+
options[:enum_type_name], values = Spree::Api::V3::RequestSchema::CODE_LISTS.fetch(code_list)
|
|
176
|
+
options[:enum] = values.call
|
|
168
177
|
end
|
|
169
178
|
options.empty? ? hint : [hint, options]
|
|
170
179
|
end
|
|
@@ -192,6 +201,25 @@ module Spree
|
|
|
192
201
|
end
|
|
193
202
|
end
|
|
194
203
|
|
|
204
|
+
# Declares the opt-in `custom_fields` expand. The Store API sends only
|
|
205
|
+
# values whose definition is storefront visible; Admin API serializers
|
|
206
|
+
# pass `admin: true` to send every value.
|
|
207
|
+
#
|
|
208
|
+
# @param admin [Boolean] whether to send every value rather than only storefront visible ones
|
|
209
|
+
# @return [void]
|
|
210
|
+
def self.expandable_custom_fields(admin: false)
|
|
211
|
+
if admin
|
|
212
|
+
many :custom_fields,
|
|
213
|
+
resource: proc { Spree.api.admin_custom_field_serializer },
|
|
214
|
+
if: proc { expand?('custom_fields') }
|
|
215
|
+
else
|
|
216
|
+
many :storefront_custom_fields,
|
|
217
|
+
key: :custom_fields,
|
|
218
|
+
resource: proc { Spree.api.custom_field_serializer },
|
|
219
|
+
if: proc { expand?('custom_fields') }
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
195
223
|
# Plain decimal notation. BigDecimal renders 0.06 as "0.6e-1", which
|
|
196
224
|
# is what a client would otherwise print beside a unit.
|
|
197
225
|
#
|
|
@@ -50,10 +50,7 @@ module Spree
|
|
|
50
50
|
resource: proc { Spree.api.category_serializer },
|
|
51
51
|
if: proc { expand?('ancestors') }
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
key: :custom_fields,
|
|
55
|
-
resource: proc { Spree.api.custom_field_serializer },
|
|
56
|
-
if: proc { expand?('custom_fields') }
|
|
53
|
+
expandable_custom_fields
|
|
57
54
|
end
|
|
58
55
|
end
|
|
59
56
|
end
|
|
@@ -29,10 +29,7 @@ module Spree
|
|
|
29
29
|
image_url_for(collection.square_image)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
key: :custom_fields,
|
|
34
|
-
resource: proc { Spree.api.custom_field_serializer },
|
|
35
|
-
if: proc { expand?('custom_fields') }
|
|
32
|
+
expandable_custom_fields
|
|
36
33
|
end
|
|
37
34
|
end
|
|
38
35
|
end
|
|
@@ -59,6 +59,8 @@ module Spree
|
|
|
59
59
|
one :stock_location, resource: proc { Spree.api.stock_location_serializer }
|
|
60
60
|
many :delivery_rates, resource: proc { Spree.api.delivery_rate_serializer }
|
|
61
61
|
many :tax_lines, resource: proc { Spree.api.tax_line_serializer }, if: proc { expand?('tax_lines') }
|
|
62
|
+
|
|
63
|
+
expandable_custom_fields
|
|
62
64
|
end
|
|
63
65
|
end
|
|
64
66
|
end
|
|
@@ -73,6 +73,8 @@ module Spree
|
|
|
73
73
|
# exactly-one-adjustable rule makes the nested view complete, and the
|
|
74
74
|
# owner already carries the tax totals.
|
|
75
75
|
many :tax_lines, resource: proc { Spree.api.tax_line_serializer }, if: proc { expand?('tax_lines') }
|
|
76
|
+
|
|
77
|
+
expandable_custom_fields
|
|
76
78
|
end
|
|
77
79
|
end
|
|
78
80
|
end
|
|
@@ -79,6 +79,8 @@ module Spree
|
|
|
79
79
|
one :shipping_address, resource: proc { Spree.api.address_serializer }
|
|
80
80
|
one :gift_card, resource: proc { Spree.api.gift_card_serializer }
|
|
81
81
|
one :market, resource: proc { Spree.api.market_serializer }
|
|
82
|
+
|
|
83
|
+
expandable_custom_fields
|
|
82
84
|
end
|
|
83
85
|
end
|
|
84
86
|
end
|
|
@@ -42,10 +42,12 @@ module Spree
|
|
|
42
42
|
Spree.api.payment_source_serializer
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
serializer.new(payment.source).to_h
|
|
45
|
+
serializer.new(payment.source, params: nested_params('source')).to_h
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
one :payment_method, resource: proc { Spree.api.payment_method_serializer }
|
|
49
|
+
|
|
50
|
+
expandable_custom_fields
|
|
49
51
|
end
|
|
50
52
|
end
|
|
51
53
|
end
|
|
@@ -137,10 +137,7 @@ module Spree
|
|
|
137
137
|
resource: proc { Spree.api.category_serializer },
|
|
138
138
|
if: proc { expand?('categories') }
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
key: :custom_fields,
|
|
142
|
-
resource: proc { Spree.api.custom_field_serializer },
|
|
143
|
-
if: proc { expand?('custom_fields') }
|
|
140
|
+
expandable_custom_fields
|
|
144
141
|
|
|
145
142
|
typelize prior_price: ['PriceHistory', nullable: true],
|
|
146
143
|
seller_id: [:string, nullable: true]
|
|
@@ -5,12 +5,33 @@ module Spree
|
|
|
5
5
|
class InvitationSerializer < V3::BaseSerializer
|
|
6
6
|
typelize email: :string, status: [:string, enum: Spree::Invitation.statuses, enum_type_name: 'InvitationStatus'],
|
|
7
7
|
expires_at: [:string, nullable: true],
|
|
8
|
-
accepted_at: [:string, nullable: true]
|
|
8
|
+
accepted_at: [:string, nullable: true],
|
|
9
|
+
inviter_email: :string,
|
|
10
|
+
invitee_exists: [:boolean, optional: true],
|
|
11
|
+
seller: '{ id: string; name: string }'
|
|
9
12
|
|
|
10
13
|
attributes :email,
|
|
11
14
|
created_at: :iso8601, expires_at: :iso8601, accepted_at: :iso8601
|
|
12
15
|
|
|
13
16
|
attributes status: :string
|
|
17
|
+
|
|
18
|
+
attribute :inviter_email do |invitation|
|
|
19
|
+
invitation.inviter.email
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Drives the acceptance page's sign-in vs sign-up branch, so only the
|
|
23
|
+
# public lookup carries it: whoever holds the emailed link already
|
|
24
|
+
# knows the address. A seller's team screen does not get to learn
|
|
25
|
+
# which addresses hold accounts elsewhere on the marketplace.
|
|
26
|
+
attribute :invitee_exists, if: proc { params[:acceptance] } do |invitation|
|
|
27
|
+
invitation.invitee_account.present?
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# The smallest shape the acceptance page's title ("Join <seller>")
|
|
31
|
+
# needs; the page is public, so nothing more of the seller goes out.
|
|
32
|
+
attribute :seller do |invitation|
|
|
33
|
+
{ id: invitation.resource.prefixed_id, name: invitation.resource.name }
|
|
34
|
+
end
|
|
14
35
|
end
|
|
15
36
|
end
|
|
16
37
|
end
|
|
@@ -17,7 +17,7 @@ module Spree
|
|
|
17
17
|
products_count: :number,
|
|
18
18
|
default_currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
19
19
|
supported_currencies: [:string, multi: true, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
20
|
-
timezone: [:string, nullable: true]
|
|
20
|
+
timezone: [:string, nullable: true, enum: Spree::TimeZones::SUGGESTED, enum_type_name: 'TimeZone']
|
|
21
21
|
|
|
22
22
|
attributes :timezone,
|
|
23
23
|
:status, :legal_name, :registration_number,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# The current store's public identity and default SEO metadata, in the
|
|
5
|
+
# request's locale. Missing translations fall back to the store's default
|
|
6
|
+
# locale.
|
|
7
|
+
class StoreSerializer < BaseSerializer
|
|
8
|
+
typelize name: :string,
|
|
9
|
+
seo_title: [:string, nullable: true],
|
|
10
|
+
meta_description: [:string, nullable: true]
|
|
11
|
+
|
|
12
|
+
attributes :name, :seo_title, :meta_description
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -127,10 +127,7 @@ module Spree
|
|
|
127
127
|
|
|
128
128
|
many :option_values, resource: proc { Spree.api.option_value_serializer }
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
key: :custom_fields,
|
|
132
|
-
resource: proc { Spree.api.custom_field_serializer },
|
|
133
|
-
if: proc { expand?('custom_fields') }
|
|
130
|
+
expandable_custom_fields
|
|
134
131
|
|
|
135
132
|
typelize prior_price: ['PriceHistory', nullable: true]
|
|
136
133
|
|