spree_api 3.1.14 → 3.2.0.rc1

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/app/controllers/spree/api/base_controller.rb +2 -2
  4. data/app/controllers/spree/api/v1/addresses_controller.rb +1 -1
  5. data/app/controllers/spree/api/v1/classifications_controller.rb +1 -1
  6. data/app/controllers/spree/api/v1/images_controller.rb +3 -0
  7. data/app/controllers/spree/api/v1/inventory_units_controller.rb +3 -3
  8. data/app/controllers/spree/api/v1/line_items_controller.rb +3 -0
  9. data/app/controllers/spree/api/v1/option_types_controller.rb +16 -7
  10. data/app/controllers/spree/api/v1/option_values_controller.rb +6 -3
  11. data/app/controllers/spree/api/v1/orders_controller.rb +13 -24
  12. data/app/controllers/spree/api/v1/payments_controller.rb +0 -1
  13. data/app/controllers/spree/api/v1/products_controller.rb +8 -5
  14. data/app/controllers/spree/api/v1/stock_items_controller.rb +1 -1
  15. data/app/controllers/spree/api/v1/stock_locations_controller.rb +1 -1
  16. data/app/controllers/spree/api/v1/tags_controller.rb +28 -0
  17. data/app/controllers/spree/api/v1/taxonomies_controller.rb +7 -4
  18. data/app/controllers/spree/api/v1/taxons_controller.rb +4 -1
  19. data/app/controllers/spree/api/v1/users_controller.rb +5 -3
  20. data/app/controllers/spree/api/v1/zones_controller.rb +3 -3
  21. data/app/helpers/spree/api/api_helpers.rb +4 -1
  22. data/app/models/spree/api_configuration.rb +1 -1
  23. data/app/views/spree/api/errors/invalid_api_key.v1.rabl +1 -1
  24. data/app/views/spree/api/errors/invalid_resource.v1.rabl +1 -1
  25. data/app/views/spree/api/errors/must_specify_api_key.v1.rabl +1 -1
  26. data/app/views/spree/api/errors/not_found.v1.rabl +1 -1
  27. data/app/views/spree/api/errors/unauthorized.v1.rabl +1 -1
  28. data/app/views/spree/api/v1/countries/show.v1.rabl +1 -1
  29. data/app/views/spree/api/v1/line_items/show.v1.rabl +2 -2
  30. data/app/views/spree/api/v1/option_types/show.v1.rabl +1 -1
  31. data/app/views/spree/api/v1/orders/invalid_shipping_method.v1.rabl +1 -1
  32. data/app/views/spree/api/v1/orders/payment.v1.rabl +1 -1
  33. data/app/views/spree/api/v1/orders/show.v1.rabl +9 -9
  34. data/app/views/spree/api/v1/payments/credit_over_limit.v1.rabl +1 -1
  35. data/app/views/spree/api/v1/payments/update_forbidden.v1.rabl +1 -1
  36. data/app/views/spree/api/v1/products/show.v1.rabl +5 -5
  37. data/app/views/spree/api/v1/shipments/cannot_ready_shipment.v1.rabl +1 -1
  38. data/app/views/spree/api/v1/shipments/show.v1.rabl +7 -7
  39. data/app/views/spree/api/v1/shipments/small.v1.rabl +8 -8
  40. data/app/views/spree/api/v1/tags/index.v1.rabl +9 -0
  41. data/app/views/spree/api/v1/taxonomies/jstree.rabl +2 -2
  42. data/app/views/spree/api/v1/taxonomies/nested.v1.rabl +2 -2
  43. data/app/views/spree/api/v1/taxons/jstree.rabl +3 -3
  44. data/app/views/spree/api/v1/taxons/show.v1.rabl +1 -1
  45. data/app/views/spree/api/v1/taxons/taxons.v1.rabl +1 -1
  46. data/app/views/spree/api/v1/users/show.v1.rabl +3 -2
  47. data/app/views/spree/api/v1/variants/big.v1.rabl +3 -3
  48. data/app/views/spree/api/v1/variants/small.v1.rabl +3 -2
  49. data/app/views/spree/api/v1/zones/show.v1.rabl +1 -1
  50. data/config/routes.rb +4 -6
  51. data/db/migrate/20100107141738_add_api_key_to_spree_users.rb +2 -2
  52. data/db/migrate/20120411123334_resize_api_key_field.rb +2 -2
  53. data/db/migrate/20120530054546_rename_api_key_to_spree_api_key.rb +1 -1
  54. data/db/migrate/20131017162334_add_index_to_user_spree_api_key.rb +1 -1
  55. data/lib/spree/api/engine.rb +11 -3
  56. data/lib/spree/api/responders/rabl_template.rb +1 -1
  57. data/lib/spree/api/testing_support/caching.rb +2 -2
  58. data/spec/controllers/spree/api/base_controller_spec.rb +96 -0
  59. data/spec/controllers/spree/api/v1/addresses_controller_spec.rb +56 -0
  60. data/spec/controllers/spree/api/v1/checkouts_controller_spec.rb +363 -0
  61. data/spec/controllers/spree/api/v1/classifications_controller_spec.rb +48 -0
  62. data/spec/controllers/spree/api/v1/countries_controller_spec.rb +48 -0
  63. data/spec/controllers/spree/api/v1/credit_cards_controller_spec.rb +80 -0
  64. data/spec/controllers/spree/api/v1/images_controller_spec.rb +114 -0
  65. data/spec/controllers/spree/api/v1/inventory_units_controller_spec.rb +48 -0
  66. data/spec/controllers/spree/api/v1/line_items_controller_spec.rb +203 -0
  67. data/spec/controllers/spree/api/v1/option_types_controller_spec.rb +122 -0
  68. data/spec/controllers/spree/api/v1/option_values_controller_spec.rb +141 -0
  69. data/spec/controllers/spree/api/v1/orders_controller_spec.rb +735 -0
  70. data/spec/controllers/spree/api/v1/payments_controller_spec.rb +234 -0
  71. data/spec/controllers/spree/api/v1/product_properties_controller_spec.rb +147 -0
  72. data/spec/controllers/spree/api/v1/products_controller_spec.rb +409 -0
  73. data/spec/controllers/spree/api/v1/promotion_application_spec.rb +50 -0
  74. data/spec/controllers/spree/api/v1/promotions_controller_spec.rb +64 -0
  75. data/spec/controllers/spree/api/v1/properties_controller_spec.rb +102 -0
  76. data/spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb +161 -0
  77. data/spec/controllers/spree/api/v1/shipments_controller_spec.rb +187 -0
  78. data/spec/controllers/spree/api/v1/states_controller_spec.rb +86 -0
  79. data/spec/controllers/spree/api/v1/stock_items_controller_spec.rb +143 -0
  80. data/spec/controllers/spree/api/v1/stock_locations_controller_spec.rb +113 -0
  81. data/spec/controllers/spree/api/v1/stock_movements_controller_spec.rb +84 -0
  82. data/spec/controllers/spree/api/v1/stores_controller_spec.rb +133 -0
  83. data/spec/controllers/spree/api/v1/tags_controller_spec.rb +102 -0
  84. data/spec/controllers/spree/api/v1/taxonomies_controller_spec.rb +114 -0
  85. data/spec/controllers/spree/api/v1/taxons_controller_spec.rb +177 -0
  86. data/spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb +26 -0
  87. data/spec/controllers/spree/api/v1/users_controller_spec.rb +153 -0
  88. data/spec/controllers/spree/api/v1/variants_controller_spec.rb +205 -0
  89. data/spec/controllers/spree/api/v1/zones_controller_spec.rb +91 -0
  90. data/spec/models/spree/legacy_user_spec.rb +19 -0
  91. data/spec/requests/rabl_cache_spec.rb +32 -0
  92. data/spec/requests/ransackable_attributes_spec.rb +79 -0
  93. data/spec/requests/version_spec.rb +19 -0
  94. data/spec/shared_examples/protect_product_actions.rb +17 -0
  95. data/spec/spec_helper.rb +60 -0
  96. data/spec/support/controller_hacks.rb +40 -0
  97. data/spec/support/database_cleaner.rb +14 -0
  98. data/spec/support/have_attributes_matcher.rb +13 -0
  99. data/spree_api.gemspec +7 -4
  100. metadata +99 -14
@@ -7,7 +7,7 @@ module Spree
7
7
  authorize! :create, Zone
8
8
  @zone = Zone.new(map_nested_attributes_keys(Spree::Zone, zone_params))
9
9
  if @zone.save
10
- respond_with(@zone, :status => 201, :default_template => :show)
10
+ respond_with(@zone, status: 201, default_template: :show)
11
11
  else
12
12
  invalid_resource!(@zone)
13
13
  end
@@ -16,7 +16,7 @@ module Spree
16
16
  def destroy
17
17
  authorize! :destroy, zone
18
18
  zone.destroy
19
- respond_with(zone, :status => 204)
19
+ respond_with(zone, status: 204)
20
20
  end
21
21
 
22
22
  def index
@@ -31,7 +31,7 @@ module Spree
31
31
  def update
32
32
  authorize! :update, zone
33
33
  if zone.update_attributes(map_nested_attributes_keys(Spree::Zone, zone_params))
34
- respond_with(zone, :status => 200, :default_template => :show)
34
+ respond_with(zone, status: 200, default_template: :show)
35
35
  else
36
36
  invalid_resource!(zone)
37
37
  end
@@ -29,7 +29,8 @@ module Spree
29
29
  :stock_movement_attributes,
30
30
  :stock_item_attributes,
31
31
  :promotion_attributes,
32
- :store_attributes
32
+ :store_attributes,
33
+ :tag_attributes
33
34
  ]
34
35
 
35
36
  mattr_reader *ATTRIBUTES
@@ -161,6 +162,8 @@ module Spree
161
162
  :mail_from_address, :default_currency, :code, :default
162
163
  ]
163
164
 
165
+ @@tag_attributes = [:id, :name]
166
+
164
167
  def variant_attributes
165
168
  if @current_user_roles && @current_user_roles.include?("admin")
166
169
  @@variant_attributes + [:cost_price]
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  class ApiConfiguration < Preferences::Configuration
3
- preference :requires_authentication, :boolean, :default => true
3
+ preference :requires_authentication, :boolean, default: true
4
4
  end
5
5
  end
@@ -1,2 +1,2 @@
1
1
  object false
2
- node(:error) { I18n.t(:invalid_api_key, :key => api_key, :scope => "spree.api") }
2
+ node(:error) { I18n.t(:invalid_api_key, key: api_key, scope: "spree.api") }
@@ -1,3 +1,3 @@
1
1
  object false
2
- node(:error) { I18n.t(:invalid_resource, :scope => "spree.api") }
2
+ node(:error) { I18n.t(:invalid_resource, scope: "spree.api") }
3
3
  node(:errors) { @resource.errors.to_hash }
@@ -1,2 +1,2 @@
1
1
  object false
2
- node(:error) { I18n.t(:must_specify_api_key, :scope => "spree.api") }
2
+ node(:error) { I18n.t(:must_specify_api_key, scope: "spree.api") }
@@ -1,2 +1,2 @@
1
1
  object false
2
- node(:error) { I18n.t(:resource_not_found, :scope => "spree.api") }
2
+ node(:error) { I18n.t(:resource_not_found, scope: "spree.api") }
@@ -1,2 +1,2 @@
1
1
  object false
2
- node(:error) { I18n.t(:unauthorized, :scope => "spree.api") }
2
+ node(:error) { I18n.t(:unauthorized, scope: "spree.api") }
@@ -1,5 +1,5 @@
1
1
  object @country
2
2
  attributes *country_attributes
3
- child :states => :states do
3
+ child states: :states do
4
4
  attributes :id, :name, :abbr, :country_id
5
5
  end
@@ -7,9 +7,9 @@ node(:total) { |li| li.total }
7
7
  child :variant do
8
8
  extends "spree/api/v1/variants/small"
9
9
  attributes :product_id
10
- child(:images => :images) { extends "spree/api/v1/images/show" }
10
+ child(images: :images) { extends "spree/api/v1/images/show" }
11
11
  end
12
12
 
13
- child :adjustments => :adjustments do
13
+ child adjustments: :adjustments do
14
14
  extends "spree/api/v1/adjustments/show"
15
15
  end
@@ -1,5 +1,5 @@
1
1
  object @option_type
2
2
  attributes *option_type_attributes
3
- child :option_values => :option_values do
3
+ child option_values: :option_values do
4
4
  attributes *option_value_attributes
5
5
  end
@@ -1,2 +1,2 @@
1
1
  object false
2
- node(:errors) { [I18n.t(:invalid_shipping_method, :scope => "spree.api.order")] }
2
+ node(:errors) { [I18n.t(:invalid_shipping_method, scope: "spree.api.order")] }
@@ -1,3 +1,3 @@
1
- child :available_payment_methods => :payment_methods do
1
+ child available_payment_methods: :payment_methods do
2
2
  attributes :id, :name, :method_type
3
3
  end
@@ -5,26 +5,26 @@ if lookup_context.find_all("spree/api/v1/orders/#{root_object.state}").present?
5
5
  extends "spree/api/v1/orders/#{root_object.state}"
6
6
  end
7
7
 
8
- child :billing_address => :bill_address do
8
+ child billing_address: :bill_address do
9
9
  extends "spree/api/v1/addresses/show"
10
10
  end
11
11
 
12
- child :shipping_address => :ship_address do
12
+ child shipping_address: :ship_address do
13
13
  extends "spree/api/v1/addresses/show"
14
14
  end
15
15
 
16
- child :line_items => :line_items do
16
+ child line_items: :line_items do
17
17
  extends "spree/api/v1/line_items/show"
18
18
  end
19
19
 
20
- child :payments => :payments do
20
+ child payments: :payments do
21
21
  attributes *payment_attributes
22
22
 
23
- child :payment_method => :payment_method do
23
+ child payment_method: :payment_method do
24
24
  attributes :id, :name
25
25
  end
26
26
 
27
- child :source => :source do
27
+ child source: :source do
28
28
  if @current_user_roles.include?('admin')
29
29
  attributes *payment_source_attributes + [:gateway_customer_profile_id, :gateway_payment_profile_id]
30
30
  else
@@ -33,11 +33,11 @@ child :payments => :payments do
33
33
  end
34
34
  end
35
35
 
36
- child :shipments => :shipments do
36
+ child shipments: :shipments do
37
37
  extends "spree/api/v1/shipments/small"
38
38
  end
39
39
 
40
- child :adjustments => :adjustments do
40
+ child adjustments: :adjustments do
41
41
  extends "spree/api/v1/adjustments/show"
42
42
  end
43
43
 
@@ -46,6 +46,6 @@ node :permissions do
46
46
  { can_update: current_ability.can?(:update, root_object) }
47
47
  end
48
48
 
49
- child :valid_credit_cards => :credit_cards do
49
+ child valid_credit_cards: :credit_cards do
50
50
  extends "spree/api/v1/credit_cards/show"
51
51
  end
@@ -1,2 +1,2 @@
1
1
  object false
2
- node(:error) { I18n.t(:credit_over_limit, :limit => @payment.credit_allowed, :scope => 'spree.api.payment') }
2
+ node(:error) { I18n.t(:credit_over_limit, limit: @payment.credit_allowed, scope: 'spree.api.payment') }
@@ -1,2 +1,2 @@
1
1
  object false
2
- node(:error) { I18n.t(:update_forbidden, :state => @payment.state, :scope => 'spree.api.payment') }
2
+ node(:error) { I18n.t(:update_forbidden, state: @payment.state, scope: 'spree.api.payment') }
@@ -7,23 +7,23 @@ node(:display_price) { |p| p.display_price.to_s }
7
7
  node(:has_variants) { |p| p.has_variants? }
8
8
  node(:taxon_ids) { |p| p.taxon_ids }
9
9
 
10
- child :master => :master do
10
+ child master: :master do
11
11
  extends "spree/api/v1/variants/small"
12
12
  end
13
13
 
14
- child :variants => :variants do
14
+ child variants: :variants do
15
15
  extends "spree/api/v1/variants/small"
16
16
  end
17
17
 
18
- child :option_types => :option_types do
18
+ child option_types: :option_types do
19
19
  attributes *option_type_attributes
20
20
  end
21
21
 
22
- child :product_properties => :product_properties do
22
+ child product_properties: :product_properties do
23
23
  attributes *product_property_attributes
24
24
  end
25
25
 
26
- child :classifications => :classifications do
26
+ child classifications: :classifications do
27
27
  attributes :taxon_id, :position
28
28
 
29
29
  child(:taxon) do
@@ -1,2 +1,2 @@
1
1
  object false
2
- node(:error) { I18n.t(:cannot_ready, :scope => "spree.api.shipment") }
2
+ node(:error) { I18n.t(:cannot_ready, scope: "spree.api.shipment") }
@@ -4,27 +4,27 @@ attributes *shipment_attributes
4
4
  node(:order_id) { |shipment| shipment.order.number }
5
5
  node(:stock_location_name) { |shipment| shipment.stock_location.name }
6
6
 
7
- child :shipping_rates => :shipping_rates do
7
+ child shipping_rates: :shipping_rates do
8
8
  extends "spree/api/v1/shipping_rates/show"
9
9
  end
10
10
 
11
- child :selected_shipping_rate => :selected_shipping_rate do
11
+ child selected_shipping_rate: :selected_shipping_rate do
12
12
  extends "spree/api/v1/shipping_rates/show"
13
13
  end
14
14
 
15
- child :shipping_methods => :shipping_methods do
15
+ child shipping_methods: :shipping_methods do
16
16
  attributes :id, :name
17
- child :zones => :zones do
17
+ child zones: :zones do
18
18
  attributes :id, :name, :description
19
19
  end
20
20
 
21
- child :shipping_categories => :shipping_categories do
21
+ child shipping_categories: :shipping_categories do
22
22
  attributes :id, :name
23
23
  end
24
24
  end
25
25
 
26
- child :manifest => :manifest do
27
- child :variant => :variant do
26
+ child manifest: :manifest do
27
+ child variant: :variant do
28
28
  extends "spree/api/v1/variants/small"
29
29
  end
30
30
  node(:quantity) { |m| m.quantity }
@@ -5,33 +5,33 @@ attributes *shipment_attributes
5
5
  node(:order_id) { |shipment| shipment.order.number }
6
6
  node(:stock_location_name) { |shipment| shipment.stock_location.name }
7
7
 
8
- child :shipping_rates => :shipping_rates do
8
+ child shipping_rates: :shipping_rates do
9
9
  extends "spree/api/v1/shipping_rates/show"
10
10
  end
11
11
 
12
- child :selected_shipping_rate => :selected_shipping_rate do
12
+ child selected_shipping_rate: :selected_shipping_rate do
13
13
  extends "spree/api/v1/shipping_rates/show"
14
14
  end
15
15
 
16
- child :shipping_methods => :shipping_methods do
16
+ child shipping_methods: :shipping_methods do
17
17
  attributes :id, :code, :name
18
- child :zones => :zones do
18
+ child zones: :zones do
19
19
  attributes :id, :name, :description
20
20
  end
21
21
 
22
- child :shipping_categories => :shipping_categories do
22
+ child shipping_categories: :shipping_categories do
23
23
  attributes :id, :name
24
24
  end
25
25
  end
26
26
 
27
- child :manifest => :manifest do
27
+ child manifest: :manifest do
28
28
  glue(:variant) do
29
- attribute :id => :variant_id
29
+ attribute id: :variant_id
30
30
  end
31
31
  node(:quantity) { |m| m.quantity }
32
32
  node(:states) { |m| m.states }
33
33
  end
34
34
 
35
- child :adjustments => :adjustments do
35
+ child adjustments: :adjustments do
36
36
  extends "spree/api/v1/adjustments/show"
37
37
  end
@@ -0,0 +1,9 @@
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,8 +1,8 @@
1
1
  object false
2
2
  node(:data) { @taxonomy.root.name }
3
3
  node(:attr) do
4
- { :id => @taxonomy.root.id,
5
- :name => @taxonomy.root.name
4
+ { id: @taxonomy.root.id,
5
+ name: @taxonomy.root.name
6
6
  }
7
7
  end
8
8
  node(:state) { "closed" }
@@ -1,9 +1,9 @@
1
1
  attributes *taxonomy_attributes
2
2
 
3
- child :root => :root do
3
+ child root: :root do
4
4
  attributes *taxon_attributes
5
5
 
6
- child :children => :taxons do
6
+ child children: :taxons do
7
7
  attributes *taxon_attributes
8
8
 
9
9
  extends "spree/api/v1/taxons/taxons"
@@ -1,8 +1,8 @@
1
- collection @taxon.children, :object_root => false
1
+ collection @taxon.children, object_root: false
2
2
  node(:data) { |taxon| taxon.name }
3
3
  node(:attr) do |taxon|
4
- { :id => taxon.id,
5
- :name => taxon.name
4
+ { id: taxon.id,
5
+ name: taxon.name
6
6
  }
7
7
  end
8
8
  node(:state) { "closed" }
@@ -1,6 +1,6 @@
1
1
  object @taxon
2
2
  attributes *taxon_attributes
3
3
 
4
- child :children => :taxons do
4
+ child children: :taxons do
5
5
  attributes *taxon_attributes
6
6
  end
@@ -1,5 +1,5 @@
1
1
  attributes *taxon_attributes
2
2
 
3
3
  node :taxons do |t|
4
- t.children.map { |c| partial("spree/api/v1/taxons/taxons", :object => c) }
4
+ t.children.map { |c| partial("spree/api/v1/taxons/taxons", object: c) }
5
5
  end
@@ -1,10 +1,11 @@
1
1
  object @user
2
+ cache [I18n.locale, root_object]
2
3
 
3
4
  attributes *user_attributes
4
- child(:bill_address => :bill_address) do
5
+ child(bill_address: :bill_address) do
5
6
  extends "spree/api/v1/addresses/show"
6
7
  end
7
8
 
8
- child(:ship_address => :ship_address) do
9
+ child(ship_address: :ship_address) do
9
10
  extends "spree/api/v1/addresses/show"
10
11
  end
@@ -4,11 +4,11 @@ cache [I18n.locale, @current_user_roles.include?('admin'), 'big_variant', root_o
4
4
 
5
5
  extends "spree/api/v1/variants/small"
6
6
 
7
- child(:stock_items => :stock_items) do
7
+ child(stock_items: :stock_items) do
8
8
  attributes :id, :count_on_hand, :stock_location_id, :backorderable
9
- attribute :available? => :available
9
+ attribute available?: :available
10
10
 
11
11
  glue(:stock_location) do
12
- attribute :name => :stock_location_name
12
+ attribute name: :stock_location_name
13
13
  end
14
14
  end
@@ -7,11 +7,12 @@ node(:options_text) { |v| v.options_text }
7
7
  node(:track_inventory) { |v| v.should_track_inventory? }
8
8
  node(:in_stock) { |v| v.in_stock? }
9
9
  node(:is_backorderable) { |v| v.is_backorderable? }
10
+ node(:is_orderable) { |v| v.is_backorderable? || v.in_stock? }
10
11
  node(:total_on_hand) { |v| v.total_on_hand }
11
12
  node(:is_destroyed) { |v| v.destroyed? }
12
13
 
13
- child :option_values => :option_values do
14
+ child option_values: :option_values do
14
15
  attributes *option_value_attributes
15
16
  end
16
17
 
17
- child(:images => :images) { extends "spree/api/v1/images/show" }
18
+ child(images: :images) { extends "spree/api/v1/images/show" }
@@ -1,6 +1,6 @@
1
1
  object @zone
2
2
  attributes :id, :name, :description
3
3
 
4
- child :zone_members => :zone_members do
4
+ child zone_members: :zone_members do
5
5
  attributes :id, :name, :zoneable_type, :zoneable_id
6
6
  end
data/config/routes.rb CHANGED
@@ -111,18 +111,16 @@ Spree::Core::Engine.add_routes do
111
111
  resources :stock_items, only: [:index, :update, :destroy]
112
112
  resources :stores
113
113
 
114
+ resources :tags, only: :index
115
+
114
116
  put '/classifications', to: 'classifications#update', as: :classifications
115
117
  get '/taxons/products', to: 'taxons#products', as: :taxon_products
116
118
  end
117
119
 
118
- spree_path = Rails.application.routes.url_helpers.try(:spree_path, trailing_slash: true) || '/'
119
- match 'v:api/*path', to: redirect("#{spree_path}api/v1/%{path}"), via: [:get, :post, :put, :patch, :delete]
120
+ match 'v:api/*path', to: redirect("/api/v1/%{path}"), via: [:get, :post, :put, :patch, :delete]
120
121
 
121
122
  match '*path', to: redirect{ |params, request|
122
- format = ".#{params[:format]}" unless params[:format].blank?
123
- query = "?#{request.query_string}" unless request.query_string.blank?
124
-
125
- "#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
123
+ "/api/v1/#{params[:path]}?#{request.query_string}"
126
124
  }, via: [:get, :post, :put, :patch, :delete]
127
125
  end
128
126
  end