pipedrive_jetrockets 0.0.65 → 0.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 327753327598394aaf3d5136ac679a7ca497dcc66ca98c5ec303641c2f16f4c5
4
- data.tar.gz: f1765615916a2c4422d8d74312e14a03db2df36272abc0f4f66cca26c5c72d74
3
+ metadata.gz: 26261f4fc7af1bca9232c1953b4cda1210c54f5f080edd3fdfa11f1192681d3b
4
+ data.tar.gz: 169e2eff78b3c1525a456f3ab3c03f08646a3dbb42626b66138a45a9aa69552e
5
5
  SHA512:
6
- metadata.gz: b9777a459237f665511f5f76f22e3a634a1973c001e54c52ca9c4aa279f9d9c004840610d47bb47055aed3377610ffbd34b6eda91db0b755f87601d72e523cfb
7
- data.tar.gz: 163ba540a73db2933e61b39124e3df6116b4712429347ee8ea8b543b8109a61af99582c9c89444d2fbe4ceb6f96b43682d47b1ce2091299e1269225278a130f1
6
+ metadata.gz: 4aba8b0f6f61d675c6a6529ce6a796331d02283cd1a189fd46b374f8d3529e1304d91dfd67cd81ea2598765cddf3964931f12edbdbb56f318f31a4a28e72c486
7
+ data.tar.gz: 8624a818a92ea732de66771006ffbe1398c3b1c11553b29950ada1228c6560673b95eea495754337f06c35567285ea058f30fa8d0738e3bebb537225367ea8ea
@@ -2,7 +2,8 @@ module PipedriveJetrockets
2
2
  class Person < Entity
3
3
  attr_accessor :email, :phone, :organization, :id
4
4
  def initialize(hash)
5
- super
5
+ @@key_name_hash ||= Pipedrive.person_fields.key_name_hash
6
+ super(hash.except(*@@key_name_hash.keys))
6
7
  @email = hash['email'].first['value'] if hash['email']
7
8
  @phone = hash['phone'].first['value'] if hash['phone']
8
9
 
@@ -16,6 +17,13 @@ module PipedriveJetrockets
16
17
  end
17
18
 
18
19
  @id = hash['value'] if hash['value'].present?
20
+
21
+ @@key_name_hash.each do |key, name|
22
+ name = name.underscore.gsub(' ','_')
23
+ name = name.gsub('%','percent').gsub(/[^a-zA-Z0-9_]/,'')
24
+ instance_variable_set("@#{name}", hash[key])
25
+ Person.class_eval {attr_accessor name}
26
+ end
19
27
  end
20
28
  end
21
29
  end
@@ -0,0 +1,4 @@
1
+ module PipedriveJetrockets
2
+ class PersonField < Entity
3
+ end
4
+ end
@@ -5,6 +5,7 @@ require 'pipedrive_jetrockets/note'
5
5
  require 'pipedrive_jetrockets/organization'
6
6
  require 'pipedrive_jetrockets/organization_field'
7
7
  require 'pipedrive_jetrockets/person'
8
+ require 'pipedrive_jetrockets/person_field'
8
9
  require 'pipedrive_jetrockets/pipeline'
9
10
  require 'pipedrive_jetrockets/stage'
10
11
  require 'pipedrive_jetrockets/user'
@@ -31,6 +31,10 @@ class Pipedrive
31
31
  @@persons_service ||= PipedriveJetrockets::PersonService.new('person')
32
32
  end
33
33
 
34
+ def self.person_fields
35
+ @@person_fields ||= PipedriveJetrockets::FieldService.new('personField')
36
+ end
37
+
34
38
  def self.pipelines
35
39
  @@pipelines_service ||= PipedriveJetrockets::Service.new('pipeline')
36
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipedrive_jetrockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.65
4
+ version: 0.0.66
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agafonov Maksim
@@ -43,6 +43,7 @@ files:
43
43
  - lib/pipedrive_jetrockets/organization.rb
44
44
  - lib/pipedrive_jetrockets/organization_field.rb
45
45
  - lib/pipedrive_jetrockets/person.rb
46
+ - lib/pipedrive_jetrockets/person_field.rb
46
47
  - lib/pipedrive_jetrockets/person_service.rb
47
48
  - lib/pipedrive_jetrockets/pipeline.rb
48
49
  - lib/pipedrive_jetrockets/service.rb