pipe_drive_ruby_wrapper 0.2.4 → 0.2.5
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/deal.rb +4 -2
- data/lib/pipe_drive/resource_base.rb +7 -2
- 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: d3f1272be9378449508f94f4163c42fffd5607f5aba7de4ea509d8dd276798c8
|
4
|
+
data.tar.gz: c5aa10c325bfce383987ebada3921f97e1822ea2b351c47501eaa82507e97f9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abaabdd5a1e1a2442411640e86a4f7e4eaa69a54177f425244071c558f13f69512a097603f1f621edbd33e71d804c7fd42d75f666c11d530707a0a2e41c1690f
|
7
|
+
data.tar.gz: 5c50e3d45d7b8fa452666bd01b825c53a229ff4a19f9566ecea9ff51c1b0f9c2fc96e5bc1eff49d713b90fc0a7a9b031722b2a6f92bba400bcbcca0a33e5722c
|
data/lib/pipe_drive/deal.rb
CHANGED
@@ -4,11 +4,13 @@ module PipeDrive
|
|
4
4
|
ALLOW_FOR_ADDITION_SEARCH_OPTS = %i[org_id person_id]
|
5
5
|
|
6
6
|
def organization
|
7
|
-
|
7
|
+
pipedrive_org_id = org_id.is_a?(Hash) ? org_id[:value] : org_id
|
8
|
+
Organization.find_by_id(pipedrive_org_id)
|
8
9
|
end
|
9
10
|
|
10
11
|
def person
|
11
|
-
|
12
|
+
pipedrive_person_id = person_id.is_a?(Hash) ? person_id[:value] : person_id
|
13
|
+
Person.find_by_id(pipedrive_person_id)
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -6,8 +6,13 @@ module PipeDrive
|
|
6
6
|
data = attrs[:data] || PipeDrive.hash_except(attrs, [:additional_data])
|
7
7
|
processed_data = {}
|
8
8
|
data.each_pair do |key, value|
|
9
|
-
|
10
|
-
|
9
|
+
key = key.to_s
|
10
|
+
if key.end_with?('_id')
|
11
|
+
field_name = key
|
12
|
+
else
|
13
|
+
field_name_map = self.class.field_names[key]
|
14
|
+
field_name = field_name_map.nil? ? key : field_name_map[:name]
|
15
|
+
end
|
11
16
|
processed_data[field_name] = value
|
12
17
|
end
|
13
18
|
attrs[:data] = processed_data
|