spree_api 1.3.5 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +14 -6
  2. data/Rakefile +1 -1
  3. data/app/controllers/spree/api/addresses_controller.rb +0 -1
  4. data/app/controllers/spree/api/base_controller.rb +21 -9
  5. data/app/controllers/spree/api/checkouts_controller.rb +40 -20
  6. data/app/controllers/spree/api/countries_controller.rb +0 -1
  7. data/app/controllers/spree/api/inventory_units_controller.rb +1 -1
  8. data/app/controllers/spree/api/option_types_controller.rb +46 -0
  9. data/app/controllers/spree/api/option_values_controller.rb +56 -0
  10. data/app/controllers/spree/api/orders_controller.rb +1 -21
  11. data/app/controllers/spree/api/product_properties_controller.rb +0 -1
  12. data/app/controllers/spree/api/products_controller.rb +12 -27
  13. data/app/controllers/spree/api/properties_controller.rb +61 -0
  14. data/app/controllers/spree/api/shipments_controller.rb +51 -1
  15. data/app/controllers/spree/api/states_controller.rb +32 -0
  16. data/app/controllers/spree/api/stock_items_controller.rb +70 -0
  17. data/app/controllers/spree/api/stock_locations_controller.rb +45 -0
  18. data/app/controllers/spree/api/stock_movements_controller.rb +55 -0
  19. data/app/controllers/spree/api/taxonomies_controller.rb +5 -0
  20. data/app/controllers/spree/api/taxons_controller.rb +16 -2
  21. data/app/controllers/spree/api/variants_controller.rb +1 -1
  22. data/app/controllers/spree/api/zones_controller.rb +0 -1
  23. data/app/helpers/spree/api/api_helpers.rb +34 -7
  24. data/app/models/spree/api_configuration.rb +1 -2
  25. data/app/models/spree/line_item_decorator.rb +1 -1
  26. data/app/models/spree/order_decorator.rb +6 -169
  27. data/app/overrides/api_admin_user_edit_form.rb +7 -6
  28. data/app/views/spree/admin/users/_api_fields.html.erb +7 -8
  29. data/app/views/spree/api/addresses/show.v1.rabl +2 -2
  30. data/app/views/spree/api/adjustments/show.v1.rabl +2 -0
  31. data/app/views/spree/api/credit_cards/show.v1.rabl +2 -0
  32. data/app/views/spree/api/option_types/index.v1.rabl +3 -0
  33. data/app/views/spree/api/option_types/show.v1.rabl +5 -0
  34. data/app/views/spree/api/option_values/index.v1.rabl +3 -0
  35. data/app/views/spree/api/option_values/show.v1.rabl +2 -0
  36. data/app/views/spree/api/orders/could_not_apply_coupon.v1.rabl +2 -0
  37. data/app/views/spree/api/orders/delivery.v1.rabl +2 -2
  38. data/app/views/spree/api/orders/payment.v1.rabl +3 -0
  39. data/app/views/spree/api/orders/show.v1.rabl +8 -0
  40. data/app/views/spree/api/properties/index.v1.rabl +7 -0
  41. data/app/views/spree/api/properties/new.v1.rabl +2 -0
  42. data/app/views/spree/api/properties/show.v1.rabl +2 -0
  43. data/app/views/spree/api/shared/stock_location_required.v1.rabl +2 -0
  44. data/app/views/spree/api/shipments/show.v1.rabl +7 -0
  45. data/app/views/spree/api/states/index.v1.rabl +14 -0
  46. data/app/views/spree/api/states/show.v1.rabl +2 -0
  47. data/app/views/spree/api/stock_items/index.v1.rabl +7 -0
  48. data/app/views/spree/api/stock_items/show.v1.rabl +5 -0
  49. data/app/views/spree/api/stock_locations/index.v1.rabl +7 -0
  50. data/app/views/spree/api/stock_locations/show.v1.rabl +8 -0
  51. data/app/views/spree/api/stock_movements/index.v1.rabl +7 -0
  52. data/app/views/spree/api/stock_movements/show.v1.rabl +5 -0
  53. data/app/views/spree/api/taxonomies/jstree.rabl +8 -0
  54. data/app/views/spree/api/taxons/jstree.rabl +8 -0
  55. data/app/views/spree/api/variants/index.v1.rabl +14 -1
  56. data/app/views/spree/api/variants/variant.v1.rabl +0 -4
  57. data/config/locales/en.yml +1 -0
  58. data/config/routes.rb +29 -3
  59. data/lib/spree/api.rb +0 -2
  60. data/lib/spree/api/controller_setup.rb +6 -1
  61. data/lib/spree/api/testing_support/helpers.rb +1 -1
  62. data/lib/spree/api/testing_support/setup.rb +13 -0
  63. data/spec/controllers/spree/api/base_controller_spec.rb +14 -1
  64. data/spec/controllers/spree/api/checkouts_controller_spec.rb +59 -28
  65. data/spec/controllers/spree/api/line_items_controller_spec.rb +1 -5
  66. data/spec/controllers/spree/api/option_types_controller_spec.rb +116 -0
  67. data/spec/controllers/spree/api/option_values_controller_spec.rb +128 -0
  68. data/spec/controllers/spree/api/orders_controller_spec.rb +11 -93
  69. data/spec/controllers/spree/api/product_properties_controller_spec.rb +2 -2
  70. data/spec/controllers/spree/api/products_controller_spec.rb +18 -76
  71. data/spec/controllers/spree/api/properties_controller_spec.rb +89 -0
  72. data/spec/controllers/spree/api/return_authorizations_controller_spec.rb +1 -9
  73. data/spec/controllers/spree/api/shipments_controller_spec.rb +80 -5
  74. data/spec/controllers/spree/api/states_controller_spec.rb +76 -0
  75. data/spec/controllers/spree/api/stock_items_controller_spec.rb +88 -0
  76. data/spec/controllers/spree/api/stock_locations_controller_spec.rb +86 -0
  77. data/spec/controllers/spree/api/stock_movements_controller_spec.rb +72 -0
  78. data/spec/controllers/spree/api/taxonomies_controller_spec.rb +7 -0
  79. data/spec/controllers/spree/api/taxons_controller_spec.rb +29 -2
  80. data/spec/controllers/spree/api/unauthenticated_products_controller_spec.rb +1 -1
  81. data/spec/controllers/spree/api/variants_controller_spec.rb +5 -16
  82. data/spec/fixtures/thinking-cat.jpg +0 -0
  83. data/spec/models/spree/order_spec.rb +7 -328
  84. data/spec/spec_helper.rb +18 -2
  85. data/spree_api.gemspec +2 -1
  86. metadata +67 -16
  87. data/.rspec +0 -1
  88. data/app/controllers/spree/base_controller_decorator.rb +0 -15
  89. data/app/overrides/api_key_spree_layout.rb +0 -7
  90. data/app/views/spree/api/_key.html.erb +0 -4
  91. data/db/migrate/20131017162334_add_index_to_user_spree_api_key.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f36fa5b9ac229e7e973c1c724fda3cf3e9cd50ad
4
- data.tar.gz: 78a1596cc6c1ed5014fc22c65319c431cb6a08de
5
- SHA512:
6
- metadata.gz: ab336cf7a3b2b2c56070dd047fd1844c3abf8051431c8171d078534289f8274e323a9c6f85eae06132bf6427effc5fa67762b4c071660da4e7d02b552a2fc916
7
- data.tar.gz: ec3c418cb4b1b6351d8cc879d27acab755e8c45f62900150203c8a6d7d8854507cc3199c63c210c47ee400553354556050c4aca371db63b3087f9f52a3d4aca7
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWE5YWU1MDZmMjkwNjViNmI0NWNhYmYxMzRhYzgxNjU2NmJmMzkzYw==
5
+ data.tar.gz: !binary |-
6
+ ODliMjc0ZjAyMDhhZjkyYTUwMGU5MGM1MDMzYjA3Yjk2OGJjNTE1NQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MzkzYzE5N2M3MDgyODdhNDcyMzdjMmRmMDkyYzZhZTczYjFhMTZmZjE2NDBm
10
+ MWQ4NDIzODE3NzBmMDAyZjE4NzQ0NTY4YmU4MzdkNGJkNTAyMWM2YjIzYWEy
11
+ NmNhYzU0MmE0NzYyNDk2NGZkMjBiZjQwYTQxMGMxYzEyOGNkYjk=
12
+ data.tar.gz: !binary |-
13
+ ZjNhMGJiNzg0ZDIwYzgxMzcxYTkwZDdjMTQwYmU0NDMzYWVhMzNlYzE4NWQx
14
+ ZGMwODE3ZTA2NTRjMWM0Yjc1NDIzMjNkMTI0ZDEwYWFlNDg2YjA5MjM3NTE0
15
+ ZDU0MDA1M2IyODVkMGQyNmJmY2YyYWIwNjViMWVkMTA4NWYxNmY=
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/testtask'
4
4
  require 'rake/packagetask'
5
5
  require 'rubygems/package_task'
6
6
  require 'rspec/core/rake_task'
7
- require 'spree/core/testing_support/common_rake'
7
+ require 'spree/testing_support/common_rake'
8
8
  require 'rails/all'
9
9
 
10
10
  Bundler::GemHelper.install_tasks
@@ -1,7 +1,6 @@
1
1
  module Spree
2
2
  module Api
3
3
  class AddressesController < Spree::Api::BaseController
4
- respond_to :json
5
4
 
6
5
  def show
7
6
  @address = Address.find(params[:id])
@@ -1,15 +1,20 @@
1
+ require_dependency 'spree/api/controller_setup'
2
+
1
3
  module Spree
2
4
  module Api
3
5
  class BaseController < ActionController::Metal
4
6
  include Spree::Api::ControllerSetup
7
+ include Spree::Core::ControllerHelpers::SSL
5
8
  include ::ActionController::Head
6
9
 
7
10
  self.responder = Spree::Api::Responders::AppResponder
8
11
 
12
+ respond_to :json
13
+
9
14
  attr_accessor :current_api_user
10
15
 
11
16
  before_filter :set_content_type
12
- before_filter :check_for_api_key, :if => :requires_authentication?
17
+ before_filter :check_for_user_or_api_key, :if => :requires_authentication?
13
18
  before_filter :authenticate_user
14
19
  after_filter :set_jsonp_format
15
20
 
@@ -49,18 +54,25 @@ module Spree
49
54
  headers["Content-Type"] = content_type
50
55
  end
51
56
 
52
- def check_for_api_key
53
- render "spree/api/errors/must_specify_api_key", :status => 401 and return if api_key.blank?
57
+ def check_for_user_or_api_key
58
+ # User is already authenticated with Spree, make request this way instead.
59
+ return true if @current_api_user = try_spree_current_user || !Spree::Api::Config[:requires_authentication]
60
+
61
+ if api_key.blank?
62
+ render "spree/api/errors/must_specify_api_key", :status => 401 and return
63
+ end
54
64
  end
55
65
 
56
66
  def authenticate_user
57
- if requires_authentication? || api_key.present?
58
- unless @current_api_user = Spree.user_class.find_by_spree_api_key(api_key.to_s)
59
- render "spree/api/errors/invalid_api_key", :status => 401 and return
67
+ unless @current_api_user
68
+ if requires_authentication? || api_key.present?
69
+ unless @current_api_user = Spree.user_class.find_by_spree_api_key(api_key.to_s)
70
+ render "spree/api/errors/invalid_api_key", :status => 401 and return
71
+ end
72
+ else
73
+ # An anonymous user
74
+ @current_api_user = Spree.user_class.new
60
75
  end
61
- else
62
- # Effectively, an anonymous user
63
- @current_api_user = Spree.user_class.new
64
76
  end
65
77
  end
66
78
 
@@ -1,17 +1,11 @@
1
1
  module Spree
2
2
  module Api
3
3
  class CheckoutsController < Spree::Api::BaseController
4
- before_filter :load_order, :only => :update
4
+ before_filter :load_order, :only => [:update, :next]
5
5
  before_filter :associate_user, :only => :update
6
6
 
7
- # Spree::Core::ControllerHelpers::Auth overrides
8
- # Spree::Api::BaseController's unauthorized method...
9
- # Which is not a good thing.
10
- # Here's a small hack to shuffle around the method.
11
- alias_method :real_unauthorized, :unauthorized
12
7
  include Spree::Core::ControllerHelpers::Auth
13
8
  include Spree::Core::ControllerHelpers::Order
14
- alias_method :unauthorized, :real_unauthorized
15
9
 
16
10
  respond_to :json
17
11
 
@@ -21,22 +15,28 @@ module Spree
21
15
  end
22
16
 
23
17
  def update
24
- authorize! :update, @order, params[:order_token]
25
- respond_with(@order, :default_template => 'spree/api/orders/show') and return if @order.state == "complete"
26
-
27
- if object_params && object_params[:user_id].present?
28
- @order.update_attribute(:user_id, object_params[:user_id])
29
- object_params.delete(:user_id)
30
- end
31
-
32
- if @order.update_attributes(object_params) && @order.next
33
- state_callback(:after)
18
+ user_id = object_params.delete(:user_id)
19
+ if @order.update_attributes(object_params)
20
+ # TODO: Replace with better code when we switch to strong_parameters
21
+ # Also remove above user_id stripping
22
+ if current_api_user.has_spree_role?("admin") && user_id.present?
23
+ @order.associate_user!(Spree.user_class.find(user_id))
24
+ end
25
+ return if after_update_attributes
26
+ state_callback(:after) if @order.next
34
27
  respond_with(@order, :default_template => 'spree/api/orders/show')
35
28
  else
36
- respond_with(@order, :default_template => 'spree/api/orders/could_not_transition', :status => 422)
29
+ invalid_resource!(@order)
37
30
  end
38
31
  end
39
32
 
33
+ def next
34
+ @order.next!
35
+ respond_with(@order, :default_template => 'spree/api/orders/show', :status => 200)
36
+ rescue StateMachine::InvalidTransition
37
+ respond_with(@order, :default_template => 'spree/api/orders/could_not_transition', :status => 422)
38
+ end
39
+
40
40
  private
41
41
 
42
42
  def object_params
@@ -50,7 +50,7 @@ module Spree
50
50
  params[:order][:payments_attributes].first[:amount] = @order.total
51
51
  end
52
52
  end
53
- params[:order]
53
+ params[:order] || {}
54
54
  end
55
55
 
56
56
  def nested_params
@@ -70,6 +70,14 @@ module Spree
70
70
  state_callback(:before)
71
71
  end
72
72
 
73
+ def current_currency
74
+ Spree::Config[:currency]
75
+ end
76
+
77
+ def ip_address
78
+ ''
79
+ end
80
+
73
81
  def raise_insufficient_quantity
74
82
  respond_with(@order, :default_template => 'spree/api/orders/insufficient_quantity')
75
83
  end
@@ -86,7 +94,7 @@ module Spree
86
94
 
87
95
  def before_delivery
88
96
  return if params[:order].present?
89
- @order.shipping_method ||= (@order.rate_hash.first && @order.rate_hash.first[:shipping_method])
97
+ @order.create_proposed_shipments
90
98
  end
91
99
 
92
100
  def before_payment
@@ -100,6 +108,18 @@ module Spree
100
108
  render 'spree/api/orders/could_not_transition', :status => 422
101
109
  end
102
110
  end
111
+
112
+ def after_update_attributes
113
+ if object_params && object_params[:coupon_code].present?
114
+ coupon_result = Spree::Promo::CouponApplicator.new(@order).apply
115
+ if !coupon_result[:coupon_applied?]
116
+ @coupon_message = coupon_result[:error]
117
+ respond_with(@order, :default_template => 'spree/api/orders/could_not_apply_coupon')
118
+ return true
119
+ end
120
+ end
121
+ false
122
+ end
103
123
  end
104
124
  end
105
125
  end
@@ -1,7 +1,6 @@
1
1
  module Spree
2
2
  module Api
3
3
  class CountriesController < Spree::Api::BaseController
4
- respond_to :json
5
4
 
6
5
  def index
7
6
  @countries = Country.ransack(params[:q]).result.
@@ -34,7 +34,7 @@ module Spree
34
34
  unless inventory_unit.respond_to?(can_event) &&
35
35
  inventory_unit.send(can_event)
36
36
  render :text => { :exception => "cannot transition to #{@event}" }.to_json,
37
- :status => 200
37
+ :status => 200
38
38
  false
39
39
  end
40
40
  end
@@ -0,0 +1,46 @@
1
+ module Spree
2
+ module Api
3
+ class OptionTypesController < Spree::Api::BaseController
4
+ def index
5
+ if params[:ids]
6
+ @option_types = Spree::OptionType.where(:id => params[:ids].split(','))
7
+ else
8
+ @option_types = Spree::OptionType.scoped.ransack(params[:q]).result
9
+ end
10
+ respond_with(@option_types)
11
+ end
12
+
13
+ def show
14
+ @option_type = Spree::OptionType.find(params[:id])
15
+ respond_with(@option_type)
16
+ end
17
+
18
+ def create
19
+ authorize! :create, Spree::OptionType
20
+ @option_type = Spree::OptionType.new(params[:option_type])
21
+ if @option_type.save
22
+ render :show, :status => 201
23
+ else
24
+ invalid_resource!(@option_type)
25
+ end
26
+ end
27
+
28
+ def update
29
+ authorize! :update, Spree::OptionType
30
+ @option_type = Spree::OptionType.find(params[:id])
31
+ if @option_type.update_attributes(params[:option_type])
32
+ render :show
33
+ else
34
+ invalid_resource!(@option_type)
35
+ end
36
+ end
37
+
38
+ def destroy
39
+ authorize! :destroy, Spree::OptionType
40
+ @option_type = Spree::OptionType.find(params[:id])
41
+ @option_type.destroy
42
+ render :text => nil, :status => 204
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,56 @@
1
+ module Spree
2
+ module Api
3
+ class OptionValuesController < Spree::Api::BaseController
4
+ def index
5
+ if params[:ids]
6
+ @option_values = scope.where(:id => params[:ids])
7
+ else
8
+ @option_values = scope.ransack(params[:q]).result
9
+ end
10
+ respond_with(@option_values)
11
+ end
12
+
13
+ def show
14
+ @option_value = scope.find(params[:id])
15
+ respond_with(@option_value)
16
+ end
17
+
18
+ def create
19
+ authorize! :create, Spree::OptionValue
20
+ @option_value = scope.new(params[:option_value])
21
+ if @option_value.save
22
+ render :show, :status => 201
23
+ else
24
+ invalid_resource!(@option_value)
25
+ end
26
+ end
27
+
28
+ def update
29
+ authorize! :update, Spree::OptionValue
30
+ @option_value = scope.find(params[:id])
31
+ if @option_value.update_attributes(params[:option_value])
32
+ render :show
33
+ else
34
+ invalid_resource!(@option_value)
35
+ end
36
+ end
37
+
38
+ def destroy
39
+ authorize! :destroy, Spree::OptionValue
40
+ @option_value = scope.find(params[:id])
41
+ @option_value.destroy
42
+ render :text => nil, :status => 204
43
+ end
44
+
45
+ private
46
+
47
+ def scope
48
+ if params[:option_type_id]
49
+ @scope ||= Spree::OptionType.find(params[:option_type_id]).option_values
50
+ else
51
+ @scope ||= Spree::OptionValue.scoped
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -17,17 +17,12 @@ module Spree
17
17
  end
18
18
 
19
19
  def create
20
- nested_params[:line_items_attributes] = sanitize_line_items(nested_params[:line_items_attributes])
21
20
  @order = Order.build_from_api(current_api_user, nested_params)
22
21
  respond_with(order, :default_template => :show, :status => 201)
23
22
  end
24
23
 
25
24
  def update
26
25
  authorize! :update, Order
27
- # Parsing line items through as an update_attributes call in the API will result in
28
- # many line items for the same variant_id being created. We must be smarter about this,
29
- # hence the use of the update_line_items method, defined within order_decorator.rb.
30
- nested_params[:line_items_attributes] = sanitize_line_items(nested_params[:line_items_attributes])
31
26
  if order.update_attributes(nested_params)
32
27
  order.update!
33
28
  respond_with(order, :default_template => :show)
@@ -50,22 +45,7 @@ module Spree
50
45
  private
51
46
 
52
47
  def nested_params
53
- @nested_params ||= map_nested_attributes_keys(Order, params[:order] || {})
54
- end
55
-
56
- def sanitize_line_items(line_item_attributes)
57
- return {} if line_item_attributes.blank?
58
- line_item_attributes = line_item_attributes.map do |id, attributes|
59
- attributes ||= id
60
-
61
- # Faux Strong-Parameters code to strip price if user isn't an admin
62
- if current_api_user.has_spree_role?("admin")
63
- [id, attributes.slice(*Spree::LineItem.attr_accessible[:api])]
64
- else
65
- [id, attributes.slice(*Spree::LineItem.attr_accessible[:default])]
66
- end
67
- end
68
- line_item_attributes = Hash[line_item_attributes].delete_if { |k,v| v.empty? }
48
+ map_nested_attributes_keys Order, params[:order] || {}
69
49
  end
70
50
 
71
51
  def order
@@ -47,7 +47,6 @@ module Spree
47
47
  else
48
48
  invalid_resource!(@product_property)
49
49
  end
50
-
51
50
  end
52
51
 
53
52
  private
@@ -4,7 +4,14 @@ module Spree
4
4
  respond_to :json
5
5
 
6
6
  def index
7
- @products = product_scope.ransack(params[:q]).result.page(params[:page]).per(params[:per_page])
7
+ if params[:ids]
8
+ @products = product_scope.where(:id => params[:ids])
9
+ else
10
+ @products = product_scope.ransack(params[:q]).result
11
+ end
12
+
13
+ @products = @products.page(params[:page]).per(params[:per_page])
14
+
8
15
  respond_with(@products)
9
16
  end
10
17
 
@@ -19,33 +26,11 @@ module Spree
19
26
  def create
20
27
  authorize! :create, Product
21
28
  params[:product][:available_on] ||= Time.now
22
-
23
- variants_attributes = params[:product].delete(:variants_attributes) || []
24
- option_type_attributes = params[:product].delete(:option_types) || []
25
-
26
29
  @product = Product.new(params[:product])
27
- begin
28
- if @product.save
29
- variants_attributes.each do |variant_attribute|
30
- variant = @product.variants.new
31
- variant.update_attributes(variant_attribute)
32
- end
33
-
34
- option_type_attributes.each do |name|
35
- option_type = OptionType.where(name: name).first_or_initialize do |option_type|
36
- option_type.presentation = name
37
- option_type.save!
38
- end
39
-
40
- @product.option_types << option_type unless @product.option_types.include?(option_type)
41
- end
42
-
43
- respond_with(@product, :status => 201, :default_template => :show)
44
- else
45
- invalid_resource!(@product)
46
- end
47
- rescue ActiveRecord::RecordNotUnique
48
- retry
30
+ if @product.save
31
+ respond_with(@product, :status => 201, :default_template => :show)
32
+ else
33
+ invalid_resource!(@product)
49
34
  end
50
35
  end
51
36
 
@@ -0,0 +1,61 @@
1
+ module Spree
2
+ module Api
3
+ class PropertiesController < Spree::Api::BaseController
4
+ respond_to :json
5
+
6
+ before_filter :find_property, :only => [:show, :update, :destroy]
7
+
8
+ def index
9
+ @properties = Spree::Property.
10
+ ransack(params[:q]).result.
11
+ page(params[:page]).per(params[:per_page])
12
+ respond_with(@properties)
13
+ end
14
+
15
+ def show
16
+ respond_with(@property)
17
+ end
18
+
19
+ def new
20
+ end
21
+
22
+ def create
23
+ authorize! :create, Property
24
+ @property = Spree::Property.new(params[:property])
25
+ if @property.save
26
+ respond_with(@property, :status => 201, :default_template => :show)
27
+ else
28
+ invalid_resource!(@property)
29
+ end
30
+ end
31
+
32
+ def update
33
+ authorize! :update, Property
34
+ if @property && @property.update_attributes(params[:property])
35
+ respond_with(@property, :status => 200, :default_template => :show)
36
+ else
37
+ invalid_resource!(@property)
38
+ end
39
+ end
40
+
41
+ def destroy
42
+ authorize! :delete, Property
43
+ if(@property)
44
+ @property.destroy
45
+ respond_with(@property, :status => 204)
46
+ else
47
+ invalid_resource!(@property)
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def find_property
54
+ @property = Spree::Property.find(params[:id])
55
+ rescue ActiveRecord::RecordNotFound
56
+ @property = Spree::Property.find_by_name!(params[:id])
57
+ end
58
+
59
+ end
60
+ end
61
+ end