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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pipe_drive/base.rb +14 -11
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcbe72e2bf68f4c523e960b23aedca76b280fe9d553d4d9391ba17d5c4d7b288
4
- data.tar.gz: 9765928e946a864d2c2f64c716f05ac44735ea0c12c41fb0327a05374ab19370
3
+ metadata.gz: 4f9545138731d0e2ad3dfc68a340dce5023b0b4ce3010b321b5a222270a2e3e9
4
+ data.tar.gz: d5239ca78ff9cbc2a6a0081e8179295fd21cbe777d7eba161e4e8ec2ff5f4044
5
5
  SHA512:
6
- metadata.gz: d4adceeb26ab4562d7d137a3fb677de6e1ff606ee47e9f35e69efe8acb9afdfbc492532ecd87a53bdd98f1061732b2157bbaa20612192f044a802ec215708e87
7
- data.tar.gz: ebe709ac759da03fb30c01bed1981b5bb5863d5071dc4b6397f9412feb162dbeac2c8afececd033dfa56dd15cf83934b968bfe6d4b9e01816864b27887f454c2
6
+ metadata.gz: 22a5a43a1303225599a9d135bd39f469218a540da6be0df3e0d075b5281d8df48a68ea7724f69e85eff7a2c5b3fb123c087a7b17731d36c38d50d2911b60dba5
7
+ data.tar.gz: 7d69ae0cdb7682c9ee3d4c415d058e38c3a0100c7ca43314f94339b0709da47c87457b478affacf4b0ee0f64677cac93d7907f36566317d68bbd05cba88d1828
@@ -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
- raise FieldNotExist.new(key) if field_keys[key].nil?
109
- new_key = field_keys[key][:key]
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
- new_value = value
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipe_drive_ruby_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JiaRou Lee