spree_api 3.5.0 → 3.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 54d154d602caca737bf94054121558eb868f816567c860b85685e3a5c5b03e24
|
4
|
+
data.tar.gz: 8caef55d4f67cb4584e82fd1c2f4c537acff4aa96e5f357f70d3ae8b110d78e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecbcc45b451ad5c9bd1a3d29199bfe2e43300ff759d5ac6a98cb9fd8b1fc6e34e305978432de98054c79bf37e2af3acb6f7b46dac645c4cf3075bcba10881752
|
7
|
+
data.tar.gz: fa4bbe45a751642c17abfdf9cb046af7c080938dfc6f5a752491713d9900903fed3e49f842c7ad07733700eea6fa6be85e889da75cc5c1afe5b1ef9e17319eb6
|
@@ -4,7 +4,7 @@ module Spree
|
|
4
4
|
class OrdersController < Spree::Api::BaseController
|
5
5
|
skip_before_action :authenticate_user, only: :apply_coupon_code
|
6
6
|
|
7
|
-
before_action :find_order, except: [:create, :mine, :current, :index, :update]
|
7
|
+
before_action :find_order, except: [:create, :mine, :current, :index, :update, :remove_coupon_code]
|
8
8
|
|
9
9
|
# Dynamically defines our stores checkout steps to ensure we check authorization on each step.
|
10
10
|
Order.checkout_steps.keys.each do |step|
|
@@ -112,6 +112,14 @@ module Spree
|
|
112
112
|
render 'spree/api/v1/promotions/handler', status: status
|
113
113
|
end
|
114
114
|
|
115
|
+
def remove_coupon_code
|
116
|
+
find_order(true)
|
117
|
+
authorize! :update, @order, order_token
|
118
|
+
@handler = Spree::PromotionHandler::Coupon.new(@order).remove(params[:coupon_code])
|
119
|
+
status = @handler.successful? ? 200 : 404
|
120
|
+
render 'spree/api/v1/promotions/handler', status: status
|
121
|
+
end
|
122
|
+
|
115
123
|
private
|
116
124
|
|
117
125
|
def order_params
|
@@ -141,31 +141,31 @@ module Spree
|
|
141
141
|
order: {
|
142
142
|
bill_address: {
|
143
143
|
state: {},
|
144
|
-
country: {}
|
144
|
+
country: {}
|
145
145
|
},
|
146
146
|
ship_address: {
|
147
147
|
state: {},
|
148
|
-
country: {}
|
148
|
+
country: {}
|
149
149
|
},
|
150
150
|
adjustments: {},
|
151
151
|
payments: {
|
152
152
|
order: {},
|
153
|
-
payment_method: {}
|
154
|
-
}
|
153
|
+
payment_method: {}
|
154
|
+
}
|
155
155
|
},
|
156
156
|
inventory_units: {
|
157
157
|
line_item: {
|
158
158
|
product: {},
|
159
|
-
variant: {}
|
159
|
+
variant: {}
|
160
160
|
},
|
161
161
|
variant: {
|
162
162
|
product: {},
|
163
163
|
default_price: {},
|
164
164
|
option_values: {
|
165
|
-
option_type: {}
|
166
|
-
}
|
167
|
-
}
|
168
|
-
}
|
165
|
+
option_type: {}
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
169
|
}
|
170
170
|
end
|
171
171
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
object @image
|
2
2
|
attributes *image_attributes
|
3
3
|
attributes :viewable_type, :viewable_id
|
4
|
-
Spree::Image.
|
5
|
-
node("#{k}_url") { |i| i.
|
4
|
+
Spree::Image.styles.each do |k, _v|
|
5
|
+
node("#{k}_url") { |i| main_app.url_for(i.url(k)) }
|
6
6
|
end
|
data/config/routes.rb
CHANGED
@@ -63,7 +63,9 @@ Spree::Core::Engine.add_routes do
|
|
63
63
|
get '/orders/mine', to: 'orders#mine', as: 'my_orders'
|
64
64
|
get '/orders/current', to: 'orders#current', as: 'current_order'
|
65
65
|
|
66
|
-
resources :orders, concerns: :order_routes
|
66
|
+
resources :orders, concerns: :order_routes do
|
67
|
+
put :remove_coupon_code, on: :member
|
68
|
+
end
|
67
69
|
|
68
70
|
resources :zones
|
69
71
|
resources :countries, only: [:index, :show] do
|
data/spree_api.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.6.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.6.0.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rabl
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: 3.4.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
54
|
+
version: 3.4.0
|
55
55
|
description: Spree's API
|
56
56
|
email:
|
57
57
|
- ryan@spreecommerce.com
|
@@ -231,12 +231,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
231
|
version: 2.2.7
|
232
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - "
|
234
|
+
- - ">"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 1.3.1
|
237
237
|
requirements: []
|
238
238
|
rubyforge_project:
|
239
|
-
rubygems_version: 2.6
|
239
|
+
rubygems_version: 2.7.6
|
240
240
|
signing_key:
|
241
241
|
specification_version: 4
|
242
242
|
summary: Spree's API
|