spree_api 3.1.11 → 3.1.12
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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09ac4995e5cd8e7496470df5f64f5936971fbc4b'
|
4
|
+
data.tar.gz: 96cd750ac73a6af3508032b3861a63c0db47de4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37b50a7242662ee513ba896c6b12c87e962f8371c6e6b1057081f569ab02518ef7900ce4e4e2425fb55fbeade38965bfa36b6a87030e38b462a089e2ff3262d5
|
7
|
+
data.tar.gz: fadeb7db66ec68b583f726781e8471b5e592686fe83013b418f9961f4ab6ebc0f1b626467d948bb7fa4da792b8ca037cd03464298c76b849030304adef6bc68f
|
@@ -27,21 +27,32 @@ module Spree
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def create
|
30
|
-
authorize! :create, Order
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
authorize! :create, Spree::Order
|
31
|
+
if can?(:admin, Spree::Order)
|
32
|
+
|
33
|
+
order_user = if @current_user_roles.include?('admin') && order_params[:user_id]
|
34
|
+
Spree.user_class.find(order_params[:user_id])
|
35
|
+
else
|
36
|
+
current_api_user
|
37
|
+
end
|
38
|
+
|
39
|
+
import_params = if @current_user_roles.include?("admin")
|
40
|
+
params[:order].present? ? params[:order].permit! : {}
|
41
|
+
else
|
42
|
+
order_params
|
43
|
+
end
|
44
|
+
|
45
|
+
@order = Spree::Core::Importer::Order.import(order_user, import_params)
|
36
46
|
|
37
|
-
|
38
|
-
params[:order].present? ? params[:order].permit! : {}
|
47
|
+
respond_with(@order, default_template: :show, status: 201)
|
39
48
|
else
|
40
|
-
|
49
|
+
@order = Spree::Order.create!(user: current_api_user, store: current_store)
|
50
|
+
if @order.contents.update_cart(order_params)
|
51
|
+
respond_with(@order, default_template: :show, status: 201)
|
52
|
+
else
|
53
|
+
invalid_resource!(@order)
|
54
|
+
end
|
41
55
|
end
|
42
|
-
|
43
|
-
@order = Spree::Core::Importer::Order.import(order_user, import_params)
|
44
|
-
respond_with(@order, default_template: :show, status: 201)
|
45
56
|
end
|
46
57
|
|
47
58
|
def empty
|
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.1.
|
4
|
+
version: 3.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Bigg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-12 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.1.
|
19
|
+
version: 3.1.12
|
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.1.
|
26
|
+
version: 3.1.12
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rabl
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|