pipe_drive_ruby_wrapper 0.1.0 → 0.1.1
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/field_base.rb +5 -3
- data/lib/pipe_drive/stage.rb +4 -2
- data/lib/pipe_drive_ruby_wrapper.rb +14 -12
- 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: b284c3238b3325431be152a084566d4b72d37c5ff297bfb11454f5efcd30f9b1
|
4
|
+
data.tar.gz: f78170f0a97ec45b6a37d7e0a857c64b161ca549fb60b96c585028f90dac0a69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '088ea8e8b1baeb2f2cbf68bfb5b391c0095d485a5ebc1dca1de372930dd6b213366b555c0f5e501d1223ee9ca82af537d2f2f21f532f387e2ae8fc506a7641ac'
|
7
|
+
data.tar.gz: 7d20b3d12674a628bf73a2d1c176ac3e08e485bdbb466bfe25b06d6a11e1fdef2fe6569cf439bb915475e056afd3c8f9ea805ae9c9aa15d90e4ed32de73c4749
|
@@ -28,12 +28,14 @@ module PipeDrive
|
|
28
28
|
new_field.add_to_field_keys
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def field_keys_map
|
32
|
+
field_keys_map = Hash.new{|hash, key| hash[key] = {}}
|
32
33
|
resource = correspond_resource.to_sym
|
33
34
|
list.each do |field|
|
34
35
|
field_name = parameterize(field.name, '_').to_sym
|
35
|
-
|
36
|
+
field_keys_map[resource][field_name] = field.key
|
36
37
|
end
|
38
|
+
field_keys_map
|
37
39
|
end
|
38
40
|
|
39
41
|
def cache_keys
|
@@ -44,7 +46,7 @@ module PipeDrive
|
|
44
46
|
cache_field_name = parameterize(field_name, '_').to_sym
|
45
47
|
pipedrive_key = cache_keys[cache_field_name]
|
46
48
|
return pipedrive_key unless pipedrive_key.nil?
|
47
|
-
|
49
|
+
PipeDrive.field_keys = nil
|
48
50
|
pipedrive_key = cache_keys[cache_field_name]
|
49
51
|
if pipedrive_key.nil?
|
50
52
|
raise TargetNotFound.new(self.name, :name, field_name)
|
data/lib/pipe_drive/stage.rb
CHANGED
@@ -5,12 +5,14 @@ module PipeDrive
|
|
5
5
|
|
6
6
|
class << self
|
7
7
|
|
8
|
-
def
|
8
|
+
def stage_ids_map
|
9
|
+
stage_ids_map = Hash.new {|hash, key| hash[key] = {}}
|
9
10
|
list.each do |stage|
|
10
11
|
pipeline_name = parameterize(stage.pipeline_name, '_').to_sym
|
11
12
|
stage_name = parameterize(stage.name, '_').to_sym
|
12
|
-
|
13
|
+
stage_ids_map[pipeline_name][stage_name] = stage.id
|
13
14
|
end
|
15
|
+
stage_ids_map
|
14
16
|
end
|
15
17
|
|
16
18
|
end
|
@@ -11,25 +11,27 @@ module PipeDrive
|
|
11
11
|
RESOURCE_CLASSES = %w[Organization Person Deal]
|
12
12
|
FIELD_CLASSES = %w[OrganizationField PersonField DealField]
|
13
13
|
|
14
|
-
class << self; attr_accessor :api_token
|
14
|
+
class << self; attr_accessor :api_token; end
|
15
|
+
class << self; attr_writer :field_keys, :stage_ids; end
|
15
16
|
|
16
17
|
class << self
|
17
18
|
def setup
|
18
19
|
yield self
|
20
|
+
self
|
21
|
+
end
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
if stage_ids.nil?
|
28
|
-
self.stage_ids = Hash.new{|hash, key| hash[key] = {}}
|
29
|
-
Stage.setup_stage_ids
|
23
|
+
def field_keys
|
24
|
+
return @field_keys unless @field_keys.nil? || @field_keys.empty?
|
25
|
+
@field_keys = {}
|
26
|
+
FIELD_CLASSES.each do |class_name|
|
27
|
+
@field_keys.merge!(const_get(class_name).field_keys_map)
|
30
28
|
end
|
29
|
+
@field_keys
|
30
|
+
end
|
31
31
|
|
32
|
-
|
32
|
+
def stage_ids
|
33
|
+
return @stage_ids unless @stage_ids.nil? || @stage_ids.empty?
|
34
|
+
@stage_ids = Stage.stage_ids_map
|
33
35
|
end
|
34
36
|
|
35
37
|
def host
|