solidus_api 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_api might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +5 -0
- data/LICENSE +27 -0
- data/Rakefile +16 -0
- data/app/controllers/spree/api/addresses_controller.rb +43 -0
- data/app/controllers/spree/api/base_controller.rb +189 -0
- data/app/controllers/spree/api/checkouts_controller.rb +133 -0
- data/app/controllers/spree/api/classifications_controller.rb +18 -0
- data/app/controllers/spree/api/config_controller.rb +6 -0
- data/app/controllers/spree/api/countries_controller.rb +23 -0
- data/app/controllers/spree/api/credit_cards_controller.rb +25 -0
- data/app/controllers/spree/api/images_controller.rb +47 -0
- data/app/controllers/spree/api/inventory_units_controller.rb +52 -0
- data/app/controllers/spree/api/line_items_controller.rb +74 -0
- data/app/controllers/spree/api/option_types_controller.rb +49 -0
- data/app/controllers/spree/api/option_values_controller.rb +58 -0
- data/app/controllers/spree/api/orders_controller.rb +155 -0
- data/app/controllers/spree/api/payments_controller.rb +81 -0
- data/app/controllers/spree/api/product_properties_controller.rb +72 -0
- data/app/controllers/spree/api/products_controller.rb +129 -0
- data/app/controllers/spree/api/promotions_controller.rb +26 -0
- data/app/controllers/spree/api/properties_controller.rb +71 -0
- data/app/controllers/spree/api/return_authorizations_controller.rb +71 -0
- data/app/controllers/spree/api/shipments_controller.rb +172 -0
- data/app/controllers/spree/api/states_controller.rb +35 -0
- data/app/controllers/spree/api/stock_items_controller.rb +84 -0
- data/app/controllers/spree/api/stock_locations_controller.rb +50 -0
- data/app/controllers/spree/api/stock_movements_controller.rb +42 -0
- data/app/controllers/spree/api/stock_transfers_controller.rb +19 -0
- data/app/controllers/spree/api/store_credit_events_controller.rb +9 -0
- data/app/controllers/spree/api/stores_controller.rb +55 -0
- data/app/controllers/spree/api/taxonomies_controller.rb +64 -0
- data/app/controllers/spree/api/taxons_controller.rb +93 -0
- data/app/controllers/spree/api/transfer_items_controller.rb +42 -0
- data/app/controllers/spree/api/users_controller.rb +56 -0
- data/app/controllers/spree/api/variants_controller.rb +75 -0
- data/app/controllers/spree/api/zones_controller.rb +50 -0
- data/app/helpers/spree/api/api_helpers.rb +190 -0
- data/app/models/spree/api_configuration.rb +5 -0
- data/app/models/spree/option_value_decorator.rb +9 -0
- data/app/views/spree/api/addresses/show.v1.rabl +10 -0
- data/app/views/spree/api/adjustments/show.v1.rabl +4 -0
- data/app/views/spree/api/config/money.v1.rabl +2 -0
- data/app/views/spree/api/config/show.v1.rabl +2 -0
- data/app/views/spree/api/countries/index.v1.rabl +7 -0
- data/app/views/spree/api/countries/show.v1.rabl +5 -0
- data/app/views/spree/api/credit_cards/index.v1.rabl +7 -0
- data/app/views/spree/api/credit_cards/show.v1.rabl +3 -0
- data/app/views/spree/api/errors/gateway_error.v1.rabl +2 -0
- data/app/views/spree/api/errors/invalid_api_key.v1.rabl +2 -0
- data/app/views/spree/api/errors/invalid_resource.v1.rabl +3 -0
- data/app/views/spree/api/errors/must_specify_api_key.v1.rabl +2 -0
- data/app/views/spree/api/errors/not_found.v1.rabl +2 -0
- data/app/views/spree/api/errors/unauthorized.v1.rabl +2 -0
- data/app/views/spree/api/errors/variant_not_in_stock_transfer.v1.rabl +2 -0
- data/app/views/spree/api/images/index.v1.rabl +4 -0
- data/app/views/spree/api/images/show.v1.rabl +6 -0
- data/app/views/spree/api/inventory_units/show.rabl +2 -0
- data/app/views/spree/api/line_items/new.v1.rabl +3 -0
- data/app/views/spree/api/line_items/show.v1.rabl +15 -0
- data/app/views/spree/api/option_types/index.v1.rabl +3 -0
- data/app/views/spree/api/option_types/show.v1.rabl +5 -0
- data/app/views/spree/api/option_values/index.v1.rabl +3 -0
- data/app/views/spree/api/option_values/show.v1.rabl +2 -0
- data/app/views/spree/api/orders/address.v1.rabl +0 -0
- data/app/views/spree/api/orders/canceled.v1.rabl +0 -0
- data/app/views/spree/api/orders/cart.v1.rabl +0 -0
- data/app/views/spree/api/orders/complete.v1.rabl +0 -0
- data/app/views/spree/api/orders/could_not_apply_coupon.v1.rabl +2 -0
- data/app/views/spree/api/orders/could_not_transition.v1.rabl +3 -0
- data/app/views/spree/api/orders/expected_total_mismatch.v1.rabl +2 -0
- data/app/views/spree/api/orders/index.v1.rabl +7 -0
- data/app/views/spree/api/orders/invalid_shipping_method.v1.rabl +2 -0
- data/app/views/spree/api/orders/mine.v1.rabl +9 -0
- data/app/views/spree/api/orders/order.v1.rabl +9 -0
- data/app/views/spree/api/orders/payment.v1.rabl +3 -0
- data/app/views/spree/api/orders/show.v1.rabl +52 -0
- data/app/views/spree/api/payments/credit_over_limit.v1.rabl +2 -0
- data/app/views/spree/api/payments/index.v1.rabl +7 -0
- data/app/views/spree/api/payments/new.v1.rabl +5 -0
- data/app/views/spree/api/payments/show.v1.rabl +2 -0
- data/app/views/spree/api/payments/update_forbidden.v1.rabl +2 -0
- data/app/views/spree/api/product_properties/index.v1.rabl +7 -0
- data/app/views/spree/api/product_properties/new.v1.rabl +2 -0
- data/app/views/spree/api/product_properties/show.v1.rabl +2 -0
- data/app/views/spree/api/products/index.v1.rabl +9 -0
- data/app/views/spree/api/products/new.v1.rabl +3 -0
- data/app/views/spree/api/products/product.v1.rabl +1 -0
- data/app/views/spree/api/products/show.v1.rabl +31 -0
- data/app/views/spree/api/promotions/handler.v1.rabl +5 -0
- data/app/views/spree/api/promotions/show.v1.rabl +2 -0
- data/app/views/spree/api/properties/index.v1.rabl +7 -0
- data/app/views/spree/api/properties/new.v1.rabl +2 -0
- data/app/views/spree/api/properties/show.v1.rabl +2 -0
- data/app/views/spree/api/return_authorizations/index.v1.rabl +7 -0
- data/app/views/spree/api/return_authorizations/new.v1.rabl +3 -0
- data/app/views/spree/api/return_authorizations/show.v1.rabl +2 -0
- data/app/views/spree/api/shared/stock_location_required.v1.rabl +2 -0
- data/app/views/spree/api/shipments/big.v1.rabl +48 -0
- data/app/views/spree/api/shipments/cannot_ready_shipment.v1.rabl +2 -0
- data/app/views/spree/api/shipments/mine.v1.rabl +9 -0
- data/app/views/spree/api/shipments/show.v1.rabl +32 -0
- data/app/views/spree/api/shipments/small.v1.rabl +37 -0
- data/app/views/spree/api/shipping_rates/show.v1.rabl +2 -0
- data/app/views/spree/api/states/index.v1.rabl +14 -0
- data/app/views/spree/api/states/show.v1.rabl +2 -0
- data/app/views/spree/api/stock_items/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_items/show.v1.rabl +5 -0
- data/app/views/spree/api/stock_locations/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_locations/show.v1.rabl +8 -0
- data/app/views/spree/api/stock_movements/index.v1.rabl +7 -0
- data/app/views/spree/api/stock_movements/show.v1.rabl +5 -0
- data/app/views/spree/api/stock_transfers/receive.v1.rabl +5 -0
- data/app/views/spree/api/store_credit_events/mine.v1.rabl +10 -0
- data/app/views/spree/api/stores/index.v1.rabl +4 -0
- data/app/views/spree/api/stores/show.v1.rabl +2 -0
- data/app/views/spree/api/taxonomies/index.v1.rabl +7 -0
- data/app/views/spree/api/taxonomies/jstree.rabl +8 -0
- data/app/views/spree/api/taxonomies/nested.v1.rabl +11 -0
- data/app/views/spree/api/taxonomies/new.v1.rabl +3 -0
- data/app/views/spree/api/taxonomies/show.v1.rabl +15 -0
- data/app/views/spree/api/taxons/index.v1.rabl +12 -0
- data/app/views/spree/api/taxons/jstree.rabl +8 -0
- data/app/views/spree/api/taxons/new.v1.rabl +3 -0
- data/app/views/spree/api/taxons/show.v1.rabl +6 -0
- data/app/views/spree/api/taxons/taxons.v1.rabl +5 -0
- data/app/views/spree/api/transfer_items/show.v1.rabl +6 -0
- data/app/views/spree/api/users/index.v1.rabl +7 -0
- data/app/views/spree/api/users/new.v1.rabl +3 -0
- data/app/views/spree/api/users/show.v1.rabl +10 -0
- data/app/views/spree/api/variants/big.v1.rabl +17 -0
- data/app/views/spree/api/variants/index.v1.rabl +9 -0
- data/app/views/spree/api/variants/new.v1.rabl +2 -0
- data/app/views/spree/api/variants/show.v1.rabl +3 -0
- data/app/views/spree/api/variants/small.v1.rabl +17 -0
- data/app/views/spree/api/zones/index.v1.rabl +7 -0
- data/app/views/spree/api/zones/show.v1.rabl +6 -0
- data/config/initializers/metal_load_paths.rb +1 -0
- data/config/locales/en.yml +29 -0
- data/config/routes.rb +139 -0
- data/db/migrate/20100107141738_add_api_key_to_spree_users.rb +7 -0
- data/db/migrate/20120411123334_resize_api_key_field.rb +7 -0
- data/db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb +7 -0
- data/db/migrate/20131017162334_add_index_to_user_spree_api_key.rb +7 -0
- data/lib/solidus_api.rb +1 -0
- data/lib/spree/api/engine.rb +38 -0
- data/lib/spree/api/responders/rabl_template.rb +31 -0
- data/lib/spree/api/responders.rb +11 -0
- data/lib/spree/api/testing_support/caching.rb +10 -0
- data/lib/spree/api/testing_support/helpers.rb +44 -0
- data/lib/spree/api/testing_support/setup.rb +16 -0
- data/lib/spree/api.rb +10 -0
- data/lib/spree_api.rb +3 -0
- data/script/rails +9 -0
- data/solidus_api.gemspec +21 -0
- data/spec/controllers/spree/api/addresses_controller_spec.rb +56 -0
- data/spec/controllers/spree/api/base_controller_spec.rb +164 -0
- data/spec/controllers/spree/api/checkouts_controller_spec.rb +386 -0
- data/spec/controllers/spree/api/classifications_controller_spec.rb +48 -0
- data/spec/controllers/spree/api/config_controller_spec.rb +23 -0
- data/spec/controllers/spree/api/countries_controller_spec.rb +48 -0
- data/spec/controllers/spree/api/credit_cards_controller_spec.rb +80 -0
- data/spec/controllers/spree/api/images_controller_spec.rb +93 -0
- data/spec/controllers/spree/api/inventory_units_controller_spec.rb +50 -0
- data/spec/controllers/spree/api/line_items_controller_spec.rb +186 -0
- data/spec/controllers/spree/api/option_types_controller_spec.rb +116 -0
- data/spec/controllers/spree/api/option_values_controller_spec.rb +135 -0
- data/spec/controllers/spree/api/orders_controller_spec.rb +759 -0
- data/spec/controllers/spree/api/payments_controller_spec.rb +254 -0
- data/spec/controllers/spree/api/product_properties_controller_spec.rb +116 -0
- data/spec/controllers/spree/api/products_controller_spec.rb +454 -0
- data/spec/controllers/spree/api/promotion_application_spec.rb +50 -0
- data/spec/controllers/spree/api/promotions_controller_spec.rb +64 -0
- data/spec/controllers/spree/api/properties_controller_spec.rb +102 -0
- data/spec/controllers/spree/api/return_authorizations_controller_spec.rb +173 -0
- data/spec/controllers/spree/api/shipments_controller_spec.rb +252 -0
- data/spec/controllers/spree/api/states_controller_spec.rb +82 -0
- data/spec/controllers/spree/api/stock_items_controller_spec.rb +307 -0
- data/spec/controllers/spree/api/stock_locations_controller_spec.rb +172 -0
- data/spec/controllers/spree/api/stock_movements_controller_spec.rb +84 -0
- data/spec/controllers/spree/api/stock_transfers_controller_spec.rb +83 -0
- data/spec/controllers/spree/api/store_credit_events_controller_spec.rb +68 -0
- data/spec/controllers/spree/api/stores_controller_spec.rb +133 -0
- data/spec/controllers/spree/api/taxonomies_controller_spec.rb +114 -0
- data/spec/controllers/spree/api/taxons_controller_spec.rb +177 -0
- data/spec/controllers/spree/api/transfer_items_controller_spec.rb +152 -0
- data/spec/controllers/spree/api/unauthenticated_products_controller_spec.rb +26 -0
- data/spec/controllers/spree/api/users_controller_spec.rb +153 -0
- data/spec/controllers/spree/api/variants_controller_spec.rb +235 -0
- data/spec/controllers/spree/api/zones_controller_spec.rb +115 -0
- data/spec/features/checkout_spec.rb +187 -0
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/models/spree/legacy_user_spec.rb +45 -0
- data/spec/requests/rabl_cache_spec.rb +32 -0
- data/spec/shared_examples/protect_product_actions.rb +17 -0
- data/spec/spec_helper.rb +60 -0
- data/spec/support/controller_hacks.rb +38 -0
- data/spec/support/database_cleaner.rb +14 -0
- data/spec/support/have_attributes_matcher.rb +13 -0
- metadata +334 -0
File without changes
|
@@ -0,0 +1,9 @@
|
|
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) { |o| o.display_ship_total }
|
7
|
+
node(:display_tax_total) { |o| o.display_tax_total }
|
8
|
+
node(:token) { |o| o.guest_token }
|
9
|
+
node(:checkout_steps) { |o| o.checkout_steps }
|
@@ -0,0 +1,52 @@
|
|
1
|
+
object @order
|
2
|
+
extends "spree/api/orders/order"
|
3
|
+
|
4
|
+
if lookup_context.find_all("spree/api/orders/#{root_object.state}").present?
|
5
|
+
extends "spree/api/orders/#{root_object.state}"
|
6
|
+
end
|
7
|
+
|
8
|
+
child :billing_address => :bill_address do
|
9
|
+
extends "spree/api/addresses/show"
|
10
|
+
end
|
11
|
+
|
12
|
+
child :shipping_address => :ship_address do
|
13
|
+
extends "spree/api/addresses/show"
|
14
|
+
end
|
15
|
+
|
16
|
+
child :line_items => :line_items do
|
17
|
+
extends "spree/api/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, :environment
|
25
|
+
end
|
26
|
+
|
27
|
+
child :source => :source do
|
28
|
+
attributes *payment_source_attributes
|
29
|
+
if @current_user_roles.include?('admin')
|
30
|
+
attributes *(payment_source_attributes + [:gateway_customer_profile_id, :gateway_payment_profile_id])
|
31
|
+
else
|
32
|
+
attributes *payment_source_attributes
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
child :shipments => :shipments do
|
38
|
+
extends "spree/api/shipments/small"
|
39
|
+
end
|
40
|
+
|
41
|
+
child :adjustments => :adjustments do
|
42
|
+
extends "spree/api/adjustments/show"
|
43
|
+
end
|
44
|
+
|
45
|
+
# Necessary for backend's order interface
|
46
|
+
node :permissions do
|
47
|
+
{ can_update: current_ability.can?(:update, root_object) }
|
48
|
+
end
|
49
|
+
|
50
|
+
child :valid_credit_cards => :credit_cards do
|
51
|
+
extends "spree/api/credit_cards/show"
|
52
|
+
end
|
@@ -0,0 +1,9 @@
|
|
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] || Kaminari.config.default_per_page }
|
6
|
+
node(:pages) { @products.num_pages }
|
7
|
+
child(@products => :products) do
|
8
|
+
extends "spree/api/products/show"
|
9
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
attributes *product_attributes
|
@@ -0,0 +1,31 @@
|
|
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) { |p| p.has_variants? }
|
8
|
+
|
9
|
+
child :master => :master do
|
10
|
+
extends "spree/api/variants/small"
|
11
|
+
end
|
12
|
+
|
13
|
+
child :variants => :variants do
|
14
|
+
extends "spree/api/variants/small"
|
15
|
+
end
|
16
|
+
|
17
|
+
child :option_types => :option_types do
|
18
|
+
attributes *option_type_attributes
|
19
|
+
end
|
20
|
+
|
21
|
+
child :product_properties => :product_properties do
|
22
|
+
attributes *product_property_attributes
|
23
|
+
end
|
24
|
+
|
25
|
+
child :classifications => :classifications do
|
26
|
+
attributes :taxon_id, :position
|
27
|
+
|
28
|
+
child(:taxon) do
|
29
|
+
extends "spree/api/taxons/show"
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,7 @@
|
|
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] || 1 }
|
7
|
+
node(:pages) { @return_authorizations.num_pages }
|
@@ -0,0 +1,48 @@
|
|
1
|
+
object @shipment
|
2
|
+
cache @shipment
|
3
|
+
attributes *shipment_attributes
|
4
|
+
|
5
|
+
child selected_shipping_rate: :selected_shipping_rate do
|
6
|
+
extends "spree/api/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/variants/small"
|
15
|
+
attributes :product_id
|
16
|
+
child(images: :images) { extends "spree/api/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) { |li| li.total }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
child order: :order do
|
28
|
+
extends "spree/api/orders/order"
|
29
|
+
|
30
|
+
child billing_address: :bill_address do
|
31
|
+
extends "spree/api/addresses/show"
|
32
|
+
end
|
33
|
+
|
34
|
+
child shipping_address: :ship_address do
|
35
|
+
extends "spree/api/addresses/show"
|
36
|
+
end
|
37
|
+
|
38
|
+
child adjustments: :adjustments do
|
39
|
+
extends "spree/api/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
|
@@ -0,0 +1,32 @@
|
|
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/shipping_rates/show"
|
9
|
+
end
|
10
|
+
|
11
|
+
child :selected_shipping_rate => :selected_shipping_rate do
|
12
|
+
extends "spree/api/shipping_rates/show"
|
13
|
+
end
|
14
|
+
|
15
|
+
child :shipping_methods => :shipping_methods do
|
16
|
+
attributes :id, :name
|
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/variants/small"
|
29
|
+
end
|
30
|
+
node(:quantity) { |m| m.quantity }
|
31
|
+
node(:states) { |m| m.states }
|
32
|
+
end
|
@@ -0,0 +1,37 @@
|
|
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/shipping_rates/show"
|
10
|
+
end
|
11
|
+
|
12
|
+
child :selected_shipping_rate => :selected_shipping_rate do
|
13
|
+
extends "spree/api/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) { |m| m.quantity }
|
32
|
+
node(:states) { |m| m.states }
|
33
|
+
end
|
34
|
+
|
35
|
+
child :adjustments => :adjustments do
|
36
|
+
extends "spree/api/adjustments/show"
|
37
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
object false
|
2
|
+
if @country
|
3
|
+
node(:states_required) { @country.states_required }
|
4
|
+
end
|
5
|
+
|
6
|
+
child(@states => :states) do
|
7
|
+
attributes *state_attributes
|
8
|
+
end
|
9
|
+
|
10
|
+
if @states.respond_to?(:num_pages)
|
11
|
+
node(:count) { @states.count }
|
12
|
+
node(:current_page) { params[:page] || 1 }
|
13
|
+
node(:pages) { @states.num_pages }
|
14
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
object false
|
2
|
+
|
3
|
+
child(@store_credit_events => :store_credit_events) do
|
4
|
+
attributes *store_credit_history_attributes
|
5
|
+
node(:order_number) { |event| event.order.try(:number) }
|
6
|
+
end
|
7
|
+
|
8
|
+
node(:count) { @store_credit_events.count }
|
9
|
+
node(:current_page) { params[:page] || 1 }
|
10
|
+
node(:pages) { @store_credit_events.num_pages }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
object @taxonomy
|
2
|
+
|
3
|
+
if set = params[:set]
|
4
|
+
extends "spree/api/taxonomies/#{set}"
|
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
|
@@ -0,0 +1,12 @@
|
|
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] || Kaminari.config.default_per_page }
|
6
|
+
node(:pages) { @taxons.num_pages }
|
7
|
+
child @taxons => :taxons do
|
8
|
+
attributes *taxon_attributes
|
9
|
+
unless params[:without_children]
|
10
|
+
extends "spree/api/taxons/taxons"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
object @variant
|
2
|
+
attributes *variant_attributes
|
3
|
+
|
4
|
+
cache [I18n.locale, @current_user_roles.include?('admin'), 'big_variant', root_object]
|
5
|
+
|
6
|
+
extends "spree/api/variants/small"
|
7
|
+
|
8
|
+
node :total_on_hand do
|
9
|
+
root_object.total_on_hand
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
child(root_object.stock_items.accessible_by(current_ability) => :stock_items) do
|
14
|
+
attributes :id, :count_on_hand, :stock_location_id, :backorderable
|
15
|
+
attribute :available? => :available
|
16
|
+
node(:stock_location_name) { |si| si.stock_location.name }
|
17
|
+
end
|