spree_api 3.0.10 → 3.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/api/base_controller.rb +21 -22
  3. data/app/controllers/spree/api/v1/addresses_controller.rb +46 -0
  4. data/app/controllers/spree/api/v1/checkouts_controller.rb +103 -0
  5. data/app/controllers/spree/api/v1/classifications_controller.rb +20 -0
  6. data/app/controllers/spree/api/v1/countries_controller.rb +24 -0
  7. data/app/controllers/spree/api/v1/credit_cards_controller.rb +27 -0
  8. data/app/controllers/spree/api/v1/images_controller.rb +56 -0
  9. data/app/controllers/spree/api/v1/inventory_units_controller.rb +54 -0
  10. data/app/controllers/spree/api/v1/line_items_controller.rb +70 -0
  11. data/app/controllers/spree/api/v1/option_types_controller.rb +51 -0
  12. data/app/controllers/spree/api/v1/option_values_controller.rb +60 -0
  13. data/app/controllers/spree/api/v1/orders_controller.rb +137 -0
  14. data/app/controllers/spree/api/v1/payments_controller.rb +82 -0
  15. data/app/controllers/spree/api/v1/product_properties_controller.rb +73 -0
  16. data/app/controllers/spree/api/v1/products_controller.rb +126 -0
  17. data/app/controllers/spree/api/v1/promotions_controller.rb +28 -0
  18. data/app/controllers/spree/api/v1/properties_controller.rb +72 -0
  19. data/app/controllers/spree/api/v1/return_authorizations_controller.rb +71 -0
  20. data/app/controllers/spree/api/v1/shipments_controller.rb +163 -0
  21. data/app/controllers/spree/api/v1/states_controller.rb +37 -0
  22. data/app/controllers/spree/api/v1/stock_items_controller.rb +77 -0
  23. data/app/controllers/spree/api/v1/stock_locations_controller.rb +52 -0
  24. data/app/controllers/spree/api/v1/stock_movements_controller.rb +45 -0
  25. data/app/controllers/spree/api/v1/stores_controller.rb +57 -0
  26. data/app/controllers/spree/api/v1/taxonomies_controller.rb +66 -0
  27. data/app/controllers/spree/api/v1/taxons_controller.rb +95 -0
  28. data/app/controllers/spree/api/v1/users_controller.rb +60 -0
  29. data/app/controllers/spree/api/v1/variants_controller.rb +75 -0
  30. data/app/controllers/spree/api/v1/zones_controller.rb +51 -0
  31. data/app/helpers/spree/api/api_helpers.rb +3 -2
  32. data/app/views/spree/api/{addresses → v1/addresses}/show.v1.rabl +0 -0
  33. data/app/views/spree/api/{adjustments → v1/adjustments}/show.v1.rabl +0 -0
  34. data/app/views/spree/api/{config → v1/config}/money.v1.rabl +0 -0
  35. data/app/views/spree/api/{config → v1/config}/show.v1.rabl +0 -0
  36. data/app/views/spree/api/{countries → v1/countries}/index.v1.rabl +0 -0
  37. data/app/views/spree/api/{countries → v1/countries}/show.v1.rabl +0 -0
  38. data/app/views/spree/api/{credit_cards → v1/credit_cards}/index.v1.rabl +1 -1
  39. data/app/views/spree/api/{credit_cards → v1/credit_cards}/show.v1.rabl +0 -0
  40. data/app/views/spree/api/{images → v1/images}/index.v1.rabl +1 -1
  41. data/app/views/spree/api/v1/images/new.v1.rabl +3 -0
  42. data/app/views/spree/api/{images → v1/images}/show.v1.rabl +0 -0
  43. data/app/views/spree/api/{inventory_units → v1/inventory_units}/show.rabl +0 -0
  44. data/app/views/spree/api/{line_items → v1/line_items}/new.v1.rabl +0 -0
  45. data/app/views/spree/api/{line_items → v1/line_items}/show.v1.rabl +3 -3
  46. data/app/views/spree/api/v1/option_types/index.v1.rabl +3 -0
  47. data/app/views/spree/api/v1/option_types/new.v1.rabl +3 -0
  48. data/app/views/spree/api/{option_types → v1/option_types}/show.v1.rabl +0 -0
  49. data/app/views/spree/api/v1/option_values/index.v1.rabl +3 -0
  50. data/app/views/spree/api/v1/option_values/new.v1.rabl +3 -0
  51. data/app/views/spree/api/{option_values → v1/option_values}/show.v1.rabl +0 -0
  52. data/app/views/spree/api/{orders → v1/orders}/address.v1.rabl +0 -0
  53. data/app/views/spree/api/{orders → v1/orders}/canceled.v1.rabl +0 -0
  54. data/app/views/spree/api/{orders → v1/orders}/cart.v1.rabl +0 -0
  55. data/app/views/spree/api/{orders → v1/orders}/complete.v1.rabl +0 -0
  56. data/app/views/spree/api/{orders → v1/orders}/could_not_apply_coupon.v1.rabl +0 -0
  57. data/app/views/spree/api/{orders → v1/orders}/could_not_transition.v1.rabl +0 -0
  58. data/app/views/spree/api/{orders → v1/orders}/index.v1.rabl +1 -1
  59. data/app/views/spree/api/{orders → v1/orders}/invalid_shipping_method.v1.rabl +0 -0
  60. data/app/views/spree/api/{orders → v1/orders}/mine.v1.rabl +1 -1
  61. data/app/views/spree/api/{orders → v1/orders}/order.v1.rabl +1 -0
  62. data/app/views/spree/api/{orders → v1/orders}/payment.v1.rabl +0 -0
  63. data/app/views/spree/api/{orders → v1/orders}/show.v1.rabl +9 -9
  64. data/app/views/spree/api/{payments → v1/payments}/credit_over_limit.v1.rabl +0 -0
  65. data/app/views/spree/api/{payments → v1/payments}/index.v1.rabl +0 -0
  66. data/app/views/spree/api/{payments → v1/payments}/new.v1.rabl +0 -0
  67. data/app/views/spree/api/{payments → v1/payments}/show.v1.rabl +0 -0
  68. data/app/views/spree/api/{payments → v1/payments}/update_forbidden.v1.rabl +0 -0
  69. data/app/views/spree/api/{product_properties → v1/product_properties}/index.v1.rabl +0 -0
  70. data/app/views/spree/api/{product_properties → v1/product_properties}/new.v1.rabl +0 -0
  71. data/app/views/spree/api/{product_properties → v1/product_properties}/show.v1.rabl +0 -0
  72. data/app/views/spree/api/{products → v1/products}/index.v1.rabl +1 -1
  73. data/app/views/spree/api/{products → v1/products}/new.v1.rabl +0 -0
  74. data/app/views/spree/api/{products → v1/products}/product.v1.rabl +0 -0
  75. data/app/views/spree/api/{products → v1/products}/show.v1.rabl +3 -3
  76. data/app/views/spree/api/{promotions → v1/promotions}/handler.v1.rabl +0 -0
  77. data/app/views/spree/api/{promotions → v1/promotions}/show.v1.rabl +0 -0
  78. data/app/views/spree/api/{properties → v1/properties}/index.v1.rabl +0 -0
  79. data/app/views/spree/api/{properties → v1/properties}/new.v1.rabl +0 -0
  80. data/app/views/spree/api/{properties → v1/properties}/show.v1.rabl +0 -0
  81. data/app/views/spree/api/{return_authorizations → v1/return_authorizations}/index.v1.rabl +0 -0
  82. data/app/views/spree/api/{return_authorizations → v1/return_authorizations}/new.v1.rabl +0 -0
  83. data/app/views/spree/api/{return_authorizations → v1/return_authorizations}/show.v1.rabl +0 -0
  84. data/app/views/spree/api/{shared → v1/shared}/stock_location_required.v1.rabl +0 -0
  85. data/app/views/spree/api/{shipments → v1/shipments}/big.v1.rabl +7 -7
  86. data/app/views/spree/api/{shipments → v1/shipments}/cannot_ready_shipment.v1.rabl +0 -0
  87. data/app/views/spree/api/{shipments → v1/shipments}/mine.v1.rabl +1 -1
  88. data/app/views/spree/api/{shipments → v1/shipments}/show.v1.rabl +3 -3
  89. data/app/views/spree/api/{shipments → v1/shipments}/small.v1.rabl +3 -3
  90. data/app/views/spree/api/{shipping_rates → v1/shipping_rates}/show.v1.rabl +0 -0
  91. data/app/views/spree/api/{states → v1/states}/index.v1.rabl +0 -0
  92. data/app/views/spree/api/{states → v1/states}/show.v1.rabl +0 -0
  93. data/app/views/spree/api/{stock_items → v1/stock_items}/index.v1.rabl +1 -1
  94. data/app/views/spree/api/{stock_items → v1/stock_items}/show.v1.rabl +1 -1
  95. data/app/views/spree/api/{stock_locations → v1/stock_locations}/index.v1.rabl +1 -1
  96. data/app/views/spree/api/{stock_locations → v1/stock_locations}/show.v1.rabl +0 -0
  97. data/app/views/spree/api/{stock_movements → v1/stock_movements}/index.v1.rabl +1 -1
  98. data/app/views/spree/api/{stock_movements → v1/stock_movements}/show.v1.rabl +1 -1
  99. data/app/views/spree/api/{stores → v1/stores}/index.v1.rabl +0 -0
  100. data/app/views/spree/api/{stores → v1/stores}/show.v1.rabl +0 -0
  101. data/app/views/spree/api/{taxonomies → v1/taxonomies}/index.v1.rabl +1 -1
  102. data/app/views/spree/api/{taxonomies → v1/taxonomies}/jstree.rabl +0 -0
  103. data/app/views/spree/api/{taxonomies → v1/taxonomies}/nested.v1.rabl +1 -1
  104. data/app/views/spree/api/{taxonomies → v1/taxonomies}/new.v1.rabl +0 -0
  105. data/app/views/spree/api/{taxonomies → v1/taxonomies}/show.v1.rabl +4 -4
  106. data/app/views/spree/api/{taxons → v1/taxons}/index.v1.rabl +1 -1
  107. data/app/views/spree/api/{taxons → v1/taxons}/jstree.rabl +0 -0
  108. data/app/views/spree/api/{taxons → v1/taxons}/new.v1.rabl +0 -0
  109. data/app/views/spree/api/{taxons → v1/taxons}/show.v1.rabl +0 -0
  110. data/app/views/spree/api/v1/taxons/taxons.v1.rabl +5 -0
  111. data/app/views/spree/api/{users → v1/users}/index.v1.rabl +1 -1
  112. data/app/views/spree/api/{users → v1/users}/new.v1.rabl +0 -0
  113. data/app/views/spree/api/{users → v1/users}/show.v1.rabl +2 -2
  114. data/app/views/spree/api/{variants → v1/variants}/big.v1.rabl +1 -1
  115. data/app/views/spree/api/{variants → v1/variants}/index.v1.rabl +1 -1
  116. data/app/views/spree/api/{variants → v1/variants}/new.v1.rabl +0 -0
  117. data/app/views/spree/api/{variants → v1/variants}/show.v1.rabl +1 -1
  118. data/app/views/spree/api/{variants → v1/variants}/small.v1.rabl +1 -1
  119. data/app/views/spree/api/{zones → v1/zones}/index.v1.rabl +1 -1
  120. data/app/views/spree/api/{zones → v1/zones}/show.v1.rabl +0 -0
  121. data/config/routes.rb +85 -88
  122. data/spec/controllers/spree/api/base_controller_spec.rb +14 -42
  123. data/spec/controllers/spree/api/{addresses_controller_spec.rb → v1/addresses_controller_spec.rb} +1 -1
  124. data/spec/controllers/spree/api/{checkouts_controller_spec.rb → v1/checkouts_controller_spec.rb} +51 -3
  125. data/spec/controllers/spree/api/{classifications_controller_spec.rb → v1/classifications_controller_spec.rb} +2 -2
  126. data/spec/controllers/spree/api/{countries_controller_spec.rb → v1/countries_controller_spec.rb} +1 -1
  127. data/spec/controllers/spree/api/{credit_cards_controller_spec.rb → v1/credit_cards_controller_spec.rb} +1 -1
  128. data/spec/controllers/spree/api/{images_controller_spec.rb → v1/images_controller_spec.rb} +23 -1
  129. data/spec/controllers/spree/api/{inventory_units_controller_spec.rb → v1/inventory_units_controller_spec.rb} +1 -1
  130. data/spec/controllers/spree/api/{line_items_controller_spec.rb → v1/line_items_controller_spec.rb} +2 -2
  131. data/spec/controllers/spree/api/{option_types_controller_spec.rb → v1/option_types_controller_spec.rb} +9 -3
  132. data/spec/controllers/spree/api/{option_values_controller_spec.rb → v1/option_values_controller_spec.rb} +8 -2
  133. data/spec/controllers/spree/api/{orders_controller_spec.rb → v1/orders_controller_spec.rb} +29 -8
  134. data/spec/controllers/spree/api/{payments_controller_spec.rb → v1/payments_controller_spec.rb} +2 -2
  135. data/spec/controllers/spree/api/{product_properties_controller_spec.rb → v1/product_properties_controller_spec.rb} +1 -1
  136. data/spec/controllers/spree/api/{products_controller_spec.rb → v1/products_controller_spec.rb} +5 -5
  137. data/spec/controllers/spree/api/{promotion_application_spec.rb → v1/promotion_application_spec.rb} +2 -2
  138. data/spec/controllers/spree/api/{promotions_controller_spec.rb → v1/promotions_controller_spec.rb} +1 -1
  139. data/spec/controllers/spree/api/{properties_controller_spec.rb → v1/properties_controller_spec.rb} +1 -1
  140. data/spec/controllers/spree/api/{return_authorizations_controller_spec.rb → v1/return_authorizations_controller_spec.rb} +1 -1
  141. data/spec/controllers/spree/api/{shipments_controller_spec.rb → v1/shipments_controller_spec.rb} +4 -4
  142. data/spec/controllers/spree/api/{states_controller_spec.rb → v1/states_controller_spec.rb} +14 -10
  143. data/spec/controllers/spree/api/{stock_items_controller_spec.rb → v1/stock_items_controller_spec.rb} +1 -1
  144. data/spec/controllers/spree/api/{stock_locations_controller_spec.rb → v1/stock_locations_controller_spec.rb} +1 -1
  145. data/spec/controllers/spree/api/{stock_movements_controller_spec.rb → v1/stock_movements_controller_spec.rb} +1 -1
  146. data/spec/controllers/spree/api/{stores_controller_spec.rb → v1/stores_controller_spec.rb} +1 -1
  147. data/spec/controllers/spree/api/{taxonomies_controller_spec.rb → v1/taxonomies_controller_spec.rb} +1 -1
  148. data/spec/controllers/spree/api/{taxons_controller_spec.rb → v1/taxons_controller_spec.rb} +1 -1
  149. data/spec/controllers/spree/api/{unauthenticated_products_controller_spec.rb → v1/unauthenticated_products_controller_spec.rb} +1 -1
  150. data/spec/controllers/spree/api/{users_controller_spec.rb → v1/users_controller_spec.rb} +1 -1
  151. data/spec/controllers/spree/api/{variants_controller_spec.rb → v1/variants_controller_spec.rb} +3 -3
  152. data/spec/controllers/spree/api/{zones_controller_spec.rb → v1/zones_controller_spec.rb} +7 -5
  153. data/spec/requests/rabl_cache_spec.rb +2 -2
  154. data/spec/requests/ransackable_attributes_spec.rb +6 -6
  155. data/spec/requests/version_spec.rb +19 -0
  156. data/spree_api.gemspec +1 -1
  157. metadata +188 -185
  158. data/CHANGELOG.md +0 -3
  159. data/app/controllers/spree/api/addresses_controller.rb +0 -43
  160. data/app/controllers/spree/api/checkouts_controller.rb +0 -98
  161. data/app/controllers/spree/api/classifications_controller.rb +0 -18
  162. data/app/controllers/spree/api/countries_controller.rb +0 -23
  163. data/app/controllers/spree/api/credit_cards_controller.rb +0 -25
  164. data/app/controllers/spree/api/images_controller.rb +0 -47
  165. data/app/controllers/spree/api/inventory_units_controller.rb +0 -52
  166. data/app/controllers/spree/api/line_items_controller.rb +0 -69
  167. data/app/controllers/spree/api/option_types_controller.rb +0 -49
  168. data/app/controllers/spree/api/option_values_controller.rb +0 -58
  169. data/app/controllers/spree/api/orders_controller.rb +0 -130
  170. data/app/controllers/spree/api/payments_controller.rb +0 -80
  171. data/app/controllers/spree/api/product_properties_controller.rb +0 -72
  172. data/app/controllers/spree/api/products_controller.rb +0 -124
  173. data/app/controllers/spree/api/promotions_controller.rb +0 -26
  174. data/app/controllers/spree/api/properties_controller.rb +0 -70
  175. data/app/controllers/spree/api/return_authorizations_controller.rb +0 -69
  176. data/app/controllers/spree/api/shipments_controller.rb +0 -149
  177. data/app/controllers/spree/api/states_controller.rb +0 -38
  178. data/app/controllers/spree/api/stock_items_controller.rb +0 -75
  179. data/app/controllers/spree/api/stock_locations_controller.rb +0 -50
  180. data/app/controllers/spree/api/stock_movements_controller.rb +0 -43
  181. data/app/controllers/spree/api/stores_controller.rb +0 -55
  182. data/app/controllers/spree/api/taxonomies_controller.rb +0 -64
  183. data/app/controllers/spree/api/taxons_controller.rb +0 -93
  184. data/app/controllers/spree/api/users_controller.rb +0 -56
  185. data/app/controllers/spree/api/variants_controller.rb +0 -73
  186. data/app/controllers/spree/api/zones_controller.rb +0 -49
  187. data/app/models/spree/option_value_decorator.rb +0 -9
  188. data/app/views/spree/api/option_types/index.v1.rabl +0 -3
  189. data/app/views/spree/api/option_values/index.v1.rabl +0 -3
  190. data/app/views/spree/api/taxons/taxons.v1.rabl +0 -5
@@ -5,5 +5,5 @@ node(:current_page) { params[:page] || 1 }
5
5
  node(:pages) { @shipments.num_pages }
6
6
 
7
7
  child(@shipments => :shipments) do
8
- extends "spree/api/shipments/big"
8
+ extends "spree/api/v1/shipments/big"
9
9
  end
@@ -5,11 +5,11 @@ node(:order_id) { |shipment| shipment.order.number }
5
5
  node(:stock_location_name) { |shipment| shipment.stock_location.name }
6
6
 
7
7
  child :shipping_rates => :shipping_rates do
8
- extends "spree/api/shipping_rates/show"
8
+ extends "spree/api/v1/shipping_rates/show"
9
9
  end
10
10
 
11
11
  child :selected_shipping_rate => :selected_shipping_rate do
12
- extends "spree/api/shipping_rates/show"
12
+ extends "spree/api/v1/shipping_rates/show"
13
13
  end
14
14
 
15
15
  child :shipping_methods => :shipping_methods do
@@ -25,7 +25,7 @@ end
25
25
 
26
26
  child :manifest => :manifest do
27
27
  child :variant => :variant do
28
- extends "spree/api/variants/small"
28
+ extends "spree/api/v1/variants/small"
29
29
  end
30
30
  node(:quantity) { |m| m.quantity }
31
31
  node(:states) { |m| m.states }
@@ -6,11 +6,11 @@ node(:order_id) { |shipment| shipment.order.number }
6
6
  node(:stock_location_name) { |shipment| shipment.stock_location.name }
7
7
 
8
8
  child :shipping_rates => :shipping_rates do
9
- extends "spree/api/shipping_rates/show"
9
+ extends "spree/api/v1/shipping_rates/show"
10
10
  end
11
11
 
12
12
  child :selected_shipping_rate => :selected_shipping_rate do
13
- extends "spree/api/shipping_rates/show"
13
+ extends "spree/api/v1/shipping_rates/show"
14
14
  end
15
15
 
16
16
  child :shipping_methods => :shipping_methods do
@@ -33,5 +33,5 @@ child :manifest => :manifest do
33
33
  end
34
34
 
35
35
  child :adjustments => :adjustments do
36
- extends "spree/api/adjustments/show"
36
+ extends "spree/api/v1/adjustments/show"
37
37
  end
@@ -1,6 +1,6 @@
1
1
  object false
2
2
  child(@stock_items => :stock_items) do
3
- extends 'spree/api/stock_items/show'
3
+ extends 'spree/api/v1/stock_items/show'
4
4
  end
5
5
  node(:count) { @stock_items.count }
6
6
  node(:current_page) { params[:page] || 1 }
@@ -1,5 +1,5 @@
1
1
  object @stock_item
2
2
  attributes *stock_item_attributes
3
3
  child(:variant) do
4
- extends "spree/api/variants/small"
4
+ extends "spree/api/v1/variants/small"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  object false
2
2
  child(@stock_locations => :stock_locations) do
3
- extends 'spree/api/stock_locations/show'
3
+ extends 'spree/api/v1/stock_locations/show'
4
4
  end
5
5
  node(:count) { @stock_locations.count }
6
6
  node(:current_page) { params[:page] || 1 }
@@ -1,6 +1,6 @@
1
1
  object false
2
2
  child(@stock_movements => :stock_movements) do
3
- extends 'spree/api/stock_movements/show'
3
+ extends 'spree/api/v1/stock_movements/show'
4
4
  end
5
5
  node(:count) { @stock_movements.count }
6
6
  node(:current_page) { params[:page] || 1 }
@@ -1,5 +1,5 @@
1
1
  object @stock_movement
2
2
  attributes *stock_movement_attributes
3
3
  child :stock_item do
4
- extends "spree/api/stock_items/show"
4
+ extends "spree/api/v1/stock_items/show"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  object false
2
2
  child(@taxonomies => :taxonomies) do
3
- extends "spree/api/taxonomies/show"
3
+ extends "spree/api/v1/taxonomies/show"
4
4
  end
5
5
  node(:count) { @taxonomies.count }
6
6
  node(:current_page) { params[:page] || 1 }
@@ -6,6 +6,6 @@ child :root => :root do
6
6
  child :children => :taxons do
7
7
  attributes *taxon_attributes
8
8
 
9
- extends "spree/api/taxons/taxons"
9
+ extends "spree/api/v1/taxons/taxons"
10
10
  end
11
11
  end
@@ -1,14 +1,14 @@
1
1
  object @taxonomy
2
2
 
3
3
  if params[:set] == 'nested'
4
- extends "spree/api/taxonomies/nested"
4
+ extends "spree/api/v1/taxonomies/nested"
5
5
  else
6
6
  attributes *taxonomy_attributes
7
7
 
8
- child :root => :root do
9
- attributes *taxon_attributes
8
+ child root: :root do
9
+ attributes *taxon_attributes
10
10
 
11
- child :children => :taxons do
11
+ child children: :taxons do
12
12
  attributes *taxon_attributes
13
13
  end
14
14
  end
@@ -7,6 +7,6 @@ node(:pages) { @taxons.num_pages }
7
7
  child @taxons => :taxons do
8
8
  attributes *taxon_attributes
9
9
  unless params[:without_children]
10
- extends "spree/api/taxons/taxons"
10
+ extends "spree/api/v1/taxons/taxons"
11
11
  end
12
12
  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
@@ -1,6 +1,6 @@
1
1
  object false
2
2
  child(@users => :users) do
3
- extends "spree/api/users/show"
3
+ extends "spree/api/v1/users/show"
4
4
  end
5
5
  node(:count) { @users.count }
6
6
  node(:current_page) { params[:page] || 1 }
File without changes
@@ -2,9 +2,9 @@ object @user
2
2
 
3
3
  attributes *user_attributes
4
4
  child(:bill_address => :bill_address) do
5
- extends "spree/api/addresses/show"
5
+ extends "spree/api/v1/addresses/show"
6
6
  end
7
7
 
8
8
  child(:ship_address => :ship_address) do
9
- extends "spree/api/addresses/show"
9
+ extends "spree/api/v1/addresses/show"
10
10
  end
@@ -2,7 +2,7 @@ object @variant
2
2
 
3
3
  cache [I18n.locale, @current_user_roles.include?('admin'), 'big_variant', root_object]
4
4
 
5
- extends "spree/api/variants/small"
5
+ extends "spree/api/v1/variants/small"
6
6
 
7
7
  child(:stock_items => :stock_items) do
8
8
  attributes :id, :count_on_hand, :stock_location_id, :backorderable
@@ -5,5 +5,5 @@ node(:current_page) { params[:page] ? params[:page].to_i : 1 }
5
5
  node(:pages) { @variants.num_pages }
6
6
 
7
7
  child(@variants => :variants) do
8
- extends "spree/api/variants/big"
8
+ extends "spree/api/v1/variants/big"
9
9
  end
@@ -1,3 +1,3 @@
1
1
  object @variant
2
2
  cache [I18n.locale, @current_user_roles.include?('admin'), 'show', root_object]
3
- extends "spree/api/variants/big"
3
+ extends "spree/api/v1/variants/big"
@@ -14,4 +14,4 @@ child :option_values => :option_values do
14
14
  attributes *option_value_attributes
15
15
  end
16
16
 
17
- child(:images => :images) { extends "spree/api/images/show" }
17
+ child(:images => :images) { extends "spree/api/v1/images/show" }
@@ -1,6 +1,6 @@
1
1
  object false
2
2
  child(@zones => :zones) do
3
- extends 'spree/api/zones/show'
3
+ extends 'spree/api/v1/zones/show'
4
4
  end
5
5
  node(:count) { @zones.count }
6
6
  node(:current_page) { params[:page] || 1 }
data/config/routes.rb CHANGED
@@ -1,124 +1,121 @@
1
1
  Spree::Core::Engine.add_routes do
2
- namespace :admin do
3
- resources :users do
4
- member do
5
- put :generate_api_key
6
- put :clear_api_key
7
- end
8
- end
9
- end
10
-
11
2
  namespace :api, defaults: { format: 'json' } do
12
- resources :promotions, only: [:show]
13
-
14
- resources :products do
15
- resources :images
16
- resources :variants
17
- resources :product_properties
18
- end
3
+ namespace :v1 do
4
+ resources :promotions, only: [:show]
19
5
 
20
- concern :order_routes do
21
- member do
22
- put :cancel
23
- put :empty
24
- put :apply_coupon_code
6
+ resources :products do
7
+ resources :images
8
+ resources :variants
9
+ resources :product_properties
25
10
  end
26
11
 
27
- resources :line_items
28
- resources :payments do
12
+ concern :order_routes do
29
13
  member do
30
- put :authorize
31
- put :capture
32
- put :purchase
33
- put :void
34
- put :credit
14
+ put :approve
15
+ put :cancel
16
+ put :empty
17
+ put :apply_coupon_code
35
18
  end
36
- end
37
19
 
38
- resources :addresses, only: [:show, :update]
20
+ resources :line_items
21
+ resources :payments do
22
+ member do
23
+ put :authorize
24
+ put :capture
25
+ put :purchase
26
+ put :void
27
+ put :credit
28
+ end
29
+ end
39
30
 
40
- resources :return_authorizations do
41
- member do
42
- put :add
43
- put :cancel
44
- put :receive
31
+ resources :addresses, only: [:show, :update]
32
+
33
+ resources :return_authorizations do
34
+ member do
35
+ put :add
36
+ put :cancel
37
+ put :receive
38
+ end
45
39
  end
46
40
  end
47
- end
48
41
 
49
- resources :checkouts, only: [:update], concerns: :order_routes do
50
- member do
51
- put :next
52
- put :advance
42
+ resources :checkouts, only: [:update], concerns: :order_routes do
43
+ member do
44
+ put :next
45
+ put :advance
46
+ end
53
47
  end
54
- end
55
48
 
56
- resources :variants do
57
- resources :images
58
- end
49
+ resources :variants do
50
+ resources :images
51
+ end
59
52
 
60
- resources :option_types do
53
+ resources :option_types do
54
+ resources :option_values
55
+ end
61
56
  resources :option_values
62
- end
63
- resources :option_values
64
57
 
65
- resources :option_values, only: :index
58
+ resources :option_values, only: :index
66
59
 
67
- get '/orders/mine', to: 'orders#mine', as: 'my_orders'
68
- get "/orders/current", to: "orders#current", as: "current_order"
60
+ get '/orders/mine', to: 'orders#mine', as: 'my_orders'
61
+ get "/orders/current", to: "orders#current", as: "current_order"
69
62
 
70
- resources :orders, concerns: :order_routes
63
+ resources :orders, concerns: :order_routes
71
64
 
72
- resources :zones
73
- resources :countries, only: [:index, :show] do
74
- resources :states, only: [:index, :show]
75
- end
76
-
77
- resources :shipments, only: [:create, :update] do
78
- collection do
79
- post 'transfer_to_location'
80
- post 'transfer_to_shipment'
81
- get :mine
65
+ resources :zones
66
+ resources :countries, only: [:index, :show] do
67
+ resources :states, only: [:index, :show]
82
68
  end
83
69
 
84
- member do
85
- put :ready
86
- put :ship
87
- put :add
88
- put :remove
89
- end
90
- end
91
- resources :states, only: [:index, :show]
70
+ resources :shipments, only: [:create, :update] do
71
+ collection do
72
+ post 'transfer_to_location'
73
+ post 'transfer_to_shipment'
74
+ get :mine
75
+ end
92
76
 
93
- resources :taxonomies do
94
- member do
95
- get :jstree
77
+ member do
78
+ put :ready
79
+ put :ship
80
+ put :add
81
+ put :remove
82
+ end
96
83
  end
97
- resources :taxons do
84
+ resources :states, only: [:index, :show]
85
+
86
+ resources :taxonomies do
98
87
  member do
99
88
  get :jstree
100
89
  end
90
+ resources :taxons do
91
+ member do
92
+ get :jstree
93
+ end
94
+ end
101
95
  end
102
- end
103
96
 
104
- resources :taxons, only: [:index]
97
+ resources :taxons, only: [:index]
105
98
 
106
- resources :inventory_units, only: [:show, :update]
99
+ resources :inventory_units, only: [:show, :update]
107
100
 
108
- resources :users do
109
- resources :credit_cards, only: [:index]
110
- end
101
+ resources :users do
102
+ resources :credit_cards, only: [:index]
103
+ end
111
104
 
112
- resources :properties
113
- resources :stock_locations do
114
- resources :stock_movements
115
- resources :stock_items
116
- end
105
+ resources :properties
106
+ resources :stock_locations do
107
+ resources :stock_movements
108
+ resources :stock_items
109
+ end
117
110
 
118
- resources :stock_items, only: [:index, :update, :destroy]
119
- resources :stores
111
+ resources :stock_items, only: [:index, :update, :destroy]
112
+ resources :stores
113
+
114
+ put '/classifications', to: 'classifications#update', as: :classifications
115
+ get '/taxons/products', to: 'taxons#products', as: :taxon_products
116
+ end
120
117
 
121
- put '/classifications', to: 'classifications#update', as: :classifications
122
- get '/taxons/products', to: 'taxons#products', as: :taxon_products
118
+ match 'v:api/*path', to: redirect("/api/v1/%{path}"), via: [:get, :post, :put, :patch, :delete]
119
+ match '*path', to: redirect("/api/v1/%{path}"), via: [:get, :post, :put, :patch, :delete]
123
120
  end
124
121
  end