spree_api 4.4.0.rc2 → 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 +34 -8
  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 -23
  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 +18 -179
  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
@@ -1,3 +0,0 @@
1
- object false
2
- node(:attributes) { [*option_value_attributes] }
3
- node(:required_attributes) { required_fields_for(Spree::OptionValue) }
@@ -1,2 +0,0 @@
1
- object @option_value
2
- attributes *option_value_attributes
File without changes
File without changes
File without changes
File without changes
@@ -1,2 +0,0 @@
1
- object false
2
- node(:error) { @coupon_message }
@@ -1,3 +0,0 @@
1
- object false
2
- node(:error) { I18n.t(:could_not_transition, scope: 'spree.api.order') }
3
- node(:errors) { @order.errors.to_hash }
@@ -1,7 +0,0 @@
1
- object false
2
- child(@orders => :orders) do
3
- extends 'spree/api/v1/orders/order'
4
- end
5
- node(:count) { @orders.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @orders.total_pages }
@@ -1,2 +0,0 @@
1
- object false
2
- node(:error) { Spree.t(:insufficient_quantity, scope: [:api, :order]) }
@@ -1,2 +0,0 @@
1
- object false
2
- node(:errors) { [I18n.t(:invalid_shipping_method, scope: 'spree.api.order')] }
@@ -1,9 +0,0 @@
1
- object false
2
-
3
- child(@orders => :orders) do
4
- extends 'spree/api/v1/orders/show'
5
- end
6
-
7
- node(:count) { @orders.count }
8
- node(:current_page) { params[:page].try(:to_i) || 1 }
9
- node(:pages) { @orders.total_pages }
@@ -1,10 +0,0 @@
1
- cache [I18n.locale, root_object]
2
- attributes *order_attributes
3
- node(:display_item_total) { |o| o.display_item_total.to_s }
4
- node(:total_quantity) { |o| o.line_items.sum(:quantity) }
5
- node(:display_total) { |o| o.display_total.to_s }
6
- node(:display_ship_total, &:display_ship_total)
7
- node(:display_tax_total, &:display_tax_total)
8
- node(:display_adjustment_total, &:display_adjustment_total)
9
- node(:token, &:token)
10
- node(:checkout_steps, &:checkout_steps)
@@ -1,3 +0,0 @@
1
- child available_payment_methods: :payment_methods do
2
- attributes :id, :name, :method_type
3
- end
@@ -1,51 +0,0 @@
1
- object @order
2
- extends 'spree/api/v1/orders/order'
3
-
4
- if lookup_context.find_all("spree/api/v1/orders/#{root_object.state}").present?
5
- extends "spree/api/v1/orders/#{root_object.state}"
6
- end
7
-
8
- child billing_address: :bill_address do
9
- extends 'spree/api/v1/addresses/show'
10
- end
11
-
12
- child shipping_address: :ship_address do
13
- extends 'spree/api/v1/addresses/show'
14
- end
15
-
16
- child line_items: :line_items do
17
- extends 'spree/api/v1/line_items/show'
18
- end
19
-
20
- child payments: :payments do
21
- attributes *payment_attributes
22
-
23
- child payment_method: :payment_method do
24
- attributes :id, :name
25
- end
26
-
27
- child source: :source do
28
- if @current_user_roles.include?('admin')
29
- attributes *payment_source_attributes + [:gateway_customer_profile_id, :gateway_payment_profile_id]
30
- else
31
- attributes *payment_source_attributes
32
- end
33
- end
34
- end
35
-
36
- child shipments: :shipments do
37
- extends 'spree/api/v1/shipments/small'
38
- end
39
-
40
- child adjustments: :adjustments do
41
- extends 'spree/api/v1/adjustments/show'
42
- end
43
-
44
- # Necessary for backend's order interface
45
- node :permissions do
46
- { can_update: current_ability.can?(:update, root_object) }
47
- end
48
-
49
- child valid_credit_cards: :credit_cards do
50
- extends 'spree/api/v1/credit_cards/show'
51
- end
@@ -1,2 +0,0 @@
1
- object false
2
- node(:error) { I18n.t(:credit_over_limit, limit: @payment.credit_allowed, scope: 'spree.api.payment') }
@@ -1,7 +0,0 @@
1
- object false
2
- child(@payments => :payments) do
3
- attributes *payment_attributes
4
- end
5
- node(:count) { @payments.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @payments.total_pages }
@@ -1,5 +0,0 @@
1
- object false
2
- node(:attributes) { [*payment_attributes] }
3
- child @payment_methods => :payment_methods do
4
- attributes *payment_method_attributes
5
- end
@@ -1,2 +0,0 @@
1
- object @payment
2
- attributes *payment_attributes
@@ -1,2 +0,0 @@
1
- object false
2
- node(:error) { I18n.t(:update_forbidden, state: @payment.state, scope: 'spree.api.payment') }
@@ -1,7 +0,0 @@
1
- object false
2
- child(@product_properties => :product_properties) do
3
- attributes *product_property_attributes
4
- end
5
- node(:count) { @product_properties.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @product_properties.total_pages }
@@ -1,2 +0,0 @@
1
- node(:attributes) { [*product_property_attributes] }
2
- node(:required_attributes) { [] }
@@ -1,2 +0,0 @@
1
- object @product_property
2
- attributes *product_property_attributes
@@ -1,9 +0,0 @@
1
- object false
2
- node(:count) { @products.count }
3
- node(:total_count) { @products.total_count }
4
- node(:current_page) { params[:page] ? params[:page].to_i : 1 }
5
- node(:per_page) { params[:per_page].try(:to_i) || Kaminari.config.default_per_page }
6
- node(:pages) { @products.total_pages }
7
- child(@products => :products) do
8
- extends 'spree/api/v1/products/show'
9
- end
@@ -1,3 +0,0 @@
1
- object false
2
- node(:attributes) { [*product_attributes] }
3
- node(:required_attributes) { required_fields_for(Spree::Product) }
@@ -1 +0,0 @@
1
- attributes *product_attributes
@@ -1,36 +0,0 @@
1
- object @product
2
- cache [I18n.locale, @current_user_roles.include?('admin'), current_currency, root_object]
3
-
4
- attributes *product_attributes
5
-
6
- node(:display_price) { |p| p.display_price.to_s }
7
- node(:has_variants, &:has_variants?)
8
- node(:taxon_ids, &:taxon_ids)
9
- node(:display_current_currency_price) do |product|
10
- price = product.price_in(current_currency)
11
- Spree::Money.new(price.amount, currency: current_currency).to_s
12
- end
13
-
14
- child master: :master do
15
- extends 'spree/api/v1/variants/small'
16
- end
17
-
18
- child variants: :variants do
19
- extends 'spree/api/v1/variants/small'
20
- end
21
-
22
- child option_types: :option_types do
23
- attributes *option_type_attributes
24
- end
25
-
26
- child product_properties: :product_properties do
27
- attributes *product_property_attributes
28
- end
29
-
30
- child classifications: :classifications do
31
- attributes :taxon_id, :position
32
-
33
- child(:taxon) do
34
- extends 'spree/api/v1/taxons/show'
35
- end
36
- end
@@ -1,5 +0,0 @@
1
- object false
2
- node(:success) { @handler.success }
3
- node(:error) { @handler.error }
4
- node(:successful) { @handler.successful? }
5
- node(:status_code) { @handler.status_code }
@@ -1,2 +0,0 @@
1
- object @promotion
2
- attributes *promotion_attributes
@@ -1,7 +0,0 @@
1
- object false
2
- child(@properties => :properties) do
3
- attributes *property_attributes
4
- end
5
- node(:count) { @properties.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @properties.total_pages }
@@ -1,2 +0,0 @@
1
- node(:attributes) { [*property_attributes] }
2
- node(:required_attributes) { [] }
@@ -1,2 +0,0 @@
1
- object @property
2
- attributes *property_attributes
@@ -1,7 +0,0 @@
1
- object false
2
- child(@collection => :reimbursements) do
3
- attributes *reimbursement_attributes
4
- end
5
- node(:count) { @collection.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @collection.total_pages }
@@ -1,7 +0,0 @@
1
- object false
2
- child(@return_authorizations => :return_authorizations) do
3
- attributes *return_authorization_attributes
4
- end
5
- node(:count) { @return_authorizations.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @return_authorizations.total_pages }
@@ -1,3 +0,0 @@
1
- object false
2
- node(:attributes) { [*return_authorization_attributes] }
3
- node(:required_attributes) { required_fields_for(Spree::ReturnAuthorization) }
@@ -1,2 +0,0 @@
1
- object @return_authorization
2
- attributes *return_authorization_attributes
@@ -1,2 +0,0 @@
1
- object false
2
- node(:error) { I18n.t(:stock_location_required, scope: 'spree.api') }
@@ -1,48 +0,0 @@
1
- object @shipment
2
- cache @shipment
3
- attributes *shipment_attributes
4
-
5
- child selected_shipping_rate: :selected_shipping_rate do
6
- extends 'spree/api/v1/shipping_rates/show'
7
- end
8
-
9
- child inventory_units: :inventory_units do
10
- object @inventory_unit
11
- attributes *inventory_unit_attributes
12
-
13
- child :variant do
14
- extends 'spree/api/v1/variants/small'
15
- attributes :product_id
16
- child(images: :images) { extends 'spree/api/v1/images/show' }
17
- end
18
-
19
- child :line_item do
20
- attributes *line_item_attributes
21
- node(:single_display_amount) { |li| li.single_display_amount.to_s }
22
- node(:display_amount) { |li| li.display_amount.to_s }
23
- node(:total, &:total)
24
- end
25
- end
26
-
27
- child order: :order do
28
- extends 'spree/api/v1/orders/order'
29
-
30
- child billing_address: :bill_address do
31
- extends 'spree/api/v1/addresses/show'
32
- end
33
-
34
- child shipping_address: :ship_address do
35
- extends 'spree/api/v1/addresses/show'
36
- end
37
-
38
- child adjustments: :adjustments do
39
- extends 'spree/api/v1/adjustments/show'
40
- end
41
-
42
- child payments: :payments do
43
- attributes :id, :amount, :display_amount, :state
44
- child payment_method: :payment_method do
45
- attributes :id, :name
46
- end
47
- end
48
- end
@@ -1,2 +0,0 @@
1
- object false
2
- node(:error) { I18n.t(:cannot_ready, scope: 'spree.api.shipment') }
@@ -1,9 +0,0 @@
1
- object false
2
-
3
- node(:count) { @shipments.count }
4
- node(:current_page) { params[:page].try(:to_i) || 1 }
5
- node(:pages) { @shipments.total_pages }
6
-
7
- child(@shipments => :shipments) do
8
- extends 'spree/api/v1/shipments/big'
9
- end
@@ -1,32 +0,0 @@
1
- object @shipment
2
- cache [I18n.locale, root_object]
3
- attributes *shipment_attributes
4
- node(:order_id) { |shipment| shipment.order.number }
5
- node(:stock_location_name) { |shipment| shipment.stock_location.name }
6
-
7
- child shipping_rates: :shipping_rates do
8
- extends 'spree/api/v1/shipping_rates/show'
9
- end
10
-
11
- child selected_shipping_rate: :selected_shipping_rate do
12
- extends 'spree/api/v1/shipping_rates/show'
13
- end
14
-
15
- child shipping_methods: :shipping_methods do
16
- attributes :id, :name, :tracking_url
17
- child zones: :zones do
18
- attributes :id, :name, :description
19
- end
20
-
21
- child shipping_categories: :shipping_categories do
22
- attributes :id, :name
23
- end
24
- end
25
-
26
- child manifest: :manifest do
27
- child variant: :variant do
28
- extends 'spree/api/v1/variants/small'
29
- end
30
- node(:quantity, &:quantity)
31
- node(:states, &:states)
32
- end
@@ -1,37 +0,0 @@
1
- object @shipment
2
- cache [I18n.locale, 'small_shipment', root_object]
3
-
4
- attributes *shipment_attributes
5
- node(:order_id) { |shipment| shipment.order.number }
6
- node(:stock_location_name) { |shipment| shipment.stock_location.name }
7
-
8
- child shipping_rates: :shipping_rates do
9
- extends 'spree/api/v1/shipping_rates/show'
10
- end
11
-
12
- child selected_shipping_rate: :selected_shipping_rate do
13
- extends 'spree/api/v1/shipping_rates/show'
14
- end
15
-
16
- child shipping_methods: :shipping_methods do
17
- attributes :id, :code, :name
18
- child zones: :zones do
19
- attributes :id, :name, :description
20
- end
21
-
22
- child shipping_categories: :shipping_categories do
23
- attributes :id, :name
24
- end
25
- end
26
-
27
- child manifest: :manifest do
28
- glue(:variant) do
29
- attribute id: :variant_id
30
- end
31
- node(:quantity, &:quantity)
32
- node(:states, &:states)
33
- end
34
-
35
- child adjustments: :adjustments do
36
- extends 'spree/api/v1/adjustments/show'
37
- end
@@ -1,2 +0,0 @@
1
- attributes :id, :name, :cost, :selected, :shipping_method_id, :shipping_method_code
2
- node(:display_cost) { |sr| sr.display_cost.to_s }
@@ -1,12 +0,0 @@
1
- object false
2
- node(:states_required) { @country.states_required } if @country
3
-
4
- child(@states => :states) do
5
- attributes *state_attributes
6
- end
7
-
8
- if @states.respond_to?(:total_pages)
9
- node(:count) { @states.count }
10
- node(:current_page) { params[:page].try(:to_i) || 1 }
11
- node(:pages) { @states.total_pages }
12
- end
@@ -1,2 +0,0 @@
1
- object @state
2
- attributes *state_attributes
@@ -1,7 +0,0 @@
1
- object false
2
- child(@stock_items => :stock_items) do
3
- extends 'spree/api/v1/stock_items/show'
4
- end
5
- node(:count) { @stock_items.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @stock_items.total_pages }
@@ -1,5 +0,0 @@
1
- object @stock_item
2
- attributes *stock_item_attributes
3
- child(:variant) do
4
- extends 'spree/api/v1/variants/small'
5
- end
@@ -1,7 +0,0 @@
1
- object false
2
- child(@stock_locations => :stock_locations) do
3
- extends 'spree/api/v1/stock_locations/show'
4
- end
5
- node(:count) { @stock_locations.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @stock_locations.total_pages }
@@ -1,8 +0,0 @@
1
- object @stock_location
2
- attributes *stock_location_attributes
3
- child(:country) do |_address|
4
- attributes *country_attributes
5
- end
6
- child(:state) do |_address|
7
- attributes *state_attributes
8
- end
@@ -1,7 +0,0 @@
1
- object false
2
- child(@stock_movements => :stock_movements) do
3
- extends 'spree/api/v1/stock_movements/show'
4
- end
5
- node(:count) { @stock_movements.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @stock_movements.total_pages }
@@ -1,5 +0,0 @@
1
- object @stock_movement
2
- attributes *stock_movement_attributes
3
- child :stock_item do
4
- extends 'spree/api/v1/stock_items/show'
5
- end
@@ -1,4 +0,0 @@
1
- object false
2
- child(@stores => :stores) do
3
- attributes *store_attributes
4
- end
@@ -1,2 +0,0 @@
1
- object @store
2
- attributes *store_attributes
@@ -1,9 +0,0 @@
1
- object false
2
- node(:count) { @tags.count }
3
- node(:total_count) { @tags.total_count }
4
- node(:current_page) { params[:page] ? params[:page].to_i : 1 }
5
- node(:per_page) { params[:per_page] || Kaminari.config.default_per_page }
6
- node(:pages) { @tags.total_pages }
7
- child(@tags => :tags) do
8
- attributes :name, :id
9
- end
@@ -1,7 +0,0 @@
1
- object false
2
- child(@taxonomies => :taxonomies) do
3
- extends 'spree/api/v1/taxonomies/show'
4
- end
5
- node(:count) { @taxonomies.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @taxonomies.total_pages }
@@ -1,7 +0,0 @@
1
- object false
2
- node(:data) { @taxonomy.root.name }
3
- node(:attr) do
4
- { id: @taxonomy.root.id,
5
- name: @taxonomy.root.name }
6
- end
7
- node(:state) { 'closed' }
@@ -1,11 +0,0 @@
1
- attributes *taxonomy_attributes
2
-
3
- child root: :root do
4
- attributes *taxon_attributes
5
-
6
- child children: :taxons do
7
- attributes *taxon_attributes
8
-
9
- extends 'spree/api/v1/taxons/taxons'
10
- end
11
- end
@@ -1,3 +0,0 @@
1
- object false
2
- node(:attributes) { [*taxonomy_attributes] }
3
- node(:required_attributes) { required_fields_for(Spree::Taxonomy) }
@@ -1,15 +0,0 @@
1
- object @taxonomy
2
-
3
- if params[:set] == 'nested'
4
- extends 'spree/api/v1/taxonomies/nested'
5
- else
6
- attributes *taxonomy_attributes
7
-
8
- child root: :root do
9
- attributes *taxon_attributes
10
-
11
- child children: :taxons do
12
- attributes *taxon_attributes
13
- end
14
- end
15
- end
@@ -1,10 +0,0 @@
1
- object false
2
- node(:count) { @taxons.count }
3
- node(:total_count) { @taxons.total_count }
4
- node(:current_page) { params[:page] ? params[:page].to_i : 1 }
5
- node(:per_page) { params[:per_page].try(:to_i) || Kaminari.config.default_per_page }
6
- node(:pages) { @taxons.total_pages }
7
- child @taxons => :taxons do
8
- attributes *taxon_attributes
9
- extends 'spree/api/v1/taxons/taxons' unless params[:without_children]
10
- end
@@ -1,7 +0,0 @@
1
- collection @taxon.children, object_root: false
2
- node(:data, &:name)
3
- node(:attr) do |taxon|
4
- { id: taxon.id,
5
- name: taxon.name }
6
- end
7
- node(:state) { 'closed' }
@@ -1,3 +0,0 @@
1
- object false
2
- node(:attributes) { [*taxon_attributes] }
3
- node(:required_attributes) { required_fields_for(Spree::Taxon) }
@@ -1,6 +0,0 @@
1
- object @taxon
2
- attributes *taxon_attributes
3
-
4
- child children: :taxons do
5
- attributes *taxon_attributes
6
- end
@@ -1,5 +0,0 @@
1
- attributes *taxon_attributes
2
-
3
- node :taxons do |t|
4
- t.children.map { |c| partial('spree/api/v1/taxons/taxons', object: c) }
5
- end
@@ -1,7 +0,0 @@
1
- object false
2
- child(@users => :users) do
3
- extends 'spree/api/v1/users/show'
4
- end
5
- node(:count) { @users.count }
6
- node(:current_page) { params[:page].try(:to_i) || 1 }
7
- node(:pages) { @users.total_pages }
@@ -1,3 +0,0 @@
1
- object false
2
- node(:attributes) { [*user_attributes] }
3
- node(:required_attributes) { required_fields_for(Spree.user_class) }
@@ -1,11 +0,0 @@
1
- object @user
2
- cache [I18n.locale, root_object]
3
-
4
- attributes *user_attributes
5
- child(bill_address: :bill_address) do
6
- extends 'spree/api/v1/addresses/show'
7
- end
8
-
9
- child(ship_address: :ship_address) do
10
- extends 'spree/api/v1/addresses/show'
11
- end