ruby-redtail 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjQ1NDgzNGQxOTQxOGUzOWQ4NGM5MGVkNjFmMmE0YjM2MDY2NGQwMw==
4
+ Yzc4NDAwYjY4NDExNDhiY2JjMDJkMzc1NzAxNWNiNWUzZDhjZTU3Zg==
5
5
  data.tar.gz: !binary |-
6
- OTc4ZjNkYjU2YzIzNTJmZDRmMzE5MTdkOTJjODI5OGQwZjk5ZTFmMQ==
6
+ YzY2MmI1YmY5MjhiNzJkYzIyNzMyYjlkZTlhM2RmOTIyOWMxOTQ4Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODZmNmY1ZGVmMDNmMDEzYzk2ZTc0YzIzY2E0NjFjNGI2MTU1ZmI2NTAxNzQ1
10
- M2U4MDIwOTJiMzVhYTNhOWJkMjJkN2U3ZWQ2NTkxYTFiMDc4ZGEyMjFmZWVm
11
- ZWRkZmUwZWM0ZmZkNjU1NWZmMjE0NjIwNGM0ZmY1NWJmYWFiYjg=
9
+ MTg3M2FjZjEwNjI2M2E1YmUwZTFlOTBlOGFkZDg2MzVhMjljOGJlNDViNzRi
10
+ MmEwY2UzYTVlMmFkYmEwYmI2ZDNkMjNmZDc0OWI0N2IxOTljYjAxZTAxNzM5
11
+ NzFiOTc5N2VlYjM3MTk2NzI3OTY0MjllMGFjMTUyZjJhY2YxMzA=
12
12
  data.tar.gz: !binary |-
13
- ODhmNDg5MTMwYTg0YmZjNDFkYzkzNTJkNjFkZmE4YjcwM2ViMjc1ZTVhOWM2
14
- ZjdkODRlODhjZDkwNDZjMGMxMmEyY2Q1MWEyY2U5YmFiMzk2ODYyYzRjYjg3
15
- MDBiNGQ4MjVlYjI5MTNkYTMwMDM3Y2YwNzhjOTJkZDRiYmE3ZjM=
13
+ MjY2ZTEwNzVmNzZkZjk3YzI0MTZiYjZmMjAwYmVlNzFmNWI1YWJmM2ZlOTIx
14
+ ZWU3MDU5YzY3YWIyNWU2NDg2MmY0YWU2ZDg5MjczN2I2NWE2MWE2MmU3Y2Vk
15
+ ZWQ1YzMxOGM5ZjY0MDYyZjdlNDAyNzUxMjBjNTNkYjY0M2Q1NGM=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.4
1
+ 0.3.5
@@ -1,8 +1,8 @@
1
- require 'ruby-redtail/contact/tag_groups'
2
- require 'ruby-redtail/contact/notes'
3
- require 'ruby-redtail/contact/accounts'
4
- require 'ruby-redtail/contact/activities'
5
- require 'ruby-redtail/contact/addresses'
1
+ # require 'ruby-redtail/contact/tag_groups'
2
+ # require 'ruby-redtail/contact/notes'
3
+ # require 'ruby-redtail/contact/accounts'
4
+ # require 'ruby-redtail/contact/activities'
5
+ # require 'ruby-redtail/contact/addresses'
6
6
 
7
7
  module RubyRedtail
8
8
  class Contact
@@ -24,24 +24,24 @@ module RubyRedtail
24
24
  end
25
25
 
26
26
 
27
- def addresses
28
- RubyRedtail::Contact::Addresses.new self.api_hash
29
- end
30
-
31
- def notes
32
- RubyRedtail::Contact::Notes.new self.api_hash
33
- end
34
-
35
- def accounts
36
- RubyRedtail::Contact::Accounts.new self.api_hash
37
- end
38
-
39
- def activities
40
- RubyRedtail::Contact::Activities.new self.api_hash
41
- end
27
+ # def addresses
28
+ # RubyRedtail::Contact::Addresses.new @api_hash
29
+ # end
30
+ #
31
+ # def notes
32
+ # RubyRedtail::Contact::Notes.new @api_hash
33
+ # end
34
+ #
35
+ # def accounts
36
+ # RubyRedtail::Contact::Accounts.new @api_hash
37
+ # end
38
+ #
39
+ # def activities
40
+ # RubyRedtail::Contact::Activities.new @api_hash
41
+ # end
42
42
 
43
43
  def tag_groups
44
- RubyRedtail::Contact::TagGroups.new self.api_hash
44
+ build_tag_groups_array RubyRedtail::Query.run("contacts/#{@contact_id}/taggroups", @api_hash, "GET")["ArrayOfTagGroup"]
45
45
  end
46
46
 
47
47
  # Fetch Contact By Contact Id
@@ -49,7 +49,7 @@ module RubyRedtail
49
49
  # * {0} does nothing
50
50
  # * {1} updates recently viewed
51
51
  def fetch (recent = false, basic = false)
52
- RubyRedtail::Query.run("contacts/#{self.id}?recent=#{recent ? 1 : 0}", @api_hash, "GET")
52
+ RubyRedtail::Query.run("contacts/#{@id}?recent=#{recent ? 1 : 0}", @api_hash, "GET")
53
53
  end
54
54
 
55
55
  # Fetch Basic Contact By Contact Id
@@ -57,84 +57,103 @@ module RubyRedtail
57
57
  # * {0} does nothing
58
58
  # * {1} updates recently viewed
59
59
  def fetch_basic (recent = false, basic = false)
60
- RubyRedtail::Query.run("contacts/#{self.id}/basic?recent=#{recent ? 1 : 0}", @api_hash, "GET")
60
+ RubyRedtail::Query.run("contacts/#{@id}/basic?recent=#{recent ? 1 : 0}", @api_hash, "GET")
61
61
  end
62
62
 
63
63
  # Master Fetch Contact
64
64
  # http://help.redtailtechnology.com/entries/22846682-master-fetch-contacts-contactid-master
65
65
  def fetch_master
66
- RubyRedtail::Query.run("contacts/#{self.id}/master", @api_hash, 'GET')
66
+ RubyRedtail::Query.run("contacts/#{@id}/master", @api_hash, 'GET')
67
67
  end
68
68
 
69
69
  # Update Contact
70
70
  def update (params)
71
- RubyRedtail::Query.run("contacts/#{self.id}", @api_hash, 'PUT', params)
71
+ RubyRedtail::Query.run("contacts/#{@id}", @api_hash, 'PUT', params)
72
72
  end
73
73
 
74
74
  # Delete Contact
75
75
  def delete
76
- RubyRedtail::Query.run("contacts/#{self.id}", @api_hash, 'DELETE')['Status'] == 0
76
+ RubyRedtail::Query.run("contacts/#{@id}", @api_hash, 'DELETE')['Status'] == 0
77
77
  end
78
78
 
79
79
  # Fetch Contact Details
80
80
  def details
81
- RubyRedtail::Query.run("contacts/#{self.id}/details", @api_hash, "GET")
81
+ RubyRedtail::Query.run("contacts/#{@id}/details", @api_hash, "GET")
82
82
  end
83
83
 
84
84
  # Update Contact Details
85
85
  # Is this required? (Deprecated on API website). Ask Client?
86
86
  def update_details (params)
87
- RubyRedtail::Query.run("contacts/#{self.id}/details", @api_hash, 'PUT', params)
87
+ RubyRedtail::Query.run("contacts/#{@id}/details", @api_hash, 'PUT', params)
88
88
  end
89
89
 
90
90
  # Fetch Contact Family
91
91
  def family
92
- RubyRedtail::Query.run("contacts/#{self.id}/family", @api_hash, "GET")
92
+ RubyRedtail::Query.run("contacts/#{@id}/family", @api_hash, "GET")
93
93
  end
94
94
 
95
95
  # Fetch Contact Memberships
96
96
  def memberships
97
- RubyRedtail::Query.run("contacts/#{self.id}/memberships", @api_hash, "GET")
97
+ RubyRedtail::Query.run("contacts/#{@id}/memberships", @api_hash, "GET")
98
98
  end
99
99
 
100
100
  # Fetch Contact Personal Profile
101
101
  def personal_profile
102
- RubyRedtail::Query.run("contacts/#{self.id}/personalprofile", @api_hash, "GET")
102
+ RubyRedtail::Query.run("contacts/#{@id}/personalprofile", @api_hash, "GET")
103
103
  end
104
104
 
105
105
  # Update Contact Personal Profile
106
106
  def update_personal_profile (personal_profile_id, params)
107
- RubyRedtail::Query.run("contacts/#{self.id}/personalprofile/#{personal_profile_id}", @api_hash, 'PUT', params)
107
+ RubyRedtail::Query.run("contacts/#{@id}/personalprofile/#{personal_profile_id}", @api_hash, 'PUT', params)
108
108
  end
109
109
 
110
110
  # Fetch Contact Important Information
111
111
  def inportant_information
112
- RubyRedtail::Query.run("contacts/#{self.id}/importantinfo", @api_hash, "GET")
112
+ RubyRedtail::Query.run("contacts/#{@id}/importantinfo", @api_hash, "GET")
113
113
  end
114
114
 
115
115
  # Update Contact Important Information
116
116
  def update_important_information (params)
117
- RubyRedtail::Query.run("contacts/#{self.id}/importantinfo", @api_hash, 'PUT', params)
117
+ RubyRedtail::Query.run("contacts/#{@id}/importantinfo", @api_hash, 'PUT', params)
118
118
  end
119
119
 
120
120
  # Fetch Contact Departments
121
121
  def departments
122
- RubyRedtail::Query.run("contacts/#{self.id}/importantinfo", @api_hash, "GET")
122
+ RubyRedtail::Query.run("contacts/#{@id}/importantinfo", @api_hash, "GET")
123
123
  end
124
124
 
125
125
  # Fetch User Defined Fields for Contact
126
126
  def user_defined_fields
127
- RubyRedtail::Query.run("contacts/#{self.id}/udf", @api_hash, "GET")
127
+ RubyRedtail::Query.run("contacts/#{@id}/udf", @api_hash, "GET")
128
128
  end
129
129
 
130
130
  # Update User Defined Field for Contact
131
131
  def update_user_defined_field (udf_id, params)
132
- RubyRedtail::Query.run("contacts/#{self.id}/udf/#{udf_id}", @api_hash, 'PUT', params)
132
+ RubyRedtail::Query.run("contacts/#{@id}/udf/#{udf_id}", @api_hash, 'PUT', params)
133
133
  end
134
134
 
135
135
  # Create User Defined Field for Contact
136
136
  def create_user_defined_field (params)
137
- update_user_defined_field(self.id, 0, params)
137
+ update_user_defined_field(@id, 0, params)
138
138
  end
139
+
140
+ private
141
+
142
+ def build_tag_group tag_group_hash
143
+ if tag_group_hash
144
+ RubyRedtail::TagGroup.new(tag_group_hash,@api_hash)
145
+ else
146
+ raise RubyRedtail::AuthenticationError
147
+ end
148
+ end
149
+
150
+ def build_tag_groups_array tag_group_hashes
151
+ if tag_group_hashes
152
+ tag_group_hashes.collect { |tag_group_hash| self.build_tag_group tag_group_hash }
153
+ else
154
+ raise RubyRedtail::AuthenticationError
155
+ end
156
+ end
157
+
139
158
  end
140
159
  end
@@ -1,9 +1,10 @@
1
1
  module RubyRedtail
2
2
  class Contact
3
- class Accounts
4
- def initialize(contact_id, api_hash)
3
+ class Account
4
+ def initialize(contact_id, account_id, api_hash)
5
5
  @api_hash = api_hash
6
6
  @contact_id = contact_id
7
+ @account_id = account_id
7
8
  end
8
9
 
9
10
  def fetch
@@ -15,11 +16,11 @@ module RubyRedtail
15
16
  end
16
17
 
17
18
  def update (account_id, params)
18
- RubyRedtail::Query.run("contacts/#{contact_id}/accounts/#{account_id}", @api_hash, 'PUT', params)
19
+ RubyRedtail::Query.run("contacts/#{@contact_id}/accounts/#{account_id}", @api_hash, 'PUT', params)
19
20
  end
20
21
 
21
22
  def assets (account_id)
22
- RubyRedtail::Query.run("contacts/#{contact_id}/#{account_id}/assets", @api_hash, "GET")
23
+ RubyRedtail::Query.run("contacts/#{@contact_id}/#{account_id}/assets", @api_hash, "GET")
23
24
  end
24
25
  end
25
26
  end
@@ -18,7 +18,25 @@ module RubyRedtail
18
18
  end
19
19
 
20
20
  def contacts
21
- RubyRedtail::TagGroup::Contacts.new self.api_hash
21
+ build_contacts_array RubyRedtail::Query.run("taggroups/#{@id}/contacts", @api_hash, "GET")["TagMember_Result"]["TagMembers"]
22
+ end
23
+
24
+ private
25
+
26
+ def build_contact contact_hash
27
+ if contact_hash
28
+ RubyRedtail::Contact.new(contact_hash,@api_hash)
29
+ else
30
+ raise RubyRedtail::AuthenticationError
31
+ end
32
+ end
33
+
34
+ def build_contacts_array contact_hashes
35
+ if contact_hashes
36
+ contact_hashes.collect { |contact_hash| self.build_contact contact_hash }
37
+ else
38
+ raise RubyRedtail::AuthenticationError
39
+ end
22
40
  end
23
41
 
24
42
  end
data/ruby-redtail.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: ruby-redtail 0.3.4 ruby lib
5
+ # stub: ruby-redtail 0.3.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "ruby-redtail"
9
- s.version = "0.3.4"
9
+ s.version = "0.3.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Nathan Colgate"]
@@ -35,13 +35,11 @@ Gem::Specification.new do |s|
35
35
  "lib/ruby-redtail/contact/activities.rb",
36
36
  "lib/ruby-redtail/contact/addresses.rb",
37
37
  "lib/ruby-redtail/contact/notes.rb",
38
- "lib/ruby-redtail/contact/tag_groups.rb",
39
38
  "lib/ruby-redtail/exceptions.rb",
40
39
  "lib/ruby-redtail/query.rb",
41
40
  "lib/ruby-redtail/setting.rb",
42
41
  "lib/ruby-redtail/sso.rb",
43
42
  "lib/ruby-redtail/tag_group.rb",
44
- "lib/ruby-redtail/tag_group/contacts.rb",
45
43
  "lib/ruby-redtail/user.rb",
46
44
  "lib/ruby-redtail/user/contacts.rb",
47
45
  "lib/ruby-redtail/user/settings.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-redtail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Colgate
@@ -133,13 +133,11 @@ files:
133
133
  - lib/ruby-redtail/contact/activities.rb
134
134
  - lib/ruby-redtail/contact/addresses.rb
135
135
  - lib/ruby-redtail/contact/notes.rb
136
- - lib/ruby-redtail/contact/tag_groups.rb
137
136
  - lib/ruby-redtail/exceptions.rb
138
137
  - lib/ruby-redtail/query.rb
139
138
  - lib/ruby-redtail/setting.rb
140
139
  - lib/ruby-redtail/sso.rb
141
140
  - lib/ruby-redtail/tag_group.rb
142
- - lib/ruby-redtail/tag_group/contacts.rb
143
141
  - lib/ruby-redtail/user.rb
144
142
  - lib/ruby-redtail/user/contacts.rb
145
143
  - lib/ruby-redtail/user/settings.rb
@@ -1,41 +0,0 @@
1
- module RubyRedtail
2
- class Contact
3
- class TagGroups
4
- def initialize(contact_id,api_hash)
5
- @api_hash = api_hash
6
- @contact_id = contact_id
7
- end
8
-
9
- # def fetch(tag_id)
10
- # RubyRedtail::Query.run("tag_groups/#{tag_id}", @api_hash, "GET")
11
- # end
12
- #
13
- # def fetch_contacts(tag_id)
14
- # RubyRedtail::Query.run("tag_groups/#{tag_id}/contacts", @api_hash, "GET")
15
- # end
16
-
17
- def fetch
18
- build_tag_groups_array RubyRedtail::Query.run("contacts/#{@contact_id}/taggroups", @api_hash, "GET")["ArrayOfTagGroup"]
19
- end
20
-
21
- private
22
-
23
- def build_tag_group tag_group_hash
24
- if tag_group_hash
25
- RubyRedtail::TagGroup.new(tag_group_hash,@api_hash)
26
- else
27
- raise RubyRedtail::AuthenticationError
28
- end
29
- end
30
-
31
- def build_tag_groups_array tag_group_hashes
32
- if tag_group_hashes
33
- tag_group_hashes.collect { |tag_group_hash| self.build_tag_group tag_group_hash }
34
- else
35
- raise RubyRedtail::AuthenticationError
36
- end
37
- end
38
-
39
- end
40
- end
41
- end
@@ -1,33 +0,0 @@
1
- module RubyRedtail
2
- class TagGroup
3
- class Contacts
4
- def initialize(tag_group_id,api_hash)
5
- @api_hash = api_hash
6
- @tag_group_id = tag_group_id
7
- end
8
-
9
- def fetch
10
- build_contacts_array RubyRedtail::Query.run("taggroups/#{@tag_group_id}/contacts", @api_hash, "GET")["TagMember_Result"]["TagMembers"]
11
- end
12
-
13
- private
14
-
15
- def build_contact contact_hash
16
- if contact_hash
17
- RubyRedtail::Contact.new(contact_hash,@api_hash)
18
- else
19
- raise RubyRedtail::AuthenticationError
20
- end
21
- end
22
-
23
- def build_contacts_array contact_hashes
24
- if contact_hashes
25
- contact_hashes.collect { |contact_hash| self.build_contact contact_hash }
26
- else
27
- raise RubyRedtail::AuthenticationError
28
- end
29
- end
30
-
31
- end
32
- end
33
- end