comee_core 0.2.16 → 0.2.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/customer_orders_controller.rb +1 -1
- data/app/controllers/comee/core/sales_order_items_controller.rb +6 -0
- data/app/controllers/comee/core/sales_orders_controller.rb +1 -1
- data/app/controllers/concerns/comee/core/common.rb +42 -12
- data/config/routes.rb +1 -0
- data/lib/comee/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15f8ce85838c3713a94a2c4688915f6039299a372f99d7df0e878628be575051
|
4
|
+
data.tar.gz: 63850128d1d2b4f5342ccf7392d0b39298358ea400fdaadcc5b48a956cf8ffb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5966fd4cb4dd0476c78d93c3a3fe27dd446bf6e85e64f206c96e5fd0fd8dd8d98c17589111bd199cb5b78ec87af2a273d9818f623110cc4e5fd902e4ed458ac
|
7
|
+
data.tar.gz: b2959c7cc9e0f43d18350054c439eb6a0c21b16ae303b2fd34b0fa0016bd1b2cbec61ae25399fd57e531d93ee36f1e5b91fd05e453665095fabe558e15bdec98
|
@@ -61,13 +61,28 @@ module Comee
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def create
|
64
|
-
obj =
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
obj = nil
|
65
|
+
options = {}
|
66
|
+
if block_given?
|
67
|
+
incoming = yield
|
68
|
+
if incoming.instance_of?(Array)
|
69
|
+
obj, options = incoming
|
70
|
+
elsif incoming.instance_of?(Hash)
|
71
|
+
obj = @clazz.new(model_params)
|
72
|
+
options = incoming
|
73
|
+
else
|
74
|
+
obj = incoming
|
75
|
+
end
|
76
|
+
else
|
77
|
+
obj = @clazz.new(model_params)
|
78
|
+
end
|
79
|
+
|
69
80
|
if obj.save
|
70
|
-
|
81
|
+
result = {
|
82
|
+
success: true,
|
83
|
+
data: options.key?(:fields) ? serialize(obj, include: options[:fields]) : serialize(obj)
|
84
|
+
}
|
85
|
+
render json: result, status: :created
|
71
86
|
else
|
72
87
|
render json: {success: false, error: obj.errors.full_messages[0]}, status: :unprocessable_entity
|
73
88
|
end
|
@@ -76,13 +91,28 @@ module Comee
|
|
76
91
|
end
|
77
92
|
|
78
93
|
def update
|
79
|
-
obj =
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
94
|
+
obj = nil
|
95
|
+
options = {}
|
96
|
+
if block_given?
|
97
|
+
incoming = yield
|
98
|
+
if incoming.instance_of?(Array)
|
99
|
+
obj, options = incoming
|
100
|
+
elsif incoming.instance_of?(Hash)
|
101
|
+
obj = set_object
|
102
|
+
options = incoming
|
103
|
+
else
|
104
|
+
obj = incoming
|
105
|
+
end
|
106
|
+
else
|
107
|
+
obj = set_object
|
108
|
+
end
|
109
|
+
|
84
110
|
if obj.update(model_params)
|
85
|
-
|
111
|
+
result = {
|
112
|
+
success: true,
|
113
|
+
data: options.key?(:fields) ? serialize(obj, include: options[:fields]) : serialize(obj)
|
114
|
+
}
|
115
|
+
render json: result
|
86
116
|
else
|
87
117
|
render json: {success: false, error: obj.errors.full_messages[0]}, status: :unprocessable_entity
|
88
118
|
end
|
data/config/routes.rb
CHANGED
data/lib/comee/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comee_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|