solidus_api 4.6.2 → 4.7.0
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/Rakefile +8 -8
- data/app/controllers/spree/api/addresses_controller.rb +4 -3
- data/app/controllers/spree/api/base_controller.rb +9 -9
- data/app/controllers/spree/api/checkouts_controller.rb +6 -6
- data/app/controllers/spree/api/countries_controller.rb +5 -5
- data/app/controllers/spree/api/coupon_codes_controller.rb +4 -4
- data/app/controllers/spree/api/customer_returns_controller.rb +11 -11
- data/app/controllers/spree/api/inventory_units_controller.rb +4 -4
- data/app/controllers/spree/api/line_items_controller.rb +7 -7
- data/app/controllers/spree/api/option_types_controller.rb +3 -3
- data/app/controllers/spree/api/option_values_controller.rb +6 -6
- data/app/controllers/spree/api/orders_controller.rb +11 -11
- data/app/controllers/spree/api/payments_controller.rb +1 -1
- data/app/controllers/spree/api/product_properties_controller.rb +6 -6
- data/app/controllers/spree/api/products_controller.rb +11 -11
- data/app/controllers/spree/api/return_authorizations_controller.rb +5 -5
- data/app/controllers/spree/api/shipments_controller.rb +11 -11
- data/app/controllers/spree/api/states_controller.rb +2 -2
- data/app/controllers/spree/api/stock_items_controller.rb +3 -3
- data/app/controllers/spree/api/stock_locations_controller.rb +5 -5
- data/app/controllers/spree/api/taxonomies_controller.rb +9 -9
- data/app/controllers/spree/api/taxons_controller.rb +6 -6
- data/app/controllers/spree/api/variants_controller.rb +4 -4
- data/app/controllers/spree/api/zones_controller.rb +5 -5
- data/app/views/spree/api/addresses/_address.json.jbuilder +3 -3
- data/app/views/spree/api/adjustments/_adjustment.json.jbuilder +1 -1
- data/app/views/spree/api/countries/index.json.jbuilder +2 -2
- data/app/views/spree/api/countries/show.json.jbuilder +2 -2
- data/app/views/spree/api/credit_cards/_credit_card.json.jbuilder +1 -1
- data/app/views/spree/api/credit_cards/index.json.jbuilder +1 -1
- data/app/views/spree/api/customer_returns/index.json.jbuilder +2 -2
- data/app/views/spree/api/customer_returns/show.json.jbuilder +1 -1
- data/app/views/spree/api/errors/invalid_api_key.json.jbuilder +1 -1
- data/app/views/spree/api/images/_image.json.jbuilder +2 -2
- data/app/views/spree/api/inventory_units/show.json.jbuilder +1 -1
- data/app/views/spree/api/line_items/_line_item.json.jbuilder +2 -2
- data/app/views/spree/api/option_types/_option_type.json.jbuilder +2 -2
- data/app/views/spree/api/option_values/_option_value.json.jbuilder +1 -1
- data/app/views/spree/api/orders/_big.json.jbuilder +3 -3
- data/app/views/spree/api/orders/_order.json.jbuilder +1 -1
- data/app/views/spree/api/orders/index.json.jbuilder +1 -1
- data/app/views/spree/api/orders/mine.json.jbuilder +1 -1
- data/app/views/spree/api/payments/credit_over_limit.json.jbuilder +1 -1
- data/app/views/spree/api/payments/index.json.jbuilder +2 -2
- data/app/views/spree/api/payments/new.json.jbuilder +1 -1
- data/app/views/spree/api/payments/show.json.jbuilder +1 -1
- data/app/views/spree/api/payments/source_views/_gateway.json.jbuilder +1 -1
- data/app/views/spree/api/payments/source_views/_store_credit.json.jbuilder +1 -1
- data/app/views/spree/api/payments/update_forbidden.json.jbuilder +1 -1
- data/app/views/spree/api/product_properties/index.json.jbuilder +2 -2
- data/app/views/spree/api/product_properties/show.json.jbuilder +1 -1
- data/app/views/spree/api/products/_product.json.jbuilder +5 -5
- data/app/views/spree/api/products/index.json.jbuilder +1 -1
- data/app/views/spree/api/promotions/show.json.jbuilder +1 -1
- data/app/views/spree/api/properties/index.json.jbuilder +2 -2
- data/app/views/spree/api/properties/show.json.jbuilder +1 -1
- data/app/views/spree/api/return_authorizations/index.json.jbuilder +2 -2
- data/app/views/spree/api/return_authorizations/show.json.jbuilder +1 -1
- data/app/views/spree/api/shared/_pagination.json.jbuilder +4 -4
- data/app/views/spree/api/shipments/_big.json.jbuilder +7 -7
- data/app/views/spree/api/shipments/_small.json.jbuilder +4 -4
- data/app/views/spree/api/shipments/estimated_rates.json.jbuilder +1 -1
- data/app/views/spree/api/shipments/mine.json.jbuilder +1 -1
- data/app/views/spree/api/shipments/show.json.jbuilder +4 -4
- data/app/views/spree/api/shipping_rates/_shipping_rate.json.jbuilder +1 -1
- data/app/views/spree/api/states/index.json.jbuilder +2 -2
- data/app/views/spree/api/states/show.json.jbuilder +1 -1
- data/app/views/spree/api/stock_items/_stock_item.json.jbuilder +1 -1
- data/app/views/spree/api/stock_items/index.json.jbuilder +1 -1
- data/app/views/spree/api/stock_locations/_stock_location.json.jbuilder +3 -3
- data/app/views/spree/api/stock_locations/index.json.jbuilder +1 -1
- data/app/views/spree/api/stock_movements/_stock_movement.json.jbuilder +1 -1
- data/app/views/spree/api/stock_movements/index.json.jbuilder +1 -1
- data/app/views/spree/api/store_credit_events/mine.json.jbuilder +2 -2
- data/app/views/spree/api/stores/index.json.jbuilder +1 -1
- data/app/views/spree/api/stores/show.json.jbuilder +1 -1
- data/app/views/spree/api/taxonomies/_nested.json.jbuilder +3 -3
- data/app/views/spree/api/taxonomies/_taxonomy.json.jbuilder +3 -3
- data/app/views/spree/api/taxonomies/index.json.jbuilder +1 -1
- data/app/views/spree/api/taxons/_taxon.json.jbuilder +2 -2
- data/app/views/spree/api/taxons/_taxons.json.jbuilder +1 -1
- data/app/views/spree/api/taxons/index.json.jbuilder +2 -2
- data/app/views/spree/api/users/_user.json.jbuilder +1 -1
- data/app/views/spree/api/users/index.json.jbuilder +1 -1
- data/app/views/spree/api/variants/_big.json.jbuilder +3 -3
- data/app/views/spree/api/variants/_small.json.jbuilder +2 -2
- data/app/views/spree/api/variants/index.json.jbuilder +1 -1
- data/app/views/spree/api/zones/_zone.json.jbuilder +2 -2
- data/app/views/spree/api/zones/index.json.jbuilder +1 -1
- data/config/routes.rb +9 -9
- data/lib/solidus_api.rb +1 -1
- data/lib/spree/api/config.rb +1 -1
- data/lib/spree/api/engine.rb +4 -4
- data/lib/spree/api/responders.rb +2 -2
- data/lib/spree/api/testing_support/helpers.rb +3 -3
- data/lib/spree/api/testing_support/setup.rb +1 -1
- data/lib/spree/api.rb +2 -2
- data/lib/spree/api_configuration.rb +8 -8
- data/lib/spree_api.rb +3 -3
- data/solidus_api.gemspec +16 -16
- metadata +9 -6
|
@@ -43,18 +43,18 @@ module Spree
|
|
|
43
43
|
private
|
|
44
44
|
|
|
45
45
|
def taxonomies
|
|
46
|
-
@taxonomies = Taxonomy
|
|
47
|
-
accessible_by(current_ability)
|
|
48
|
-
order(
|
|
49
|
-
includes(root: :children)
|
|
50
|
-
ransack(params[:q])
|
|
51
|
-
result
|
|
46
|
+
@taxonomies = Taxonomy
|
|
47
|
+
.accessible_by(current_ability)
|
|
48
|
+
.order("name")
|
|
49
|
+
.includes(root: :children)
|
|
50
|
+
.ransack(params[:q])
|
|
51
|
+
.result
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def taxonomy
|
|
55
|
-
@taxonomy ||= Spree::Taxonomy.accessible_by(current_ability, :show)
|
|
56
|
-
includes(root: :children)
|
|
57
|
-
find(params[:id])
|
|
55
|
+
@taxonomy ||= Spree::Taxonomy.accessible_by(current_ability, :show)
|
|
56
|
+
.includes(root: :children)
|
|
57
|
+
.find(params[:id])
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def taxonomy_params
|
|
@@ -4,12 +4,12 @@ module Spree
|
|
|
4
4
|
module Api
|
|
5
5
|
class TaxonsController < Spree::Api::BaseController
|
|
6
6
|
def index
|
|
7
|
-
if taxonomy
|
|
8
|
-
|
|
7
|
+
@taxons = if taxonomy
|
|
8
|
+
taxonomy.root.children
|
|
9
9
|
elsif params[:ids]
|
|
10
|
-
|
|
10
|
+
Spree::Taxon.accessible_by(current_ability).where(id: params[:ids].split(","))
|
|
11
11
|
else
|
|
12
|
-
|
|
12
|
+
Spree::Taxon.accessible_by(current_ability).order(:taxonomy_id, :lft).ransack(params[:q]).result
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
unless params[:without_children]
|
|
@@ -36,7 +36,7 @@ module Spree
|
|
|
36
36
|
taxonomy = Spree::Taxonomy.find_by(id: params[:taxonomy_id])
|
|
37
37
|
|
|
38
38
|
if taxonomy.nil?
|
|
39
|
-
@taxon.errors.add(:taxonomy_id, I18n.t(
|
|
39
|
+
@taxon.errors.add(:taxonomy_id, I18n.t("spree.api.invalid_taxonomy_id"))
|
|
40
40
|
invalid_resource!(@taxon) && return
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -78,7 +78,7 @@ module Spree
|
|
|
78
78
|
product_properties: true,
|
|
79
79
|
classifications: true
|
|
80
80
|
}
|
|
81
|
-
@product_attributes = %i
|
|
81
|
+
@product_attributes = %i[id name display_price]
|
|
82
82
|
end
|
|
83
83
|
render "spree/api/products/index"
|
|
84
84
|
end
|
|
@@ -63,10 +63,10 @@ module Spree
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def scope
|
|
66
|
-
if @product
|
|
67
|
-
|
|
66
|
+
variants = if @product
|
|
67
|
+
@product.variants_including_master
|
|
68
68
|
else
|
|
69
|
-
|
|
69
|
+
Spree::Variant
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
if current_ability.can?(:manage, Variant) && params[:show_deleted]
|
|
@@ -89,7 +89,7 @@ module Spree
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def include_list
|
|
92
|
-
[{
|
|
92
|
+
[{option_values: :option_type}, :product, :prices, :images, {stock_items: :stock_location}]
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
end
|
|
@@ -20,11 +20,11 @@ module Spree
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def index
|
|
23
|
-
@zones = Spree::Zone
|
|
24
|
-
accessible_by(current_ability)
|
|
25
|
-
order(
|
|
26
|
-
ransack(params[:q])
|
|
27
|
-
result
|
|
23
|
+
@zones = Spree::Zone
|
|
24
|
+
.accessible_by(current_ability)
|
|
25
|
+
.order("name ASC")
|
|
26
|
+
.ransack(params[:q])
|
|
27
|
+
.result
|
|
28
28
|
|
|
29
29
|
@zones = paginate(@zones)
|
|
30
30
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.cache! address do
|
|
4
|
-
json.(address, *address_attributes)
|
|
4
|
+
json.call(address, *address_attributes)
|
|
5
5
|
json.country do
|
|
6
6
|
if address.country
|
|
7
|
-
json.(address.country, *country_attributes)
|
|
7
|
+
json.call(address.country, *country_attributes)
|
|
8
8
|
else
|
|
9
9
|
json.nil!
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
json.state do
|
|
13
13
|
if address.state
|
|
14
|
-
json.(address.state, *state_attributes)
|
|
14
|
+
json.call(address.state, *state_attributes)
|
|
15
15
|
else
|
|
16
16
|
json.nil!
|
|
17
17
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.countries(@countries) { |country| json.(country, *country_attributes) }
|
|
4
|
-
json.partial!
|
|
3
|
+
json.countries(@countries) { |country| json.call(country, *country_attributes) }
|
|
4
|
+
json.partial! "spree/api/shared/pagination", pagination: @countries
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.cache! [I18n.locale, credit_card] do
|
|
4
|
-
json.(credit_card, *creditcard_attributes)
|
|
4
|
+
json.call(credit_card, *creditcard_attributes)
|
|
5
5
|
json.address do
|
|
6
6
|
if credit_card.address
|
|
7
7
|
json.partial!("spree/api/addresses/address", address: credit_card.address)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.customer_returns(@customer_returns) do |customer_return|
|
|
4
|
-
json.(customer_return, *customer_return_attributes)
|
|
4
|
+
json.call(customer_return, *customer_return_attributes)
|
|
5
5
|
end
|
|
6
|
-
json.partial!
|
|
6
|
+
json.partial! "spree/api/shared/pagination", pagination: @customer_returns
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.(image, *image_attributes)
|
|
4
|
-
json.(image, :viewable_type, :viewable_id)
|
|
3
|
+
json.call(image, *image_attributes)
|
|
4
|
+
json.call(image, :viewable_type, :viewable_id)
|
|
5
5
|
|
|
6
6
|
Spree::Image.attachment_definitions[:attachment][:styles].each_key do |key|
|
|
7
7
|
json.set! "#{key}_url", image.url(key)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.cache! [I18n.locale, line_item] do
|
|
4
|
-
json.(line_item, *line_item_attributes)
|
|
4
|
+
json.call(line_item, *line_item_attributes)
|
|
5
5
|
json.single_display_amount(line_item.single_display_amount.to_s)
|
|
6
6
|
json.display_amount(line_item.display_amount.to_s)
|
|
7
7
|
json.total(line_item.total)
|
|
8
8
|
json.variant do
|
|
9
9
|
json.partial!("spree/api/variants/small", variant: line_item.variant)
|
|
10
|
-
json.(line_item.variant, :product_id)
|
|
10
|
+
json.call(line_item.variant, :product_id)
|
|
11
11
|
json.images(line_item.variant.gallery.images) do |image|
|
|
12
12
|
json.partial!("spree/api/images/image", image:)
|
|
13
13
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.(option_type, *option_type_attributes)
|
|
3
|
+
json.call(option_type, *option_type_attributes)
|
|
4
4
|
json.option_values(option_type.option_values) do |option_value|
|
|
5
|
-
json.(option_value, *option_value_attributes)
|
|
5
|
+
json.call(option_value, *option_value_attributes)
|
|
6
6
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
json.partial!("spree/api/orders/order", order:)
|
|
4
4
|
json.payment_methods(order.available_payment_methods) do |payment_method|
|
|
5
|
-
json.(payment_method, :id, :name, :partial_name)
|
|
5
|
+
json.call(payment_method, :id, :name, :partial_name)
|
|
6
6
|
json.method_type payment_method.partial_name
|
|
7
7
|
end
|
|
8
8
|
json.bill_address do
|
|
@@ -23,8 +23,8 @@ json.line_items(order.line_items) do |line_item|
|
|
|
23
23
|
json.partial!("spree/api/line_items/line_item", line_item:)
|
|
24
24
|
end
|
|
25
25
|
json.payments(order.payments) do |payment|
|
|
26
|
-
json.(payment, *payment_attributes)
|
|
27
|
-
json.payment_method { json.(payment.payment_method, :id, :name) }
|
|
26
|
+
json.call(payment, *payment_attributes)
|
|
27
|
+
json.payment_method { json.call(payment.payment_method, :id, :name) }
|
|
28
28
|
json.source do
|
|
29
29
|
##
|
|
30
30
|
# payment.source could be a Spree::Payment. If it is then we need to call
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.cache! [I18n.locale, order] do
|
|
4
|
-
json.(order, *order_attributes)
|
|
4
|
+
json.call(order, *order_attributes)
|
|
5
5
|
json.display_item_total(order.display_item_total.to_s)
|
|
6
6
|
json.total_quantity(order.line_items.to_a.sum(&:quantity))
|
|
7
7
|
json.display_total(order.display_total.to_s)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.payments(@payments) { |payment| json.(payment, *payment_attributes) }
|
|
4
|
-
json.partial!
|
|
3
|
+
json.payments(@payments) { |payment| json.call(payment, *payment_attributes) }
|
|
4
|
+
json.partial! "spree/api/shared/pagination", pagination: @payments
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.product_properties(@product_properties) do |product_property|
|
|
4
|
-
json.(product_property, *product_property_attributes)
|
|
4
|
+
json.call(product_property, *product_property_attributes)
|
|
5
5
|
end
|
|
6
|
-
json.partial!
|
|
6
|
+
json.partial! "spree/api/shared/pagination", pagination: @product_properties
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
@product_attributes ||= product_attributes
|
|
4
|
-
json.cache! [I18n.locale, current_user_roles.include?(
|
|
5
|
-
json.(product, *(@product_attributes - [:total_on_hand]))
|
|
4
|
+
json.cache! [I18n.locale, current_user_roles.include?("admin"), current_pricing_options, @product_attributes, @exclude_data, product] do
|
|
5
|
+
json.call(product, *(@product_attributes - [:total_on_hand]))
|
|
6
6
|
json.total_on_hand(total_on_hand_for(product))
|
|
7
7
|
json.price(product.price_for_options(current_pricing_options)&.amount)
|
|
8
8
|
json.display_price(product.price_for_options(current_pricing_options)&.money&.to_s)
|
|
@@ -19,17 +19,17 @@ json.cache! [I18n.locale, current_user_roles.include?('admin'), current_pricing_
|
|
|
19
19
|
end
|
|
20
20
|
unless @exclude_data[:option_types]
|
|
21
21
|
json.option_types(product.option_types) do |option_type|
|
|
22
|
-
json.(option_type, *option_type_attributes)
|
|
22
|
+
json.call(option_type, *option_type_attributes)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
unless @exclude_data[:product_properties]
|
|
26
26
|
json.product_properties(product.product_properties) do |product_property|
|
|
27
|
-
json.(product_property, *product_property_attributes)
|
|
27
|
+
json.call(product_property, *product_property_attributes)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
unless @exclude_data[:classifications]
|
|
31
31
|
json.classifications(product.classifications) do |classification|
|
|
32
|
-
json.(classification, :taxon_id, :position)
|
|
32
|
+
json.call(classification, :taxon_id, :position)
|
|
33
33
|
json.taxon do
|
|
34
34
|
json.partial!("spree/api/taxons/taxon", taxon: classification.taxon)
|
|
35
35
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.partial!
|
|
3
|
+
json.partial! "spree/api/shared/pagination", pagination: @products
|
|
4
4
|
json.products(@products) do |product|
|
|
5
5
|
json.partial!("spree/api/products/product", product:)
|
|
6
6
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.properties(@properties) do |property|
|
|
4
|
-
json.(property, *property_attributes)
|
|
4
|
+
json.call(property, *property_attributes)
|
|
5
5
|
end
|
|
6
|
-
json.partial!
|
|
6
|
+
json.partial! "spree/api/shared/pagination", pagination: @properties
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.return_authorizations(@return_authorizations) do |return_authorization|
|
|
4
|
-
json.(return_authorization, *return_authorization_attributes)
|
|
4
|
+
json.call(return_authorization, *return_authorization_attributes)
|
|
5
5
|
end
|
|
6
|
-
json.partial!
|
|
6
|
+
json.partial! "spree/api/shared/pagination", pagination: @return_authorizations
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.count
|
|
4
|
-
json.total_count
|
|
3
|
+
json.count pagination.count
|
|
4
|
+
json.total_count pagination.total_count
|
|
5
5
|
json.current_page pagination.current_page
|
|
6
|
-
json.pages
|
|
7
|
-
json.per_page
|
|
6
|
+
json.pages pagination.total_pages
|
|
7
|
+
json.per_page pagination.limit_value
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.cache! [I18n.locale, shipment] do
|
|
4
|
-
json.(shipment, *shipment_attributes)
|
|
4
|
+
json.call(shipment, *shipment_attributes)
|
|
5
5
|
json.partial!("spree/api/shipments/small", shipment:)
|
|
6
6
|
json.inventory_units(shipment.inventory_units) do |inventory_unit|
|
|
7
|
-
json.(inventory_unit, *inventory_unit_attributes)
|
|
7
|
+
json.call(inventory_unit, *inventory_unit_attributes)
|
|
8
8
|
json.variant do
|
|
9
9
|
json.partial!("spree/api/variants/small", variant: inventory_unit.variant)
|
|
10
|
-
json.(inventory_unit.variant, :product_id)
|
|
10
|
+
json.call(inventory_unit.variant, :product_id)
|
|
11
11
|
json.images(inventory_unit.variant.gallery.images) do |image|
|
|
12
12
|
json.partial!("spree/api/images/image", image:)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
json.line_item do
|
|
16
|
-
json.(inventory_unit.line_item, *line_item_attributes)
|
|
16
|
+
json.call(inventory_unit.line_item, *line_item_attributes)
|
|
17
17
|
json.single_display_amount(inventory_unit.line_item.single_display_amount.to_s)
|
|
18
18
|
json.display_amount(inventory_unit.line_item.display_amount.to_s)
|
|
19
19
|
json.total(inventory_unit.line_item.total)
|
|
@@ -32,15 +32,15 @@ json.cache! [I18n.locale, shipment] do
|
|
|
32
32
|
json.partial!("spree/api/addresses/address", address: shipment.order.shipping_address)
|
|
33
33
|
end
|
|
34
34
|
json.payments(shipment.order.payments) do |payment|
|
|
35
|
-
json.(payment, :id, :amount, :display_amount, :state)
|
|
35
|
+
json.call(payment, :id, :amount, :display_amount, :state)
|
|
36
36
|
if payment.source
|
|
37
37
|
json.source do
|
|
38
38
|
attrs = [:id]
|
|
39
39
|
(attrs << :cc_type) if payment.source.respond_to?(:cc_type)
|
|
40
|
-
json.(payment.source, *attrs)
|
|
40
|
+
json.call(payment.source, *attrs)
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
|
-
json.payment_method { json.(payment.payment_method, :id, :name) }
|
|
43
|
+
json.payment_method { json.call(payment.payment_method, :id, :name) }
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.cache! [I18n.locale, shipment] do
|
|
4
|
-
json.(shipment, *shipment_attributes)
|
|
4
|
+
json.call(shipment, *shipment_attributes)
|
|
5
5
|
json.order_id(shipment.order.number)
|
|
6
6
|
json.stock_location_name(shipment.stock_location.name)
|
|
7
7
|
json.shipping_rates(shipment.shipping_rates) do |shipping_rate|
|
|
@@ -15,12 +15,12 @@ json.cache! [I18n.locale, shipment] do
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
json.shipping_methods(shipment.shipping_methods) do |shipping_method|
|
|
18
|
-
json.(shipping_method, :id, :code, :name)
|
|
18
|
+
json.call(shipping_method, :id, :code, :name)
|
|
19
19
|
json.zones(shipping_method.zones) do |zone|
|
|
20
|
-
json.(zone, :id, :name, :description)
|
|
20
|
+
json.call(zone, :id, :name, :description)
|
|
21
21
|
end
|
|
22
22
|
json.shipping_categories(shipping_method.shipping_categories) do |shipping_category|
|
|
23
|
-
json.(shipping_category, :id, :name)
|
|
23
|
+
json.call(shipping_category, :id, :name)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
json.manifest(shipment.manifest) do |manifest_item|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.shipping_rates @shipping_rates do |shipping_rate|
|
|
4
|
-
json.(shipping_rate, :name, :cost, :shipping_method_id, :shipping_method_code)
|
|
4
|
+
json.call(shipping_rate, :name, :cost, :shipping_method_id, :shipping_method_code)
|
|
5
5
|
json.display_cost(shipping_rate.display_cost.to_s)
|
|
6
6
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.partial!
|
|
3
|
+
json.partial! "spree/api/shared/pagination", pagination: @shipments
|
|
4
4
|
json.shipments(@shipments) do |shipment|
|
|
5
5
|
json.partial!("spree/api/shipments/big", shipment:)
|
|
6
6
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.cache! [I18n.locale, @shipment] do
|
|
4
|
-
json.(@shipment, *shipment_attributes)
|
|
4
|
+
json.call(@shipment, *shipment_attributes)
|
|
5
5
|
json.order_id(@shipment.order.number)
|
|
6
6
|
json.stock_location_name(@shipment.stock_location.name)
|
|
7
7
|
json.shipping_rates(@shipment.shipping_rates) do |shipping_rate|
|
|
@@ -15,12 +15,12 @@ json.cache! [I18n.locale, @shipment] do
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
json.shipping_methods(@shipment.shipping_methods) do |shipping_method|
|
|
18
|
-
json.(shipping_method, :id, :name)
|
|
18
|
+
json.call(shipping_method, :id, :name)
|
|
19
19
|
json.zones(shipping_method.zones) do |zone|
|
|
20
|
-
json.(zone, :id, :name, :description)
|
|
20
|
+
json.call(zone, :id, :name, :description)
|
|
21
21
|
end
|
|
22
22
|
json.shipping_categories(shipping_method.shipping_categories) do |shipping_category|
|
|
23
|
-
json.(shipping_category, :id, :name)
|
|
23
|
+
json.call(shipping_category, :id, :name)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
json.manifest(@shipment.manifest) do |manifest_item|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.(shipping_rate, :id, :name, :cost, :selected, :shipping_method_id, :shipping_method_code)
|
|
3
|
+
json.call(shipping_rate, :id, :name, :cost, :selected, :shipping_method_id, :shipping_method_code)
|
|
4
4
|
json.display_cost(shipping_rate.display_cost.to_s)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
json.states_required(@country.states_required) if @country
|
|
4
|
-
json.states(@states) { |state| json.(state, *state_attributes) }
|
|
4
|
+
json.states(@states) { |state| json.call(state, *state_attributes) }
|
|
5
5
|
if @states.respond_to?(:total_pages)
|
|
6
|
-
json.partial!
|
|
6
|
+
json.partial! "spree/api/shared/pagination", pagination: @states
|
|
7
7
|
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
json.(stock_location, *stock_location_attributes)
|
|
3
|
+
json.call(stock_location, *stock_location_attributes)
|
|
4
4
|
json.country do
|
|
5
5
|
if stock_location.country
|
|
6
|
-
json.(stock_location.country, *country_attributes)
|
|
6
|
+
json.call(stock_location.country, *country_attributes)
|
|
7
7
|
else
|
|
8
8
|
json.nil!
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
json.state do
|
|
12
12
|
if stock_location.state
|
|
13
|
-
json.(stock_location.state, *state_attributes)
|
|
13
|
+
json.call(stock_location.state, *state_attributes)
|
|
14
14
|
else
|
|
15
15
|
json.nil!
|
|
16
16
|
end
|