pipe_drive_ruby_wrapper 0.2.1 → 0.2.2
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 +18 -7
- 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: 7a0306cb9643370e9c2bdc925d0b0b9d0457d0a397e918f64d007e33d96db583
|
4
|
+
data.tar.gz: 995f2307d138885030d5f0b2bfaacfc2c69680cd4817a4e34cef60ffd0a36364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f13c5c3cf4ca52b0d8d2418d1d2e7cf2770ab203679fb1efcf8153b9d0b1c59c4c34d587af15557942c37c92cc5972bc18c4484f95390897d6cf4309ba7ca34
|
7
|
+
data.tar.gz: beec160b8ab90d67935ec626cef412e28a0d06a44ab7081b21a6e56fe0e29d3b404f39d5127fd340b43765f687201ae15fc99bd140bf8a2c7b29b74d87812d72
|
data/lib/pipe_drive/base.rb
CHANGED
@@ -109,13 +109,9 @@ module PipeDrive
|
|
109
109
|
new_opts[key] = value
|
110
110
|
else
|
111
111
|
new_key = resource_class.field_keys[key][:key]
|
112
|
-
|
113
|
-
|
114
|
-
new_value = value
|
115
|
-
target = field_info.options.find{|f| f[:label] == val}
|
116
|
-
target[:id] unless target.nil?
|
117
|
-
end
|
118
|
-
new_value.compact!
|
112
|
+
field_info = field_class.find_by_id(resource_class.field_keys[key][:id])
|
113
|
+
if field_info.field_type == 'set' || field_info.field_type == 'enum'
|
114
|
+
new_value = detect_option_value(field_info, value)
|
119
115
|
else
|
120
116
|
new_value = value
|
121
117
|
end
|
@@ -124,6 +120,21 @@ module PipeDrive
|
|
124
120
|
end
|
125
121
|
new_opts
|
126
122
|
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
126
|
+
def detect_option_value(field_info, value)
|
127
|
+
if value.is_a?(Array)
|
128
|
+
new_value = value.map do |val|
|
129
|
+
target = field_info.options.find{|f| f[:label] == val}
|
130
|
+
target[:id] unless target.nil?
|
131
|
+
end
|
132
|
+
new_value.compact
|
133
|
+
else
|
134
|
+
target = field_info.options.find{|f| f[:label] == value}
|
135
|
+
target.nil? ? nil : target[:id]
|
136
|
+
end
|
137
|
+
end
|
127
138
|
|
128
139
|
end
|
129
140
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipe_drive_ruby_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JiaRou Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|