pipe_drive_ruby_wrapper 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 4f9545138731d0e2ad3dfc68a340dce5023b0b4ce3010b321b5a222270a2e3e9
4
- data.tar.gz: d5239ca78ff9cbc2a6a0081e8179295fd21cbe777d7eba161e4e8ec2ff5f4044
3
+ metadata.gz: 975c71b436b22384e3afea10a07730a4c62c455a70d2eb071ad72705ef2eeda2
4
+ data.tar.gz: 29b8c7a98cc9a65744a8b367d150e1f72a3c0684a601034a26a2bb81e00cdaf1
5
5
  SHA512:
6
- metadata.gz: 22a5a43a1303225599a9d135bd39f469218a540da6be0df3e0d075b5281d8df48a68ea7724f69e85eff7a2c5b3fb123c087a7b17731d36c38d50d2911b60dba5
7
- data.tar.gz: 7d69ae0cdb7682c9ee3d4c415d058e38c3a0100c7ca43314f94339b0709da47c87457b478affacf4b0ee0f64677cac93d7907f36566317d68bbd05cba88d1828
6
+ metadata.gz: d1aab8a3d2d54b7154ec3a6c2fa691bafcb6f43170eeaa991821427a1a8c189c0a5db8d267496dc60c68d46fc7a44f4ede08c9c388b957649b2e4c62ff598c03
7
+ data.tar.gz: f64451c47731ae413824f4e5041136eb2a203d0c6193887b2073e36f758c3331dbc617c2991f0e934099075d25a7683a059eadce3c427ca3cf472303c803fe4d
@@ -105,12 +105,12 @@ module PipeDrive
105
105
  def transform_opts(opts)
106
106
  new_opts = {}
107
107
  opts.each_pair do |key, value|
108
- if field_keys[key].nil?
108
+ if resource_class.field_keys[key].nil?
109
109
  new_opts[key] = value
110
110
  else
111
- new_key = field_keys[key][:key]
111
+ new_key = resource_class.field_keys[key][:key]
112
112
  if value.is_a?(Array)
113
- field_info = field_class.find_by_id(field_keys[key][:id])
113
+ field_info = field_class.find_by_id(resource_class.field_keys[key][:id])
114
114
  new_value = value.map do |val|
115
115
  target = field_info.options.find{|f| f[:label] == val}
116
116
  target[:id] unless target.nil?
@@ -8,6 +8,14 @@ module PipeDrive
8
8
 
9
9
  class << self
10
10
 
11
+ def resource_class
12
+ PipeDrive.const_get(correspond_resource.capitalize)
13
+ end
14
+
15
+ def field_class
16
+ self
17
+ end
18
+
11
19
  def correspond_resource
12
20
  resource_name.sub('Field', '')
13
21
  end
@@ -17,6 +17,10 @@ module PipeDrive
17
17
  PipeDrive.field_keys[resource_name.to_sym]
18
18
  end
19
19
 
20
+ def resource_class
21
+ self
22
+ end
23
+
20
24
  def field_class
21
25
  Object.const_get("#{name}Field")
22
26
  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.0
4
+ version: 0.2.1
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-17 00:00:00.000000000 Z
11
+ date: 2018-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec