spree_api 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/app/controllers/spree/api/addresses_controller.rb +6 -2
  3. data/app/controllers/spree/api/base_controller.rb +2 -0
  4. data/app/controllers/spree/api/checkouts_controller.rb +12 -4
  5. data/app/controllers/spree/api/line_items_controller.rb +1 -1
  6. data/app/controllers/spree/api/orders_controller.rb +1 -1
  7. data/app/controllers/spree/api/taxons_controller.rb +10 -0
  8. data/app/controllers/spree/api/variants_controller.rb +1 -1
  9. data/app/controllers/spree/base_controller_decorator.rb +15 -0
  10. data/app/models/spree/order_decorator.rb +0 -2
  11. data/app/overrides/api_key_spree_layout.rb +6 -0
  12. data/app/views/spree/api/_key.html.erb +4 -0
  13. data/app/views/spree/api/line_items/show.v1.rabl +2 -0
  14. data/app/views/spree/api/orders/payment.v1.rabl +0 -4
  15. data/app/views/spree/api/products/show.v1.rabl +4 -4
  16. data/app/views/spree/api/variants/index.v1.rabl +1 -0
  17. data/app/views/spree/api/variants/show.v1.rabl +1 -0
  18. data/config/locales/en.yml +1 -0
  19. data/config/routes.rb +1 -1
  20. data/lib/spree/api/controller_setup.rb +1 -0
  21. data/spec/controllers/spree/api/addresses_controller_spec.rb +9 -0
  22. data/spec/controllers/spree/api/checkouts_controller_spec.rb +45 -0
  23. data/spec/controllers/spree/api/orders_controller_spec.rb +65 -4
  24. data/spec/controllers/spree/api/payments_controller_spec.rb +1 -1
  25. data/spec/controllers/spree/api/product_properties_controller_spec.rb +1 -1
  26. data/spec/controllers/spree/api/products_controller_spec.rb +10 -6
  27. data/spec/controllers/spree/api/shipments_controller_spec.rb +6 -0
  28. data/spec/controllers/spree/api/taxons_controller_spec.rb +18 -3
  29. data/spec/controllers/spree/api/variants_controller_spec.rb +22 -0
  30. data/spec/models/spree/order_spec.rb +1 -1
  31. data/spec/spec_helper.rb +1 -0
  32. data/spree_api.gemspec +0 -3
  33. metadata +12 -53
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f397d8160397db229e68ecb1625d2a70c704abb6
4
+ data.tar.gz: d21c61fe36137fccefe8d0a21d3904b658a82943
5
+ SHA512:
6
+ metadata.gz: fbc700d85f13b92900aedee047f0406ace478aa353fc3c283600bb40bd48e7fe121c555191d900df92fc55bdb0a01d3b9b11884603093f88fa7b56928c90898c
7
+ data.tar.gz: 206781bde534695d6a1d56584560d3355b08d4582d36f0dede3b748b471ca951a4b7cb5ba950fc072290acb40f5ea69177313ae0e4f3b07d80ea0968cb1bd5d5
@@ -12,8 +12,12 @@ module Spree
12
12
  def update
13
13
  @address = Address.find(params[:id])
14
14
  authorize! :read, @address
15
- @address.update_attributes(params[:address])
16
- respond_with(@address, :default_template => :show)
15
+
16
+ if @address.update_attributes(params[:address])
17
+ respond_with(@address, :default_template => :show)
18
+ else
19
+ invalid_resource!(@address)
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -19,6 +19,8 @@ module Spree
19
19
 
20
20
  helper Spree::Api::ApiHelpers
21
21
 
22
+ ssl_allowed
23
+
22
24
  def set_jsonp_format
23
25
  if params[:callback] && request.get?
24
26
  self.response_body = "#{params[:callback]}(#{self.response_body})"
@@ -11,12 +11,19 @@ module Spree
11
11
 
12
12
  def create
13
13
  @order = Order.build_from_api(current_api_user, nested_params)
14
- next!(:status => 201)
14
+ respond_with(@order, :default_template => 'spree/api/orders/show', :status => 201)
15
15
  end
16
16
 
17
17
  def update
18
- if @order.update_attributes(object_params)
19
- state_callback(:after) if @order.next
18
+ respond_with(@order, :default_template => 'spree/api/orders/show') and return if @order.state == "complete"
19
+
20
+ if object_params && object_params[:user_id].present?
21
+ @order.update_attribute(:user_id, object_params[:user_id])
22
+ object_params.delete(:user_id)
23
+ end
24
+
25
+ if @order.update_attributes(object_params) && @order.next
26
+ state_callback(:after)
20
27
  respond_with(@order, :default_template => 'spree/api/orders/show')
21
28
  else
22
29
  respond_with(@order, :default_template => 'spree/api/orders/could_not_transition', :status => 422)
@@ -27,7 +34,8 @@ module Spree
27
34
 
28
35
  def object_params
29
36
  # For payment step, filter order parameters to produce the expected nested attributes for a single payment and its source, discarding attributes for payment methods other than the one selected
30
- if @order.payment?
37
+ # respond_to check is necessary due to issue described in #2910
38
+ if @order.has_checkout_step?("payment") && @order.payment?
31
39
  if params[:payment_source].present? && source_params = params.delete(:payment_source)[params[:order][:payments_attributes].first[:payment_method_id].underscore]
32
40
  params[:order][:payments_attributes].first[:source_attributes] = source_params
33
41
  end
@@ -16,7 +16,7 @@ module Spree
16
16
  def update
17
17
  authorize! :read, order
18
18
  @line_item = order.line_items.find(params[:id])
19
- if @line_item.update_attributes(params[:line_item])
19
+ if @line_item.update_attributes(params[:line_item], :as => :api)
20
20
  respond_with(@line_item, :default_template => :show)
21
21
  else
22
22
  invalid_resource!(@line_item)
@@ -18,7 +18,7 @@ module Spree
18
18
 
19
19
  def create
20
20
  @order = Order.build_from_api(current_api_user, nested_params)
21
- next!(:status => 201)
21
+ respond_with(order, :default_template => :show, :status => 201)
22
22
  end
23
23
 
24
24
  def update
@@ -16,6 +16,16 @@ module Spree
16
16
  def create
17
17
  authorize! :create, Taxon
18
18
  @taxon = Taxon.new(params[:taxon])
19
+ @taxon.taxonomy_id = params[:taxonomy_id]
20
+ taxonomy = Taxonomy.find_by_id(params[:taxonomy_id])
21
+
22
+ if taxonomy.nil?
23
+ @taxon.errors[:taxonomy_id] = I18n.t(:invalid_taxonomy_id, :scope => 'spree.api')
24
+ invalid_resource!(@taxon) and return
25
+ end
26
+
27
+ @taxon.parent_id = taxonomy.root.id unless params[:taxon][:parent_id]
28
+
19
29
  if @taxon.save
20
30
  respond_with(@taxon, :status => 201, :default_template => :show)
21
31
  else
@@ -21,7 +21,7 @@ module Spree
21
21
 
22
22
  def create
23
23
  authorize! :create, Variant
24
- @variant = scope.new(params[:product])
24
+ @variant = scope.new(params[:variant])
25
25
  if @variant.save
26
26
  respond_with(@variant, :status => 201, :default_template => :show)
27
27
  else
@@ -0,0 +1,15 @@
1
+ require_dependency 'spree/base_controller'
2
+
3
+ Spree::BaseController.class_eval do
4
+ before_filter :ensure_api_key
5
+
6
+ # Need to generate an API key for a user due to some actions potentially
7
+ # requiring authentication to the Spree API
8
+ def ensure_api_key
9
+ if user = try_spree_current_user
10
+ if user.respond_to?(:spree_api_key) && user.spree_api_key.blank?
11
+ user.generate_spree_api_key!
12
+ end
13
+ end
14
+ end
15
+ end
@@ -8,8 +8,6 @@ Spree::Order.class_eval do
8
8
  end
9
9
  end
10
10
 
11
- order.user = user
12
- order.email = user.email
13
11
  order
14
12
  end
15
13
  end
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(:virtual_path => "spree/layouts/spree_application",
2
+ :name => "api_key_spree_layout",
3
+ :insert_bottom => "body",
4
+ :partial => "spree/api/key",
5
+ :disabled => false)
6
+
@@ -0,0 +1,4 @@
1
+ <script>
2
+ Spree.api_key = <%= raw(try_spree_current_user.try(:spree_api_key).to_s.inspect) %>;
3
+ </script>
4
+
@@ -2,4 +2,6 @@ object @line_item
2
2
  attributes *line_item_attributes
3
3
  child :variant do
4
4
  extends "spree/api/variants/variant"
5
+ attributes :product_id
6
+ child(:images => :images) { extends "spree/api/images/show" }
5
7
  end
@@ -1,4 +0,0 @@
1
- attributes :id, :amount, :payment_method_id
2
- child :payment_method => :payment_method do
3
- attributes :id, :name, :environment
4
- end
@@ -6,10 +6,10 @@ child :variants_including_master => :variants do
6
6
  child :option_values => :option_values do
7
7
  attributes *option_value_attributes
8
8
  end
9
- end
10
-
11
- child :images => :images do
12
- extends "spree/api/images/show"
9
+
10
+ child :images => :images do
11
+ extends "spree/api/images/show"
12
+ end
13
13
  end
14
14
 
15
15
  child :option_types => :option_types do
@@ -7,4 +7,5 @@ node(:pages) { @variants.num_pages }
7
7
  child(@variants => :variants) do
8
8
  attributes *variant_attributes
9
9
  child(:option_values => :option_values) { attributes *option_value_attributes }
10
+ child(:images => :images) { extends "spree/api/images/show" }
10
11
  end
@@ -1,3 +1,4 @@
1
1
  object @variant
2
2
  extends "spree/api/variants/variant"
3
3
  child(:option_values => :option_values) { attributes *option_value_attributes }
4
+ child(:images => :images) { extends "spree/api/images/show" }
@@ -21,3 +21,4 @@ en:
21
21
  invalid_shipping_method: "Invalid shipping method specified."
22
22
  shipment:
23
23
  cannot_ready: "Cannot ready shipment."
24
+ invalid_taxonomy_id: "Invalid taxonomy id."
data/config/routes.rb CHANGED
@@ -1,4 +1,4 @@
1
- Spree::Core::Engine.routes.prepend do
1
+ Spree::Core::Engine.routes.draw do
2
2
  namespace :admin do
3
3
  resources :users do
4
4
  member do
@@ -16,6 +16,7 @@ module Spree
16
16
  include ActionController::MimeResponds
17
17
 
18
18
  include CanCan::ControllerAdditions
19
+ include SslRequirement
19
20
  prepend_view_path Rails.root + "app/views"
20
21
  append_view_path File.expand_path("../../../app/views", File.dirname(__FILE__))
21
22
 
@@ -24,6 +24,15 @@ module Spree
24
24
  :address => { :address1 => "123 Test Lane" }
25
25
  json_response['address1'].should eq '123 Test Lane'
26
26
  end
27
+
28
+ it "receives the errors object if address is invalid" do
29
+ api_put :update, :id => @address.id,
30
+ :address => { :address1 => "" }
31
+
32
+ json_response['error'].should_not be_nil
33
+ json_response['errors'].should_not be_nil
34
+ json_response['errors']['address1'].first.should eq "can't be blank"
35
+ end
27
36
  end
28
37
 
29
38
  context "on somebody else's address" do
@@ -27,6 +27,20 @@ module Spree
27
27
  json_response['number'].should be_present
28
28
  response.status.should == 201
29
29
  end
30
+
31
+ it "should not have a user by default" do
32
+ api_post :create
33
+
34
+ json_response['user_id'].should_not be_present
35
+ response.status.should == 201
36
+ end
37
+
38
+ it "should not have an email by default" do
39
+ api_post :create
40
+
41
+ json_response['email'].should_not be_present
42
+ response.status.should == 201
43
+ end
30
44
  end
31
45
 
32
46
  context "PUT 'update'" do
@@ -37,6 +51,24 @@ module Spree
37
51
  Order.any_instance.stub(:payment_required? => true)
38
52
  end
39
53
 
54
+ it "will return an error if the recently created order cannot transition from cart to address" do
55
+ order.state.should eq "cart"
56
+ order.email = nil # email is necessary to transition from cart to address
57
+ order.save!
58
+
59
+ api_put :update, :id => order.to_param
60
+
61
+ json_response['error'].should =~ /could not be transitioned/
62
+ response.status.should == 422
63
+ end
64
+
65
+ it "should transition a recently created order from cart do address" do
66
+ order.state.should eq "cart"
67
+ order.email.should_not be_nil
68
+ api_put :update, :id => order.to_param
69
+ order.reload.state.should eq "address"
70
+ end
71
+
40
72
  it "will return an error if the order cannot transition" do
41
73
  order.update_column(:state, "address")
42
74
  api_put :update, :id => order.to_param
@@ -97,6 +129,19 @@ module Spree
97
129
  json_response['number'].should == order.number
98
130
  response.status.should == 200
99
131
  end
132
+
133
+ it "can assign a user to the order" do
134
+ user = create(:user)
135
+ api_put :update, :id => order.to_param, :order => { :user_id => user.id }
136
+ json_response['user_id'].should == user.id
137
+ response.status.should == 200
138
+ end
139
+
140
+ it "can assign an email to the order" do
141
+ api_put :update, :id => order.to_param, :order => { :email => "guest@spreecommerce.com" }
142
+ json_response['email'].should == "guest@spreecommerce.com"
143
+ response.status.should == 200
144
+ end
100
145
  end
101
146
  end
102
147
  end
@@ -61,14 +61,14 @@ module Spree
61
61
  order.line_items.count.should == 1
62
62
  order.line_items.first.variant.should == variant
63
63
  order.line_items.first.quantity.should == 5
64
- json_response["state"].should == "address"
64
+ json_response["state"].should == "cart"
65
65
  end
66
66
 
67
67
  it "can create an order without any parameters" do
68
68
  lambda { api_post :create }.should_not raise_error(NoMethodError)
69
69
  response.status.should == 201
70
70
  order = Order.last
71
- json_response["state"].should == "address"
71
+ json_response["state"].should == "cart"
72
72
  end
73
73
 
74
74
  context "working with an order" do
@@ -87,8 +87,12 @@ module Spree
87
87
  end
88
88
 
89
89
  let(:address_params) { { :country_id => Country.first.id, :state_id => State.first.id } }
90
- let(:shipping_address) { clean_address(attributes_for(:address).merge!(address_params)) }
91
- let(:billing_address) { clean_address(attributes_for(:address).merge!(address_params)) }
90
+ let(:billing_address) { { :firstname => "Tiago", :lastname => "Motta", :address1 => "Av Paulista",
91
+ :city => "Sao Paulo", :zipcode => "1234567", :phone => "12345678",
92
+ :country_id => Country.first.id, :state_id => State.first.id} }
93
+ let(:shipping_address) { { :firstname => "Tiago", :lastname => "Motta", :address1 => "Av Paulista",
94
+ :city => "Sao Paulo", :zipcode => "1234567", :phone => "12345678",
95
+ :country_id => Country.first.id, :state_id => State.first.id} }
92
96
  let!(:shipping_method) { create(:shipping_method) }
93
97
  let!(:payment_method) { create(:payment_method) }
94
98
 
@@ -98,6 +102,44 @@ module Spree
98
102
  response.status.should == 200
99
103
  json_response['item_total'].to_f.should_not == order.item_total.to_f
100
104
  end
105
+
106
+ it "can add billing address" do
107
+ order.bill_address.should be_nil
108
+
109
+ api_put :update, :id => order.to_param, :order => { :bill_address_attributes => billing_address }
110
+
111
+ order.reload.bill_address.should_not be_nil
112
+ end
113
+
114
+ it "receives error message if trying to add billing address with errors" do
115
+ order.bill_address.should be_nil
116
+ billing_address[:firstname] = ""
117
+
118
+ api_put :update, :id => order.to_param, :order => { :bill_address_attributes => billing_address }
119
+
120
+ json_response['error'].should_not be_nil
121
+ json_response['errors'].should_not be_nil
122
+ json_response['errors']['bill_address.firstname'].first.should eq "can't be blank"
123
+ end
124
+
125
+ it "can add shipping address" do
126
+ order.ship_address.should be_nil
127
+
128
+ api_put :update, :id => order.to_param, :order => { :ship_address_attributes => shipping_address }
129
+
130
+ order.reload.ship_address.should_not be_nil
131
+ end
132
+
133
+ it "receives error message if trying to add shipping address with errors" do
134
+ order.ship_address.should be_nil
135
+ shipping_address[:firstname] = ""
136
+
137
+ api_put :update, :id => order.to_param, :order => { :ship_address_attributes => shipping_address }
138
+
139
+ json_response['error'].should_not be_nil
140
+ json_response['errors'].should_not be_nil
141
+ json_response['errors']['ship_address.firstname'].first.should eq "can't be blank"
142
+ end
101
143
 
102
144
  context "with a line item" do
103
145
  before do
@@ -109,6 +151,20 @@ module Spree
109
151
  response.status.should == 200
110
152
  order.reload.line_items.should be_empty
111
153
  end
154
+
155
+ it "can list its line items with images" do
156
+ order.line_items.first.variant.images.create!(:attachment => image("thinking-cat.jpg"))
157
+
158
+ api_get :show, :id => order.to_param
159
+
160
+ json_response['line_items'].first['variant'].should have_attributes([:images])
161
+ end
162
+
163
+ it "lists variants product id" do
164
+ api_get :show, :id => order.to_param
165
+
166
+ json_response['line_items'].first['variant'].should have_attributes([:product_id])
167
+ end
112
168
  end
113
169
  end
114
170
 
@@ -166,6 +222,11 @@ module Spree
166
222
 
167
223
  context "can cancel an order" do
168
224
  before do
225
+ Spree::MailMethod.create!(
226
+ :environment => Rails.env,
227
+ :preferred_mails_from => "spree@example.com"
228
+ )
229
+
169
230
  order.completed_at = Time.now
170
231
  order.state = 'complete'
171
232
  order.shipment_state = 'ready'
@@ -162,7 +162,7 @@ module Spree
162
162
  json_response["error"].should == "There was a problem with the payment gateway: NO REFUNDS"
163
163
 
164
164
  payment.reload
165
- payment.state.should == "pending"
165
+ payment.state.should == "checkout"
166
166
  end
167
167
 
168
168
  context "crediting" do
@@ -18,7 +18,7 @@ module Spree
18
18
 
19
19
  context "if product is deleted" do
20
20
  before do
21
- product.update_column(:deleted_at, Time.now)
21
+ product.update_column(:deleted_at, 1.day.ago)
22
22
  end
23
23
 
24
24
  it "can not see a list of product properties" do
@@ -66,18 +66,22 @@ module Spree
66
66
 
67
67
  it "gets a single product" do
68
68
  product.master.images.create!(:attachment => image("thinking-cat.jpg"))
69
+ product.variants.create!
70
+ product.variants.first.images.create!(:attachment => image("thinking-cat.jpg"))
69
71
  product.set_property("spree", "rocks")
70
72
  api_get :show, :id => product.to_param
71
73
  json_response.should have_attributes(attributes)
72
74
  json_response['variants'].first.should have_attributes([:name,
73
75
  :is_master,
74
76
  :count_on_hand,
75
- :price])
77
+ :price,
78
+ :images])
76
79
 
77
- json_response["images"].first.should have_attributes([:attachment_file_name,
78
- :attachment_width,
79
- :attachment_height,
80
- :attachment_content_type])
80
+ json_response['variants'].first['images'].first.should have_attributes([:attachment_file_name,
81
+ :attachment_width,
82
+ :attachment_height,
83
+ :attachment_content_type,
84
+ :attachment_url])
81
85
 
82
86
  json_response["product_properties"].first.should have_attributes([:value,
83
87
  :product_id,
@@ -139,7 +143,7 @@ module Spree
139
143
  # Regression test for #1626
140
144
  context "deleted products" do
141
145
  before do
142
- create(:product, :deleted_at => Time.now)
146
+ create(:product, :deleted_at => 1.day.ago)
143
147
  end
144
148
 
145
149
  it "does not include deleted products" do
@@ -44,6 +44,12 @@ describe Spree::Api::ShipmentsController do
44
44
  context "can transition a shipment from ready to ship" do
45
45
  before do
46
46
  Spree::Order.any_instance.stub(:paid? => true, :complete? => true)
47
+ # For the shipment notification email
48
+ Spree::MailMethod.create!(
49
+ :environment => Rails.env,
50
+ :preferred_mails_from => "spree@example.com"
51
+ )
52
+
47
53
  shipment.update!(shipment.order)
48
54
  shipment.state.should == "ready"
49
55
  end
@@ -61,11 +61,14 @@ module Spree
61
61
  sign_in_as_admin!
62
62
 
63
63
  it "can create" do
64
- api_post :create, :taxonomy_id => taxonomy.id, :taxon => { :name => "Colors", :parent_id => taxon.id}
64
+ api_post :create, :taxonomy_id => taxonomy.id, :taxon => { :name => "Colors" }
65
65
  json_response.should have_attributes(attributes)
66
66
  response.status.should == 201
67
67
 
68
- taxon.reload.children.count.should eq 2
68
+ taxonomy.reload.root.children.count.should eq 2
69
+
70
+ Spree::Taxon.last.parent_id.should eq taxonomy.root.id
71
+ Spree::Taxon.last.taxonomy_id.should eq taxonomy.id
69
72
  end
70
73
 
71
74
  it "cannot create a new taxon with invalid attributes" do
@@ -74,7 +77,19 @@ module Spree
74
77
  json_response["error"].should == "Invalid resource. Please fix errors and try again."
75
78
  errors = json_response["errors"]
76
79
 
77
- taxon.reload.children.count.should eq 1
80
+ taxonomy.reload.root.children.count.should eq 1
81
+ end
82
+
83
+ it "cannot create a new taxon with invalid taxonomy_id" do
84
+ api_post :create, :taxonomy_id => 1000, :taxon => { :name => "Colors" }
85
+ response.status.should == 422
86
+ json_response["error"].should == "Invalid resource. Please fix errors and try again."
87
+
88
+ errors = json_response["errors"]
89
+ errors["taxonomy_id"].should_not be_nil
90
+ errors["taxonomy_id"].first.should eq "Invalid taxonomy id."
91
+
92
+ taxonomy.reload.root.children.count.should eq 1
78
93
  end
79
94
 
80
95
  it "can destroy" do
@@ -51,6 +51,14 @@ module Spree
51
51
  :option_type_name,
52
52
  :option_type_id])
53
53
  end
54
+
55
+ it "variants returned contain images data" do
56
+ variant.images.create!(:attachment => image("thinking-cat.jpg"))
57
+
58
+ api_get :index
59
+
60
+ json_response["variants"].last.should have_attributes([:images])
61
+ end
54
62
 
55
63
  # Regression test for #2141
56
64
  context "a deleted variant" do
@@ -91,6 +99,19 @@ module Spree
91
99
  :option_type_name,
92
100
  :option_type_id])
93
101
  end
102
+
103
+ it "can see a single variant with images" do
104
+ variant.images.create!(:attachment => image("thinking-cat.jpg"))
105
+
106
+ api_get :show, :id => variant.to_param
107
+
108
+ json_response.should have_attributes(attributes + [:images])
109
+ option_values = json_response["option_values"]
110
+ option_values.first.should have_attributes([:name,
111
+ :presentation,
112
+ :option_type_name,
113
+ :option_type_id])
114
+ end
94
115
 
95
116
  it "can learn how to create a new variant" do
96
117
  api_get :new
@@ -134,6 +155,7 @@ module Spree
134
155
  api_post :create, :variant => { :sku => "12345" }
135
156
  json_response.should have_attributes(attributes)
136
157
  response.status.should == 201
158
+ json_response["sku"].should == "12345"
137
159
 
138
160
  variant.product.variants.count.should == 1
139
161
  end
@@ -9,7 +9,7 @@ module Spree
9
9
  variant_id = product.master.id
10
10
  order = Order.build_from_api(user, { :line_items_attributes => { "0" => { :variant_id => variant_id, :quantity => 5 }}})
11
11
 
12
- order.user.should == user
12
+ order.user.should == nil
13
13
  line_item = order.line_items.first
14
14
  line_item.quantity.should == 5
15
15
  line_item.variant_id.should == variant_id
data/spec/spec_helper.rb CHANGED
@@ -15,6 +15,7 @@ require 'spree/api/testing_support/setup'
15
15
 
16
16
  RSpec.configure do |config|
17
17
  config.backtrace_clean_patterns = [/gems\/activesupport/, /gems\/actionpack/, /gems\/rspec/]
18
+ config.color = true
18
19
 
19
20
  config.include FactoryGirl::Syntax::Methods
20
21
  config.include Spree::Api::TestingSupport::Helpers, :type => :controller
data/spree_api.gemspec CHANGED
@@ -17,7 +17,4 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency 'spree_core', version
19
19
  gem.add_dependency 'versioncake', '0.4.0'
20
-
21
- gem.add_development_dependency 'rspec-rails', '2.9.0'
22
- gem.add_development_dependency 'database_cleaner'
23
20
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
5
- prerelease:
4
+ version: 1.3.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ryan Bigg
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-04 00:00:00.000000000 Z
11
+ date: 2013-06-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: spree_core
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
21
- version: 1.3.2
19
+ version: 1.3.3
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
29
- version: 1.3.2
26
+ version: 1.3.3
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: versioncake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
@@ -38,43 +34,10 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 0.4.0
46
- - !ruby/object:Gem::Dependency
47
- name: rspec-rails
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - '='
52
- - !ruby/object:Gem::Version
53
- version: 2.9.0
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 2.9.0
62
- - !ruby/object:Gem::Dependency
63
- name: database_cleaner
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
41
  description: Spree's API
79
42
  email:
80
43
  - ryan@spreecommerce.com
@@ -105,6 +68,7 @@ files:
105
68
  - app/controllers/spree/api/users_controller.rb
106
69
  - app/controllers/spree/api/variants_controller.rb
107
70
  - app/controllers/spree/api/zones_controller.rb
71
+ - app/controllers/spree/base_controller_decorator.rb
108
72
  - app/helpers/spree/api/api_helpers.rb
109
73
  - app/models/spree/api_configuration.rb
110
74
  - app/models/spree/line_item_decorator.rb
@@ -112,7 +76,9 @@ files:
112
76
  - app/models/spree/order_decorator.rb
113
77
  - app/models/spree/user_decorator.rb
114
78
  - app/overrides/api_admin_user_edit_form.rb
79
+ - app/overrides/api_key_spree_layout.rb
115
80
  - app/views/spree/admin/users/_api_fields.html.erb
81
+ - app/views/spree/api/_key.html.erb
116
82
  - app/views/spree/api/addresses/show.v1.rabl
117
83
  - app/views/spree/api/countries/index.v1.rabl
118
84
  - app/views/spree/api/countries/show.v1.rabl
@@ -215,33 +181,26 @@ files:
215
181
  - spree_api.gemspec
216
182
  homepage: ''
217
183
  licenses: []
184
+ metadata: {}
218
185
  post_install_message:
219
186
  rdoc_options: []
220
187
  require_paths:
221
188
  - lib
222
189
  required_ruby_version: !ruby/object:Gem::Requirement
223
- none: false
224
190
  requirements:
225
- - - ! '>='
191
+ - - '>='
226
192
  - !ruby/object:Gem::Version
227
193
  version: '0'
228
- segments:
229
- - 0
230
- hash: 2361962546786859221
231
194
  required_rubygems_version: !ruby/object:Gem::Requirement
232
- none: false
233
195
  requirements:
234
- - - ! '>='
196
+ - - '>='
235
197
  - !ruby/object:Gem::Version
236
198
  version: '0'
237
- segments:
238
- - 0
239
- hash: 2361962546786859221
240
199
  requirements: []
241
200
  rubyforge_project:
242
- rubygems_version: 1.8.23
201
+ rubygems_version: 2.0.0
243
202
  signing_key:
244
- specification_version: 3
203
+ specification_version: 4
245
204
  summary: Spree's API
246
205
  test_files:
247
206
  - spec/controllers/spree/api/addresses_controller_spec.rb