ruby-redtail 0.3.1 → 0.3.2
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 +8 -8
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/ruby-redtail.rb +1 -0
- data/lib/ruby-redtail/contact.rb +6 -0
- data/lib/ruby-redtail/contact/tag_groups.rb +36 -14
- data/lib/ruby-redtail/{taggroup.rb → tag_group.rb} +11 -2
- data/lib/ruby-redtail/tag_group/contacts.rb +33 -0
- data/lib/ruby-redtail/user/settings.rb +23 -7
- data/ruby-redtail.gemspec +4 -3
- data/test/user_settings_test.rb +4 -4
- data/test/user_test.rb +9 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTYwZWYzZDI2OGU4MWE3N2JmZDE4ZGU5MjEyM2I5YTA3OWJiMDkyMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzkyYzVjNWE1MjMxYTA0NWQzMTRlMjYxNzA3YTU4OGUwYzVlNzEzNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGY4OWEzZWUxYzk4ZDZiZWZmMjZiMGE5YmZmZDc0YjU0ODQzNjQ5ZDc5N2U2
|
10
|
+
ZGQ1ZTZkOWI0OGVhNDkxMDJiNjcxMzc1NmYxMWE5ZTM2MTRjMWQ0NjIxNWU0
|
11
|
+
MDgxMmYyMjkwZjMyMzgxMzQxYzJiY2JlOGVlOTU1ZWY1N2IxNGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzNjNzMyMjgyNjQ1NDRmNzk1NGMwM2QyMTU1YzU1M2U2OGY1YTI5NzdkYmQ4
|
14
|
+
ZmEzMDAyZTEzMmYyZTg1NGQ0MTA5YWU1OWNhNmY2NzYyMDI0MWYxZTZhMTcw
|
15
|
+
NjY0YjJlNTliNWYwOTRlYzg3YjEyZTc1NTc5YjZhZTc2YWYwM2I=
|
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/ruby-redtail.rb
CHANGED
data/lib/ruby-redtail/contact.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
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
|
+
|
1
7
|
module RubyRedtail
|
2
8
|
class Contact
|
3
9
|
attr_accessor :api_hash, :id
|
@@ -1,19 +1,41 @@
|
|
1
1
|
module RubyRedtail
|
2
|
-
class
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
14
30
|
|
15
|
-
|
16
|
-
|
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
|
+
|
17
39
|
end
|
18
40
|
end
|
19
41
|
end
|
@@ -1,8 +1,12 @@
|
|
1
1
|
module RubyRedtail
|
2
|
-
class
|
3
|
-
|
2
|
+
class TagGroup
|
3
|
+
|
4
|
+
def initialize(tag_group = {},api_hash)
|
4
5
|
@api_hash = api_hash
|
5
6
|
|
7
|
+
raise ArgumentError unless tag_group['RecID']
|
8
|
+
@id = tag_group['RecID']
|
9
|
+
|
6
10
|
raise ArgumentError if setting.class != Hash
|
7
11
|
setting.each do |key, value|
|
8
12
|
key = key.underscore
|
@@ -10,5 +14,10 @@ module RubyRedtail
|
|
10
14
|
instance_variable_set "@#{key}", value
|
11
15
|
end
|
12
16
|
end
|
17
|
+
|
18
|
+
def contacts
|
19
|
+
RubyRedtail::TagGroup::Contacts.new self.api_hash
|
20
|
+
end
|
21
|
+
|
13
22
|
end
|
14
23
|
end
|
@@ -0,0 +1,33 @@
|
|
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
|
@@ -34,8 +34,8 @@ module RubyRedtail
|
|
34
34
|
|
35
35
|
# Tag Groups Fetch
|
36
36
|
# returns a list of Tag Groups for a user's Database.
|
37
|
-
def
|
38
|
-
|
37
|
+
def tag_groups
|
38
|
+
build_tag_groups_array RubyRedtail::Query.run("settings/taggroups", @api_hash, "GET")
|
39
39
|
end
|
40
40
|
|
41
41
|
# Contact Status List Fetch
|
@@ -92,13 +92,29 @@ module RubyRedtail
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
def
|
96
|
-
RubyRedtail::Taggroup.new(
|
95
|
+
def build_tag_group tag_group_hash
|
96
|
+
RubyRedtail::Taggroup.new(tag_group_hash,@api_hash)
|
97
97
|
end
|
98
98
|
|
99
|
-
def
|
100
|
-
if
|
101
|
-
|
99
|
+
def build_tag_groups_array tag_group_hashes
|
100
|
+
if tag_group_hashes
|
101
|
+
tag_group_hashes.collect { |tag_group_hash| self.build_tag_group tag_group_hash }
|
102
|
+
else
|
103
|
+
raise RubyRedtail::AuthenticationError
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def build_tag_group tag_group_hash
|
108
|
+
if tag_group_hash
|
109
|
+
RubyRedtail::TagGroup.new(tag_group_hash,@api_hash)
|
110
|
+
else
|
111
|
+
raise RubyRedtail::AuthenticationError
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def build_tag_groups_array tag_group_hashes
|
116
|
+
if tag_group_hashes
|
117
|
+
tag_group_hashes.collect { |tag_group_hash| self.build_tag_group tag_group_hash }
|
102
118
|
else
|
103
119
|
raise RubyRedtail::AuthenticationError
|
104
120
|
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.
|
5
|
+
# stub: ruby-redtail 0.3.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "ruby-redtail"
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.2"
|
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"]
|
@@ -40,7 +40,8 @@ Gem::Specification.new do |s|
|
|
40
40
|
"lib/ruby-redtail/query.rb",
|
41
41
|
"lib/ruby-redtail/setting.rb",
|
42
42
|
"lib/ruby-redtail/sso.rb",
|
43
|
-
"lib/ruby-redtail/
|
43
|
+
"lib/ruby-redtail/tag_group.rb",
|
44
|
+
"lib/ruby-redtail/tag_group/contacts.rb",
|
44
45
|
"lib/ruby-redtail/user.rb",
|
45
46
|
"lib/ruby-redtail/user/contacts.rb",
|
46
47
|
"lib/ruby-redtail/user/settings.rb",
|
data/test/user_settings_test.rb
CHANGED
@@ -30,10 +30,10 @@ class UserSettingsTest < Test::Unit::TestCase
|
|
30
30
|
assert_equal(RubyRedtail::Setting, udf.first.class)
|
31
31
|
end
|
32
32
|
|
33
|
-
should "be able to fetch user
|
34
|
-
|
35
|
-
assert_equal(Array,
|
36
|
-
assert_equal(RubyRedtail::
|
33
|
+
should "be able to fetch user tag groups" do
|
34
|
+
tag_groups = @user.settings.tag_groups
|
35
|
+
assert_equal(Array, tag_groups.class)
|
36
|
+
assert_equal(RubyRedtail::TagGroup, tag_groups.first.class)
|
37
37
|
end
|
38
38
|
|
39
39
|
should "be able to fetch user csl" do
|
data/test/user_test.rb
CHANGED
@@ -15,52 +15,52 @@ class UserTest < Test::Unit::TestCase
|
|
15
15
|
|
16
16
|
should "be able to fetch user data via Basic authentication" do
|
17
17
|
user = RubyRedtail::User.new('Basic', @redtail_user_name, @redtail_user_password)
|
18
|
-
assert_nothing_raised(RubyRedtail::AuthenticationError) {
|
18
|
+
assert_nothing_raised(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
19
19
|
end
|
20
20
|
|
21
21
|
should "be able to fetch user data via UserKey authentication" do
|
22
22
|
user = RubyRedtail::User.new('UserKey', @redtail_user_key)
|
23
|
-
assert_nothing_raised(RubyRedtail::AuthenticationError) {
|
23
|
+
assert_nothing_raised(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
24
24
|
end
|
25
25
|
|
26
26
|
should "be able to fetch user data via UserToken authentication" do
|
27
27
|
# TODO: We need a user token
|
28
28
|
# user = RubyRedtail::User.new('UserToken',@redtail_user_token)
|
29
|
-
# assert_nothing_raised(RubyRedtail::AuthenticationError) {
|
29
|
+
# assert_nothing_raised(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
30
30
|
end
|
31
31
|
|
32
32
|
should "be able to fetch user data via Basic authentication block" do
|
33
33
|
RubyRedtail::User.authenticate_via_basic(@redtail_user_name, @redtail_user_password) do |user|
|
34
|
-
assert_nothing_raised(RubyRedtail::AuthenticationError) {
|
34
|
+
assert_nothing_raised(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
should "be able to fetch user data via UserKey authentication block" do
|
39
39
|
RubyRedtail::User.authenticate_via_user_key(@redtail_user_key) do |user|
|
40
|
-
assert_nothing_raised(RubyRedtail::AuthenticationError) {
|
40
|
+
assert_nothing_raised(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
should "be able to fetch user data via UserToken authentication block" do
|
45
45
|
# TODO: We need a user token
|
46
46
|
# RubyRedtail::User.authenticate_via_user_token(@redtail_user_token) do |user|
|
47
|
-
# assert_nothing_raised(RubyRedtail::AuthenticationError) {
|
47
|
+
# assert_nothing_raised(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
48
48
|
# end
|
49
49
|
end
|
50
50
|
|
51
51
|
should "not be able to fetch user data via faulty Basic authentication" do
|
52
52
|
user = RubyRedtail::User.new('Basic', @redtail_user_name, 'hacker_hackity_hack')
|
53
|
-
assert_raise(RubyRedtail::AuthenticationError) {
|
53
|
+
assert_raise(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
54
54
|
end
|
55
55
|
|
56
56
|
should "not be able to fetch user data via faulty UserKey authentication" do
|
57
57
|
user = RubyRedtail::User.new('UserKey', 'hacker_hackity_hack')
|
58
|
-
assert_raise(RubyRedtail::AuthenticationError) {
|
58
|
+
assert_raise(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
59
59
|
end
|
60
60
|
|
61
61
|
should "not be able to fetch user data via faulty UserToken authentication" do
|
62
62
|
user = RubyRedtail::User.new('UserToken', 'hacker_hackity_hack')
|
63
|
-
assert_raise(RubyRedtail::AuthenticationError) {
|
63
|
+
assert_raise(RubyRedtail::AuthenticationError) {tag_groups = user.settings.tag_groups }
|
64
64
|
end
|
65
65
|
|
66
66
|
end
|
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
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Colgate
|
@@ -138,7 +138,8 @@ files:
|
|
138
138
|
- lib/ruby-redtail/query.rb
|
139
139
|
- lib/ruby-redtail/setting.rb
|
140
140
|
- lib/ruby-redtail/sso.rb
|
141
|
-
- lib/ruby-redtail/
|
141
|
+
- lib/ruby-redtail/tag_group.rb
|
142
|
+
- lib/ruby-redtail/tag_group/contacts.rb
|
142
143
|
- lib/ruby-redtail/user.rb
|
143
144
|
- lib/ruby-redtail/user/contacts.rb
|
144
145
|
- lib/ruby-redtail/user/settings.rb
|