rdgem 0.1.6 → 0.1.7
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 +4 -4
- data/lib/rdgem/version.rb +1 -1
- data/lib/rdgem.rb +31 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a51244a214876bdeb47f2775a700e49d7a85bbcc
|
4
|
+
data.tar.gz: 2395912f076cada2b78f10c15e6928f34684a17b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa857fff80bccfb606c16182ec9f557592b6243998b7e413821298d29fca593047f0ea02049a38eddd30e5921bf8453e5acbcb05b7e77ea3f7e4c1f5f698d627
|
7
|
+
data.tar.gz: 1001e2a820eb9fd3376c5e074ba13bc35f2214705202208cd9adee42f421247b77000828ed9e07dec4b58e264a04c216f59344073007019c4826690a5e6abe43
|
data/lib/rdgem/version.rb
CHANGED
data/lib/rdgem.rb
CHANGED
@@ -23,7 +23,6 @@ module Rdgem
|
|
23
23
|
query = PIPEDRIVE_API + 'organizations/find?term=' \
|
24
24
|
+ company + '&start=0&' + TOKEN + app_key
|
25
25
|
response = HTTParty.get(query)
|
26
|
-
puts "response",response
|
27
26
|
#if successfull and with content, get the company app_key
|
28
27
|
#so as not to create another with the same name
|
29
28
|
if response["success"]
|
@@ -31,7 +30,6 @@ module Rdgem
|
|
31
30
|
response["data"].each do |search|
|
32
31
|
if search['name'] == company
|
33
32
|
org_app_id = search['id']
|
34
|
-
puts "org_app_id",org_app_id
|
35
33
|
#not caring about duplicates.
|
36
34
|
#we will ensure we at least won't create any
|
37
35
|
break
|
@@ -44,11 +42,9 @@ module Rdgem
|
|
44
42
|
org_response = HTTParty.post(input_query,
|
45
43
|
:body => {:name =>company},
|
46
44
|
:headers => HEADERS )
|
47
|
-
puts "org_response",org_response
|
48
45
|
|
49
46
|
unless org_response["data"] == nil
|
50
47
|
org_app_id = org_response["data"]["id"]
|
51
|
-
puts "org_app_id", org_app_id
|
52
48
|
end
|
53
49
|
end
|
54
50
|
else
|
@@ -56,4 +52,35 @@ module Rdgem
|
|
56
52
|
end
|
57
53
|
return org_app_id
|
58
54
|
end
|
55
|
+
|
56
|
+
# adds a new field to the owner app_key's account
|
57
|
+
def self.add_field_to_user(app_key, field_name)
|
58
|
+
field_api_key = false
|
59
|
+
|
60
|
+
input_query = PIPEDRIVE_API + 'personFields?' + TOKEN + app_key
|
61
|
+
|
62
|
+
response = HTTParty.post(input_query,
|
63
|
+
:body => {:name =>"#{field_name}", :field_type => "varchar"},
|
64
|
+
:headers => HEADERS )
|
65
|
+
|
66
|
+
unless response["data"] == nil
|
67
|
+
field_api_id = response["data"]["id"]
|
68
|
+
key_query = PIPEDRIVE_API + 'personFields/'\
|
69
|
+
+ field_api_id.to_s + "?" + TOKEN + app_key
|
70
|
+
|
71
|
+
|
72
|
+
field_key_response = HTTParty.get(key_query)
|
73
|
+
|
74
|
+
unless field_key_response["data"] == nil
|
75
|
+
field_api_key = field_key_response["data"]["key"]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
return field_api_key
|
79
|
+
end
|
80
|
+
|
81
|
+
#checks if the key is valid and if the custom fields are created in the acc
|
82
|
+
#creates the custom fields if necessary
|
83
|
+
def self.assert_or_integrate(app_key)
|
84
|
+
|
85
|
+
end
|
59
86
|
end
|