goca-spree-api 3.1.14.rails.5.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.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +5 -0
  4. data/LICENSE +26 -0
  5. data/Rakefile +16 -0
  6. data/app/controllers/spree/api/base_controller.rb +167 -0
  7. data/app/controllers/spree/api/v1/addresses_controller.rb +46 -0
  8. data/app/controllers/spree/api/v1/checkouts_controller.rb +103 -0
  9. data/app/controllers/spree/api/v1/classifications_controller.rb +20 -0
  10. data/app/controllers/spree/api/v1/countries_controller.rb +24 -0
  11. data/app/controllers/spree/api/v1/credit_cards_controller.rb +27 -0
  12. data/app/controllers/spree/api/v1/images_controller.rb +56 -0
  13. data/app/controllers/spree/api/v1/inventory_units_controller.rb +54 -0
  14. data/app/controllers/spree/api/v1/line_items_controller.rb +70 -0
  15. data/app/controllers/spree/api/v1/option_types_controller.rb +51 -0
  16. data/app/controllers/spree/api/v1/option_values_controller.rb +60 -0
  17. data/app/controllers/spree/api/v1/orders_controller.rb +148 -0
  18. data/app/controllers/spree/api/v1/payments_controller.rb +83 -0
  19. data/app/controllers/spree/api/v1/product_properties_controller.rb +70 -0
  20. data/app/controllers/spree/api/v1/products_controller.rb +126 -0
  21. data/app/controllers/spree/api/v1/promotions_controller.rb +28 -0
  22. data/app/controllers/spree/api/v1/properties_controller.rb +72 -0
  23. data/app/controllers/spree/api/v1/return_authorizations_controller.rb +71 -0
  24. data/app/controllers/spree/api/v1/shipments_controller.rb +163 -0
  25. data/app/controllers/spree/api/v1/states_controller.rb +37 -0
  26. data/app/controllers/spree/api/v1/stock_items_controller.rb +77 -0
  27. data/app/controllers/spree/api/v1/stock_locations_controller.rb +52 -0
  28. data/app/controllers/spree/api/v1/stock_movements_controller.rb +45 -0
  29. data/app/controllers/spree/api/v1/stores_controller.rb +57 -0
  30. data/app/controllers/spree/api/v1/taxonomies_controller.rb +66 -0
  31. data/app/controllers/spree/api/v1/taxons_controller.rb +95 -0
  32. data/app/controllers/spree/api/v1/users_controller.rb +60 -0
  33. data/app/controllers/spree/api/v1/variants_controller.rb +75 -0
  34. data/app/controllers/spree/api/v1/zones_controller.rb +51 -0
  35. data/app/helpers/spree/api/api_helpers.rb +173 -0
  36. data/app/models/spree/api_configuration.rb +5 -0
  37. data/app/views/spree/api/errors/gateway_error.v1.rabl +2 -0
  38. data/app/views/spree/api/errors/invalid_api_key.v1.rabl +2 -0
  39. data/app/views/spree/api/errors/invalid_resource.v1.rabl +3 -0
  40. data/app/views/spree/api/errors/must_specify_api_key.v1.rabl +2 -0
  41. data/app/views/spree/api/errors/not_found.v1.rabl +2 -0
  42. data/app/views/spree/api/errors/unauthorized.v1.rabl +2 -0
  43. data/app/views/spree/api/v1/addresses/show.v1.rabl +10 -0
  44. data/app/views/spree/api/v1/adjustments/show.v1.rabl +4 -0
  45. data/app/views/spree/api/v1/config/money.v1.rabl +2 -0
  46. data/app/views/spree/api/v1/config/show.v1.rabl +2 -0
  47. data/app/views/spree/api/v1/countries/index.v1.rabl +7 -0
  48. data/app/views/spree/api/v1/countries/show.v1.rabl +5 -0
  49. data/app/views/spree/api/v1/credit_cards/index.v1.rabl +7 -0
  50. data/app/views/spree/api/v1/credit_cards/show.v1.rabl +3 -0
  51. data/app/views/spree/api/v1/images/index.v1.rabl +4 -0
  52. data/app/views/spree/api/v1/images/new.v1.rabl +3 -0
  53. data/app/views/spree/api/v1/images/show.v1.rabl +6 -0
  54. data/app/views/spree/api/v1/inventory_units/show.rabl +2 -0
  55. data/app/views/spree/api/v1/line_items/new.v1.rabl +3 -0
  56. data/app/views/spree/api/v1/line_items/show.v1.rabl +15 -0
  57. data/app/views/spree/api/v1/option_types/index.v1.rabl +3 -0
  58. data/app/views/spree/api/v1/option_types/new.v1.rabl +3 -0
  59. data/app/views/spree/api/v1/option_types/show.v1.rabl +5 -0
  60. data/app/views/spree/api/v1/option_values/index.v1.rabl +3 -0
  61. data/app/views/spree/api/v1/option_values/new.v1.rabl +3 -0
  62. data/app/views/spree/api/v1/option_values/show.v1.rabl +2 -0
  63. data/app/views/spree/api/v1/orders/address.v1.rabl +0 -0
  64. data/app/views/spree/api/v1/orders/canceled.v1.rabl +0 -0
  65. data/app/views/spree/api/v1/orders/cart.v1.rabl +0 -0
  66. data/app/views/spree/api/v1/orders/complete.v1.rabl +0 -0
  67. data/app/views/spree/api/v1/orders/could_not_apply_coupon.v1.rabl +2 -0
  68. data/app/views/spree/api/v1/orders/could_not_transition.v1.rabl +3 -0
  69. data/app/views/spree/api/v1/orders/index.v1.rabl +7 -0
  70. data/app/views/spree/api/v1/orders/invalid_shipping_method.v1.rabl +2 -0
  71. data/app/views/spree/api/v1/orders/mine.v1.rabl +9 -0
  72. data/app/views/spree/api/v1/orders/order.v1.rabl +10 -0
  73. data/app/views/spree/api/v1/orders/payment.v1.rabl +3 -0
  74. data/app/views/spree/api/v1/orders/show.v1.rabl +51 -0
  75. data/app/views/spree/api/v1/payments/credit_over_limit.v1.rabl +2 -0
  76. data/app/views/spree/api/v1/payments/index.v1.rabl +7 -0
  77. data/app/views/spree/api/v1/payments/new.v1.rabl +5 -0
  78. data/app/views/spree/api/v1/payments/show.v1.rabl +2 -0
  79. data/app/views/spree/api/v1/payments/update_forbidden.v1.rabl +2 -0
  80. data/app/views/spree/api/v1/product_properties/index.v1.rabl +7 -0
  81. data/app/views/spree/api/v1/product_properties/new.v1.rabl +2 -0
  82. data/app/views/spree/api/v1/product_properties/show.v1.rabl +2 -0
  83. data/app/views/spree/api/v1/products/index.v1.rabl +9 -0
  84. data/app/views/spree/api/v1/products/new.v1.rabl +3 -0
  85. data/app/views/spree/api/v1/products/product.v1.rabl +1 -0
  86. data/app/views/spree/api/v1/products/show.v1.rabl +32 -0
  87. data/app/views/spree/api/v1/promotions/handler.v1.rabl +5 -0
  88. data/app/views/spree/api/v1/promotions/show.v1.rabl +2 -0
  89. data/app/views/spree/api/v1/properties/index.v1.rabl +7 -0
  90. data/app/views/spree/api/v1/properties/new.v1.rabl +2 -0
  91. data/app/views/spree/api/v1/properties/show.v1.rabl +2 -0
  92. data/app/views/spree/api/v1/return_authorizations/index.v1.rabl +7 -0
  93. data/app/views/spree/api/v1/return_authorizations/new.v1.rabl +3 -0
  94. data/app/views/spree/api/v1/return_authorizations/show.v1.rabl +2 -0
  95. data/app/views/spree/api/v1/shared/stock_location_required.v1.rabl +2 -0
  96. data/app/views/spree/api/v1/shipments/big.v1.rabl +48 -0
  97. data/app/views/spree/api/v1/shipments/cannot_ready_shipment.v1.rabl +2 -0
  98. data/app/views/spree/api/v1/shipments/mine.v1.rabl +9 -0
  99. data/app/views/spree/api/v1/shipments/show.v1.rabl +32 -0
  100. data/app/views/spree/api/v1/shipments/small.v1.rabl +37 -0
  101. data/app/views/spree/api/v1/shipping_rates/show.v1.rabl +2 -0
  102. data/app/views/spree/api/v1/states/index.v1.rabl +14 -0
  103. data/app/views/spree/api/v1/states/show.v1.rabl +2 -0
  104. data/app/views/spree/api/v1/stock_items/index.v1.rabl +7 -0
  105. data/app/views/spree/api/v1/stock_items/show.v1.rabl +5 -0
  106. data/app/views/spree/api/v1/stock_locations/index.v1.rabl +7 -0
  107. data/app/views/spree/api/v1/stock_locations/show.v1.rabl +8 -0
  108. data/app/views/spree/api/v1/stock_movements/index.v1.rabl +7 -0
  109. data/app/views/spree/api/v1/stock_movements/show.v1.rabl +5 -0
  110. data/app/views/spree/api/v1/stores/index.v1.rabl +4 -0
  111. data/app/views/spree/api/v1/stores/show.v1.rabl +2 -0
  112. data/app/views/spree/api/v1/taxonomies/index.v1.rabl +7 -0
  113. data/app/views/spree/api/v1/taxonomies/jstree.rabl +8 -0
  114. data/app/views/spree/api/v1/taxonomies/nested.v1.rabl +11 -0
  115. data/app/views/spree/api/v1/taxonomies/new.v1.rabl +3 -0
  116. data/app/views/spree/api/v1/taxonomies/show.v1.rabl +15 -0
  117. data/app/views/spree/api/v1/taxons/index.v1.rabl +12 -0
  118. data/app/views/spree/api/v1/taxons/jstree.rabl +8 -0
  119. data/app/views/spree/api/v1/taxons/new.v1.rabl +3 -0
  120. data/app/views/spree/api/v1/taxons/show.v1.rabl +6 -0
  121. data/app/views/spree/api/v1/taxons/taxons.v1.rabl +5 -0
  122. data/app/views/spree/api/v1/users/index.v1.rabl +7 -0
  123. data/app/views/spree/api/v1/users/new.v1.rabl +3 -0
  124. data/app/views/spree/api/v1/users/show.v1.rabl +10 -0
  125. data/app/views/spree/api/v1/variants/big.v1.rabl +14 -0
  126. data/app/views/spree/api/v1/variants/index.v1.rabl +9 -0
  127. data/app/views/spree/api/v1/variants/new.v1.rabl +2 -0
  128. data/app/views/spree/api/v1/variants/show.v1.rabl +3 -0
  129. data/app/views/spree/api/v1/variants/small.v1.rabl +17 -0
  130. data/app/views/spree/api/v1/zones/index.v1.rabl +7 -0
  131. data/app/views/spree/api/v1/zones/show.v1.rabl +6 -0
  132. data/config/initializers/metal_load_paths.rb +1 -0
  133. data/config/locales/en.yml +27 -0
  134. data/config/routes.rb +128 -0
  135. data/db/migrate/20100107141738_add_api_key_to_spree_users.rb +7 -0
  136. data/db/migrate/20120411123334_resize_api_key_field.rb +7 -0
  137. data/db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb +7 -0
  138. data/db/migrate/20131017162334_add_index_to_user_spree_api_key.rb +7 -0
  139. data/lib/spree/api/controller_setup.rb +20 -0
  140. data/lib/spree/api/engine.rb +35 -0
  141. data/lib/spree/api/responders/rabl_template.rb +30 -0
  142. data/lib/spree/api/responders.rb +11 -0
  143. data/lib/spree/api/testing_support/caching.rb +10 -0
  144. data/lib/spree/api/testing_support/helpers.rb +44 -0
  145. data/lib/spree/api/testing_support/setup.rb +16 -0
  146. data/lib/spree/api.rb +10 -0
  147. data/lib/spree_api.rb +2 -0
  148. data/script/rails +9 -0
  149. data/spec/fixtures/thinking-cat.jpg +0 -0
  150. data/spree_api.gemspec +20 -0
  151. metadata +221 -0
@@ -0,0 +1,7 @@
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 }
@@ -0,0 +1,2 @@
1
+ node(:attributes) { [*product_property_attributes] }
2
+ node(:required_attributes) { [] }
@@ -0,0 +1,2 @@
1
+ object @product_property
2
+ attributes *product_property_attributes
@@ -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].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
@@ -0,0 +1,3 @@
1
+ object false
2
+ node(:attributes) { [*product_attributes] }
3
+ node(:required_attributes) { required_fields_for(Spree::Product) }
@@ -0,0 +1 @@
1
+ attributes *product_attributes
@@ -0,0 +1,32 @@
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
+ node(:taxon_ids) { |p| p.taxon_ids }
9
+
10
+ child :master => :master do
11
+ extends "spree/api/v1/variants/small"
12
+ end
13
+
14
+ child :variants => :variants do
15
+ extends "spree/api/v1/variants/small"
16
+ end
17
+
18
+ child :option_types => :option_types do
19
+ attributes *option_type_attributes
20
+ end
21
+
22
+ child :product_properties => :product_properties do
23
+ attributes *product_property_attributes
24
+ end
25
+
26
+ child :classifications => :classifications do
27
+ attributes :taxon_id, :position
28
+
29
+ child(:taxon) do
30
+ extends "spree/api/v1/taxons/show"
31
+ end
32
+ end
@@ -0,0 +1,5 @@
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 }
@@ -0,0 +1,2 @@
1
+ object @promotion
2
+ attributes *promotion_attributes
@@ -0,0 +1,7 @@
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 }
@@ -0,0 +1,2 @@
1
+ node(:attributes) { [*property_attributes] }
2
+ node(:required_attributes) { [] }
@@ -0,0 +1,2 @@
1
+ object @property
2
+ attributes *property_attributes
@@ -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].try(:to_i) || 1 }
7
+ node(:pages) { @return_authorizations.total_pages }
@@ -0,0 +1,3 @@
1
+ object false
2
+ node(:attributes) { [*return_authorization_attributes] }
3
+ node(:required_attributes) { required_fields_for(Spree::ReturnAuthorization) }
@@ -0,0 +1,2 @@
1
+ object @return_authorization
2
+ attributes *return_authorization_attributes
@@ -0,0 +1,2 @@
1
+ object false
2
+ node(:error) { I18n.t(:stock_location_required, scope: "spree.api") }
@@ -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/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) { |li| li.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
@@ -0,0 +1,2 @@
1
+ object false
2
+ node(:error) { I18n.t(:cannot_ready, :scope => "spree.api.shipment") }
@@ -0,0 +1,9 @@
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
@@ -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/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
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) { |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/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) { |m| m.quantity }
32
+ node(:states) { |m| m.states }
33
+ end
34
+
35
+ child :adjustments => :adjustments do
36
+ extends "spree/api/v1/adjustments/show"
37
+ end
@@ -0,0 +1,2 @@
1
+ attributes :id, :name, :cost, :selected, :shipping_method_id, :shipping_method_code
2
+ node(:display_cost) { |sr| sr.display_cost.to_s }
@@ -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?(:total_pages)
11
+ node(:count) { @states.count }
12
+ node(:current_page) { params[:page].try(:to_i) || 1 }
13
+ node(:pages) { @states.total_pages }
14
+ end
@@ -0,0 +1,2 @@
1
+ object @state
2
+ attributes *state_attributes
@@ -0,0 +1,7 @@
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 }
@@ -0,0 +1,5 @@
1
+ object @stock_item
2
+ attributes *stock_item_attributes
3
+ child(:variant) do
4
+ extends "spree/api/v1/variants/small"
5
+ end
@@ -0,0 +1,7 @@
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 }
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,7 @@
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 }
@@ -0,0 +1,5 @@
1
+ object @stock_movement
2
+ attributes *stock_movement_attributes
3
+ child :stock_item do
4
+ extends "spree/api/v1/stock_items/show"
5
+ end
@@ -0,0 +1,4 @@
1
+ object false
2
+ child(@stores => :stores) do
3
+ attributes *store_attributes
4
+ end
@@ -0,0 +1,2 @@
1
+ object @store
2
+ attributes *store_attributes
@@ -0,0 +1,7 @@
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 }
@@ -0,0 +1,8 @@
1
+ object false
2
+ node(:data) { @taxonomy.root.name }
3
+ node(:attr) do
4
+ { :id => @taxonomy.root.id,
5
+ :name => @taxonomy.root.name
6
+ }
7
+ end
8
+ node(:state) { "closed" }
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,3 @@
1
+ object false
2
+ node(:attributes) { [*taxonomy_attributes] }
3
+ node(:required_attributes) { required_fields_for(Spree::Taxonomy) }
@@ -0,0 +1,15 @@
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
@@ -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].try(:to_i) || Kaminari.config.default_per_page }
6
+ node(:pages) { @taxons.total_pages }
7
+ child @taxons => :taxons do
8
+ attributes *taxon_attributes
9
+ unless params[:without_children]
10
+ extends "spree/api/v1/taxons/taxons"
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ collection @taxon.children, :object_root => false
2
+ node(:data) { |taxon| taxon.name }
3
+ node(:attr) do |taxon|
4
+ { :id => taxon.id,
5
+ :name => taxon.name
6
+ }
7
+ end
8
+ node(:state) { "closed" }
@@ -0,0 +1,3 @@
1
+ object false
2
+ node(:attributes) { [*taxon_attributes] }
3
+ node(:required_attributes) { required_fields_for(Spree::Taxon) }
@@ -0,0 +1,6 @@
1
+ object @taxon
2
+ attributes *taxon_attributes
3
+
4
+ child :children => :taxons do
5
+ attributes *taxon_attributes
6
+ end
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,7 @@
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 }
@@ -0,0 +1,3 @@
1
+ object false
2
+ node(:attributes) { [*user_attributes] }
3
+ node(:required_attributes) { required_fields_for(Spree.user_class) }
@@ -0,0 +1,10 @@
1
+ object @user
2
+
3
+ attributes *user_attributes
4
+ child(:bill_address => :bill_address) do
5
+ extends "spree/api/v1/addresses/show"
6
+ end
7
+
8
+ child(:ship_address => :ship_address) do
9
+ extends "spree/api/v1/addresses/show"
10
+ end
@@ -0,0 +1,14 @@
1
+ object @variant
2
+
3
+ cache [I18n.locale, @current_user_roles.include?('admin'), 'big_variant', root_object]
4
+
5
+ extends "spree/api/v1/variants/small"
6
+
7
+ child(:stock_items => :stock_items) do
8
+ attributes :id, :count_on_hand, :stock_location_id, :backorderable
9
+ attribute :available? => :available
10
+
11
+ glue(:stock_location) do
12
+ attribute :name => :stock_location_name
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ object false
2
+ node(:count) { @variants.count }
3
+ node(:total_count) { @variants.total_count }
4
+ node(:current_page) { params[:page] ? params[:page].to_i : 1 }
5
+ node(:pages) { @variants.total_pages }
6
+
7
+ child(@variants => :variants) do
8
+ extends "spree/api/v1/variants/big"
9
+ end
@@ -0,0 +1,2 @@
1
+ node(:attributes) { [*variant_attributes] }
2
+ node(:required_attributes) { [] }
@@ -0,0 +1,3 @@
1
+ object @variant
2
+ cache [I18n.locale, @current_user_roles.include?('admin'), 'show', root_object]
3
+ extends "spree/api/v1/variants/big"
@@ -0,0 +1,17 @@
1
+ cache [I18n.locale, @current_user_roles.include?('admin'), 'small_variant', root_object]
2
+
3
+ attributes *variant_attributes
4
+
5
+ node(:display_price) { |p| p.display_price.to_s }
6
+ node(:options_text) { |v| v.options_text }
7
+ node(:track_inventory) { |v| v.should_track_inventory? }
8
+ node(:in_stock) { |v| v.in_stock? }
9
+ node(:is_backorderable) { |v| v.is_backorderable? }
10
+ node(:total_on_hand) { |v| v.total_on_hand }
11
+ node(:is_destroyed) { |v| v.destroyed? }
12
+
13
+ child :option_values => :option_values do
14
+ attributes *option_value_attributes
15
+ end
16
+
17
+ child(:images => :images) { extends "spree/api/v1/images/show" }
@@ -0,0 +1,7 @@
1
+ object false
2
+ child(@zones => :zones) do
3
+ extends 'spree/api/v1/zones/show'
4
+ end
5
+ node(:count) { @zones.count }
6
+ node(:current_page) { params[:page].try(:to_i) || 1 }
7
+ node(:pages) { @zones.total_pages }
@@ -0,0 +1,6 @@
1
+ object @zone
2
+ attributes :id, :name, :description
3
+
4
+ child :zone_members => :zone_members do
5
+ attributes :id, :name, :zoneable_type, :zoneable_id
6
+ end
@@ -0,0 +1 @@
1
+ Spree::Api::BaseController.append_view_path(ApplicationController.view_paths)
@@ -0,0 +1,27 @@
1
+ en:
2
+ spree:
3
+ api:
4
+ must_specify_api_key: "You must specify an API key."
5
+ invalid_api_key: "Invalid API key (%{key}) specified."
6
+ unauthorized: "You are not authorized to perform that action."
7
+ invalid_resource: "Invalid resource. Please fix errors and try again."
8
+ resource_not_found: "The resource you were looking for could not be found."
9
+ gateway_error: "There was a problem with the payment gateway: %{text}"
10
+ access: "API Access"
11
+ key: "Key"
12
+ clear_key: "Clear key"
13
+ regenerate_key: "Regenerate Key"
14
+ no_key: "No key"
15
+ generate_key: "Generate API key"
16
+ key_generated: "Key generated"
17
+ key_cleared: "Key cleared"
18
+ order:
19
+ could_not_transition: "The order could not be transitioned. Please fix the errors and try again."
20
+ invalid_shipping_method: "Invalid shipping method specified."
21
+ payment:
22
+ credit_over_limit: "This payment can only be credited up to %{limit}. Please specify an amount less than or equal to this number."
23
+ update_forbidden: "This payment cannot be updated because it is %{state}."
24
+ shipment:
25
+ cannot_ready: "Cannot ready shipment."
26
+ stock_location_required: "A stock_location_id parameter must be provided in order to retrieve stock movements."
27
+ invalid_taxonomy_id: "Invalid taxonomy id."