pipe_drive_ruby_wrapper 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pipe_drive/base.rb +14 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f9545138731d0e2ad3dfc68a340dce5023b0b4ce3010b321b5a222270a2e3e9
|
4
|
+
data.tar.gz: d5239ca78ff9cbc2a6a0081e8179295fd21cbe777d7eba161e4e8ec2ff5f4044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22a5a43a1303225599a9d135bd39f469218a540da6be0df3e0d075b5281d8df48a68ea7724f69e85eff7a2c5b3fb123c087a7b17731d36c38d50d2911b60dba5
|
7
|
+
data.tar.gz: 7d69ae0cdb7682c9ee3d4c415d058e38c3a0100c7ca43314f94339b0709da47c87457b478affacf4b0ee0f64677cac93d7907f36566317d68bbd05cba88d1828
|
data/lib/pipe_drive/base.rb
CHANGED
@@ -105,19 +105,22 @@ module PipeDrive
|
|
105
105
|
def transform_opts(opts)
|
106
106
|
new_opts = {}
|
107
107
|
opts.each_pair do |key, value|
|
108
|
-
|
109
|
-
|
110
|
-
if value.is_a?(Array)
|
111
|
-
field_info = field_class.find_by_id(field_keys[key][:id])
|
112
|
-
new_value = value.map do |val|
|
113
|
-
target = field_info.options.find{|f| f[:label] == val}
|
114
|
-
target[:id] unless target.nil?
|
115
|
-
end
|
116
|
-
new_value.compact!
|
108
|
+
if field_keys[key].nil?
|
109
|
+
new_opts[key] = value
|
117
110
|
else
|
118
|
-
|
111
|
+
new_key = field_keys[key][:key]
|
112
|
+
if value.is_a?(Array)
|
113
|
+
field_info = field_class.find_by_id(field_keys[key][:id])
|
114
|
+
new_value = value.map do |val|
|
115
|
+
target = field_info.options.find{|f| f[:label] == val}
|
116
|
+
target[:id] unless target.nil?
|
117
|
+
end
|
118
|
+
new_value.compact!
|
119
|
+
else
|
120
|
+
new_value = value
|
121
|
+
end
|
122
|
+
new_opts[new_key] = new_value
|
119
123
|
end
|
120
|
-
new_opts[new_key] = new_value
|
121
124
|
end
|
122
125
|
new_opts
|
123
126
|
end
|