spree_api 1.1.0.rc2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,6 +45,11 @@ module Spree
45
45
  end
46
46
  end
47
47
 
48
+ def cancel
49
+ order.cancel!
50
+ render :show
51
+ end
52
+
48
53
  private
49
54
 
50
55
  def map_nested_attributes
File without changes
data/config/routes.rb CHANGED
@@ -18,6 +18,7 @@ Spree::Core::Engine.routes.prepend do
18
18
  member do
19
19
  put :address
20
20
  put :delivery
21
+ put :cancel
21
22
  end
22
23
 
23
24
  resources :line_items
@@ -129,8 +129,6 @@ module Spree
129
129
  end
130
130
  end
131
131
  end
132
-
133
-
134
132
  end
135
133
 
136
134
  context "as an admin" do
@@ -143,6 +141,20 @@ module Spree
143
141
  json_response["current_page"].should == 1
144
142
  json_response["pages"].should == 1
145
143
  end
144
+
145
+ context "can cancel an order" do
146
+ before do
147
+ order.completed_at = Time.now
148
+ order.state = 'complete'
149
+ order.shipment_state = 'ready'
150
+ order.save!
151
+ end
152
+
153
+ specify do
154
+ api_put :cancel, :id => order.to_param
155
+ json_response["order"]["state"].should == "canceled"
156
+ end
157
+ end
146
158
  end
147
159
  end
148
160
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.rc2
5
- prerelease: 6
4
+ version: 1.1.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan Bigg
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-20 00:00:00.000000000 Z
12
+ date: 2012-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
16
- requirement: &70332729484720 !ruby/object:Gem::Requirement
16
+ requirement: &70116387070120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
20
20
  - !ruby/object:Gem::Version
21
- version: 1.1.0.rc2
21
+ version: 1.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70332729484720
24
+ version_requirements: *70116387070120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: spree_auth
27
- requirement: &70332729479800 !ruby/object:Gem::Requirement
27
+ requirement: &70116387068680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
31
31
  - !ruby/object:Gem::Version
32
- version: 1.1.0.rc2
32
+ version: 1.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70332729479800
35
+ version_requirements: *70116387068680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rabl
38
- requirement: &70332729477860 !ruby/object:Gem::Requirement
38
+ requirement: &70116387015640 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.6.5
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70332729477860
46
+ version_requirements: *70116387015640
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec-rails
49
- requirement: &70332729346420 !ruby/object:Gem::Requirement
49
+ requirement: &70116387011680 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.9.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70332729346420
57
+ version_requirements: *70116387011680
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: database_cleaner
60
- requirement: &70332729344960 !ruby/object:Gem::Requirement
60
+ requirement: &70116387010380 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70332729344960
68
+ version_requirements: *70116387010380
69
69
  description: Spree's API
70
70
  email:
71
71
  - ryan@spreecommerce.com
@@ -105,6 +105,7 @@ files:
105
105
  - app/views/spree/api/v1/line_items/new.rabl
106
106
  - app/views/spree/api/v1/line_items/show.rabl
107
107
  - app/views/spree/api/v1/orders/address.rabl
108
+ - app/views/spree/api/v1/orders/canceled.rabl
108
109
  - app/views/spree/api/v1/orders/cart.rabl
109
110
  - app/views/spree/api/v1/orders/complete.rabl
110
111
  - app/views/spree/api/v1/orders/could_not_transition.rabl
@@ -169,13 +170,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
170
  version: '0'
170
171
  segments:
171
172
  - 0
172
- hash: -1673968369250392994
173
+ hash: 618732053223266577
173
174
  required_rubygems_version: !ruby/object:Gem::Requirement
174
175
  none: false
175
176
  requirements:
176
- - - ! '>'
177
+ - - ! '>='
177
178
  - !ruby/object:Gem::Version
178
- version: 1.3.1
179
+ version: '0'
180
+ segments:
181
+ - 0
182
+ hash: 618732053223266577
179
183
  requirements: []
180
184
  rubyforge_project:
181
185
  rubygems_version: 1.8.10