rdgem 0.1.34 → 0.1.35

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rdgem/version.rb +1 -1
  3. data/lib/rdgem.rb +8 -13
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fa8cd365851fab3a9612d6d61b39092f69b8dd7
4
- data.tar.gz: c454a977710e39326967c68dee963d602059ae92
3
+ metadata.gz: de80e8b0822ba009febe13abda7a104e26bc5b50
4
+ data.tar.gz: 334a0de06a81442cfb084be29168ec364aaaffb4
5
5
  SHA512:
6
- metadata.gz: 3e0b608f24f0c29d6ad61e7814ab43417d1f51dc96effecd7f94e920027487768082e11b8e6f454ededacc0e5357e6ad8786e8b6f0c15aaea6a6f052d938522e
7
- data.tar.gz: 04df8316898676b0eb5bb705062e399723f2c4792fc1124eb02f5c8be13e237e3e936ca437e9bcc63940aa9dd23d37eaf007753d747ff653a85ae3dc6d39f0f0
6
+ metadata.gz: 6cb71d06fe8a6749611183f2ea7380c9fb6997c4836a79f86e684b97afc141634dbc891572a834dfea7c5d0d5fee4a2dd21e598743f8ada98ccb310adb40d275
7
+ data.tar.gz: db9764a49a8650f96f359a4919c47abf5831b3c272baa9e8877a2dc8114791eccf214f23d3e936ec1883a39a89dda53c0508a84779a88286965dc66701e813df
data/lib/rdgem/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rdgem
2
- VERSION = "0.1.34"
2
+ VERSION = "0.1.35"
3
3
  end
data/lib/rdgem.rb CHANGED
@@ -5,6 +5,7 @@ require 'httparty'
5
5
 
6
6
  module Rdgem
7
7
  # Your code goes here...
8
+ # global declarations
8
9
  PIPEDRIVE_API = "https://api.pipedrive.com/v1/"
9
10
  TOKEN = "api_token="
10
11
  HEADERS = {'Accept'=>'application/json',
@@ -85,17 +86,17 @@ module Rdgem
85
86
  return field_api_key
86
87
  end
87
88
 
88
- # checks in the account if the custom fields are created.
89
+ #checks if the key is valid and if the custom fields are created in the acc
90
+ # if any field is missing, create it
89
91
  def self.assert_fields(fields, app_key)
90
92
  @field_key = []
91
93
 
92
94
  query = PIPEDRIVE_API + 'personFields?' + TOKEN + app_key
93
95
 
94
96
  response = HTTParty.get(query)
95
- puts "field_key_begin",@field_key
96
97
 
97
98
  if response["success"]
98
- #asserts fields
99
+ #Assert: looks for the desired fields
99
100
  fields.each_with_index do |assert, index|
100
101
  response["data"].each do |search|
101
102
  if search['name'] == assert
@@ -103,16 +104,13 @@ module Rdgem
103
104
  end
104
105
  end
105
106
  end
106
- puts "field_key middle",@field_key
107
107
 
108
- # create missing fields
108
+ # Integrate: create missing fields
109
109
  fields.each_with_index do |create, index|
110
110
  if @field_key[index].blank?
111
- puts "blank field",@field_key[index]
112
111
  @field_key[index] = create_field(app_key, create)
113
112
  end
114
113
  end
115
- puts "field_key end",@field_key
116
114
 
117
115
  #Hash the info
118
116
  custom_field = Hash[fields.zip(@field_key.map \
@@ -122,12 +120,10 @@ module Rdgem
122
120
  return false
123
121
  end
124
122
  end
125
- puts "custom_field", custom_field
123
+ #ship it back
126
124
  return custom_field
127
125
  end
128
-
129
- #checks if the key is valid and if the custom fields are created in the acc
130
- # if any field is missing, create it
126
+
131
127
  ## even if populated the field key will always be replaced
132
128
  def self.create_field(app_key, field_name)
133
129
  field_api_key = false
@@ -153,5 +149,4 @@ module Rdgem
153
149
  end
154
150
  return field_api_key
155
151
  end
156
-
157
- end
152
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.34
4
+ version: 0.1.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - gabriel