ruby-redtail 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.document +5 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +116 -0
- data/Guardfile +11 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +47 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/lib/ruby-redtail.rb +26 -0
- data/lib/ruby-redtail/accounts.rb +23 -0
- data/lib/ruby-redtail/activities.rb +44 -0
- data/lib/ruby-redtail/addresses.rb +74 -0
- data/lib/ruby-redtail/contacts.rb +118 -0
- data/lib/ruby-redtail/exceptions.rb +6 -0
- data/lib/ruby-redtail/notes.rb +27 -0
- data/lib/ruby-redtail/query.rb +20 -0
- data/lib/ruby-redtail/settings.rb +31 -0
- data/lib/ruby-redtail/tag_groups.rb +19 -0
- data/lib/ruby-redtail/user.rb +84 -0
- data/ruby-redtail.gemspec +80 -0
- data/test/helper.rb +32 -0
- data/test/user_test.rb +72 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2QzZDlhMWI3MjI1N2E5YjRiMWQ0ZmJhMjljMzI4NWI4NTNjN2FlOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTAzYjM4MTY0ZDYzZWE2N2UzNzRmOTcxOTEyMDZlYWExZWNjNGMzMg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDZlZjRlOTE1NDg0ZGNhMmJkYjc3MTQyOGQxZWY1OTBmZjgzZTYzNWU4NmMx
|
10
|
+
NWI1YzFjMzQ4NjIyYWI2NWRhMGU0N2E3ZWM3MTM1NGQyOThlOThlZTAyZWIy
|
11
|
+
ODk2NzA2NzUyNTViOTJlYjY2Y2FlN2FmMTE0OGE1ZWNjYTcxYTE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDdkOTEzYWUzMTljOTZmYjEwY2Q3ZDY1MDc2ZjRjOWViYTUxODcxYWFlZjdm
|
14
|
+
Y2RiZDQxNDkzNDhlMzc0ZTgzMDAwY2Q1OWYwMzg1ZTkxOGE2ZjkyMjAwMDI4
|
15
|
+
MTA1ZTk3MjUwNzhmZDNiZjAxYTdiNDQzOTdmZjg0NzgwNWI5OGI=
|
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem 'httparty'
|
6
|
+
|
7
|
+
# group :test do
|
8
|
+
# gem 'turn', :require => false
|
9
|
+
# end
|
10
|
+
|
11
|
+
# Add dependencies to develop your gem here.
|
12
|
+
# Include everything needed to run rake, tests, features, etc.
|
13
|
+
group :development do
|
14
|
+
gem "shoulda", ">= 0"
|
15
|
+
gem "rdoc", "~> 3.12"
|
16
|
+
gem "bundler", "~> 1.0"
|
17
|
+
gem "jeweler", "~> 2.0.1"
|
18
|
+
gem 'guard'
|
19
|
+
gem 'guard-test'
|
20
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (4.0.3)
|
5
|
+
i18n (~> 0.6, >= 0.6.4)
|
6
|
+
minitest (~> 4.2)
|
7
|
+
multi_json (~> 1.3)
|
8
|
+
thread_safe (~> 0.1)
|
9
|
+
tzinfo (~> 0.3.37)
|
10
|
+
addressable (2.3.5)
|
11
|
+
atomic (1.1.15)
|
12
|
+
builder (3.2.2)
|
13
|
+
celluloid (0.15.2)
|
14
|
+
timers (~> 1.1.0)
|
15
|
+
celluloid-io (0.15.0)
|
16
|
+
celluloid (>= 0.15.0)
|
17
|
+
nio4r (>= 0.5.0)
|
18
|
+
coderay (1.1.0)
|
19
|
+
descendants_tracker (0.0.3)
|
20
|
+
faraday (0.9.0)
|
21
|
+
multipart-post (>= 1.2, < 3)
|
22
|
+
ffi (1.9.3)
|
23
|
+
formatador (0.2.4)
|
24
|
+
git (1.2.6)
|
25
|
+
github_api (0.11.3)
|
26
|
+
addressable (~> 2.3)
|
27
|
+
descendants_tracker (~> 0.0.1)
|
28
|
+
faraday (~> 0.8, < 0.10)
|
29
|
+
hashie (>= 1.2)
|
30
|
+
multi_json (>= 1.7.5, < 2.0)
|
31
|
+
nokogiri (~> 1.6.0)
|
32
|
+
oauth2
|
33
|
+
guard (2.5.1)
|
34
|
+
formatador (>= 0.2.4)
|
35
|
+
listen (~> 2.6)
|
36
|
+
lumberjack (~> 1.0)
|
37
|
+
pry (>= 0.9.12)
|
38
|
+
thor (>= 0.18.1)
|
39
|
+
guard-test (2.0.4)
|
40
|
+
guard (~> 2.0)
|
41
|
+
test-unit (~> 2.2)
|
42
|
+
hashie (2.0.5)
|
43
|
+
highline (1.6.21)
|
44
|
+
httparty (0.13.0)
|
45
|
+
json (~> 1.8)
|
46
|
+
multi_xml (>= 0.5.2)
|
47
|
+
i18n (0.6.9)
|
48
|
+
jeweler (2.0.1)
|
49
|
+
builder
|
50
|
+
bundler (>= 1.0)
|
51
|
+
git (>= 1.2.5)
|
52
|
+
github_api
|
53
|
+
highline (>= 1.6.15)
|
54
|
+
nokogiri (>= 1.5.10)
|
55
|
+
rake
|
56
|
+
rdoc
|
57
|
+
json (1.8.1)
|
58
|
+
jwt (0.1.11)
|
59
|
+
multi_json (>= 1.5)
|
60
|
+
listen (2.7.0)
|
61
|
+
celluloid (>= 0.15.2)
|
62
|
+
celluloid-io (>= 0.15.0)
|
63
|
+
rb-fsevent (>= 0.9.3)
|
64
|
+
rb-inotify (>= 0.9)
|
65
|
+
lumberjack (1.0.4)
|
66
|
+
method_source (0.8.2)
|
67
|
+
mini_portile (0.5.2)
|
68
|
+
minitest (4.7.5)
|
69
|
+
multi_json (1.9.0)
|
70
|
+
multi_xml (0.5.5)
|
71
|
+
multipart-post (2.0.0)
|
72
|
+
nio4r (1.0.0)
|
73
|
+
nokogiri (1.6.1)
|
74
|
+
mini_portile (~> 0.5.0)
|
75
|
+
oauth2 (0.9.3)
|
76
|
+
faraday (>= 0.8, < 0.10)
|
77
|
+
jwt (~> 0.1.8)
|
78
|
+
multi_json (~> 1.3)
|
79
|
+
multi_xml (~> 0.5)
|
80
|
+
rack (~> 1.2)
|
81
|
+
pry (0.9.12.6)
|
82
|
+
coderay (~> 1.0)
|
83
|
+
method_source (~> 0.8)
|
84
|
+
slop (~> 3.4)
|
85
|
+
rack (1.5.2)
|
86
|
+
rake (10.1.1)
|
87
|
+
rb-fsevent (0.9.4)
|
88
|
+
rb-inotify (0.9.3)
|
89
|
+
ffi (>= 0.5.0)
|
90
|
+
rdoc (3.12.2)
|
91
|
+
json (~> 1.4)
|
92
|
+
shoulda (3.5.0)
|
93
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
94
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
95
|
+
shoulda-context (1.1.6)
|
96
|
+
shoulda-matchers (2.5.0)
|
97
|
+
activesupport (>= 3.0.0)
|
98
|
+
slop (3.4.7)
|
99
|
+
test-unit (2.5.5)
|
100
|
+
thor (0.18.1)
|
101
|
+
thread_safe (0.2.0)
|
102
|
+
atomic (>= 1.1.7, < 2)
|
103
|
+
timers (1.1.0)
|
104
|
+
tzinfo (0.3.38)
|
105
|
+
|
106
|
+
PLATFORMS
|
107
|
+
ruby
|
108
|
+
|
109
|
+
DEPENDENCIES
|
110
|
+
bundler (~> 1.0)
|
111
|
+
guard
|
112
|
+
guard-test
|
113
|
+
httparty
|
114
|
+
jeweler (~> 2.0.1)
|
115
|
+
rdoc (~> 3.12)
|
116
|
+
shoulda
|
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
notification :ruby_gntp
|
4
|
+
guard :test do
|
5
|
+
watch(%r{^test/.+_test\.rb$})
|
6
|
+
# watch('test/test_helper.rb') { 'test' }
|
7
|
+
|
8
|
+
# Non-rails
|
9
|
+
watch(%r{^lib/ruby-redtail/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
10
|
+
|
11
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Nathan Colgate
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
= ruby-redtail
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'ruby-redtail'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install ruby-redtail
|
18
|
+
|
19
|
+
== Basic Setup
|
20
|
+
|
21
|
+
Create a file in `config/initializers/ruby-redtail.rb` and add your API Key, User Name, Password And API URI:
|
22
|
+
|
23
|
+
RubyRedtail.configure do |config|
|
24
|
+
config.api_key = ENV['REDTAIL_API_KEY']
|
25
|
+
config.secret_key = ENV['REDTAIL_SECRET_KEY']
|
26
|
+
config.api_uri = ENV['REDTAIL_API_URI']
|
27
|
+
end
|
28
|
+
|
29
|
+
== Contributing to ruby-redtail
|
30
|
+
|
31
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
32
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
33
|
+
* Fork the project.
|
34
|
+
* Start a feature/bugfix branch.
|
35
|
+
* Commit and push until you are happy with your contribution.
|
36
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
37
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
38
|
+
|
39
|
+
== Kudos
|
40
|
+
|
41
|
+
To @sampritipanda for his help in the creation of this gem.
|
42
|
+
|
43
|
+
== Copyright
|
44
|
+
|
45
|
+
Copyright (c) 2014 Nathan Colgate. See LICENSE.txt for
|
46
|
+
further details.
|
47
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "ruby-redtail"
|
18
|
+
gem.homepage = "http://github.com/nathancolgate/ruby-redtail"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{A gem to access the Redtail CRM API}
|
21
|
+
gem.description = %Q{The gem offers various methods to access the Redtail CRM API}
|
22
|
+
gem.email = "nathan@brandnewbox.com"
|
23
|
+
gem.authors = ["Nathan Colgate"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
# test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.pattern = 'test/*_test.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Code coverage detail"
|
37
|
+
task :simplecov do
|
38
|
+
ENV['COVERAGE'] = "true"
|
39
|
+
Rake::Task['test'].execute
|
40
|
+
end
|
41
|
+
|
42
|
+
task :default => :test
|
43
|
+
|
44
|
+
require 'rdoc/task'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
+
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "ruby-redtail #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/ruby-redtail.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "base64"
|
2
|
+
require 'httparty'
|
3
|
+
|
4
|
+
require 'ruby-redtail/user'
|
5
|
+
require 'ruby-redtail/exceptions'
|
6
|
+
require 'ruby-redtail/query'
|
7
|
+
|
8
|
+
module RubyRedtail
|
9
|
+
class << self
|
10
|
+
attr_accessor :config
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.configure
|
14
|
+
self.config ||= Configuration.new
|
15
|
+
yield config
|
16
|
+
raise RubyRedtail::InvalidURIError if (config.api_uri =~ URI::regexp).nil?
|
17
|
+
raise RubyRedtail::AccessKeyError if (config.api_key.empty? || config.secret_key.empty?)
|
18
|
+
config.api_uri << '/' unless config.api_uri[-1, 1] == '/'
|
19
|
+
end
|
20
|
+
|
21
|
+
class Configuration
|
22
|
+
attr_accessor :api_key
|
23
|
+
attr_accessor :api_uri
|
24
|
+
attr_accessor :secret_key
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RubyRedtail
|
2
|
+
class Accounts
|
3
|
+
def initialize (api_hash)
|
4
|
+
@api_hash = api_hash
|
5
|
+
end
|
6
|
+
|
7
|
+
def fetch (contact_id)
|
8
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/accounts", @api_hash, "GET")
|
9
|
+
end
|
10
|
+
|
11
|
+
def update (contact_id, account_id, params)
|
12
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/accounts/#{account_id}", @api_hash, 'PUT', params)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create (contact_id, params)
|
16
|
+
update(contact_id, 0, params)
|
17
|
+
end
|
18
|
+
|
19
|
+
def assets (contact_id, account_id)
|
20
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/#{account_id}/assets", @api_hash, "GET")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module RubyRedtail
|
2
|
+
class Activities
|
3
|
+
|
4
|
+
def initialize api_hash
|
5
|
+
@api_hash = api_hash
|
6
|
+
end
|
7
|
+
|
8
|
+
# Fetch Activity By User Id, Start Date and End Date
|
9
|
+
def fetch_by_user (user_id, start_date, end_date, basic = true, page = 1)
|
10
|
+
RubyRedtail::Query.run("calendar/#{user_id}#{"/basic" if basic}?startdate=#{start_date}&enddate=#{end_date}&page=#{page}", @api_hash, "GET")
|
11
|
+
end
|
12
|
+
|
13
|
+
# Fetch Activity By Activity Id
|
14
|
+
def fetch (activity_id)
|
15
|
+
RubyRedtail::Query.run("calendar/activities/#{activity_id}", @api_hash, "GET")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Update Activity
|
19
|
+
def update(activity_id, params)
|
20
|
+
RubyRedtail::Query.run("calendar/activities/#{activity_id}", @api_hash, 'PUT', params)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Create new Activity
|
24
|
+
def create(params)
|
25
|
+
update(0, params)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Mark Activity as Complete
|
29
|
+
def mark_complete(activity_id)
|
30
|
+
RubyRedtail::Query.run("calendar/activities/#{activity_id}/complete", @api_hash, "PUT")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Fetch List of Recent Activities
|
34
|
+
def recent(start_date, page = 1)
|
35
|
+
RubyRedtail::Query.run("calendar/activities/recent?startdate=#{start_date}&page=#{page}", @api_hash, "GET")
|
36
|
+
end
|
37
|
+
|
38
|
+
# Fetch Activities By Contact Id
|
39
|
+
def fetch_by_contact (contact_id, start_date, end_date, basic = true, page = 1)
|
40
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/activities#{"/basic" if basic}?startdate=#{start_date}&enddate=#{end_date}&page=#{page}", @api_hash, "GET")
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module RubyRedtail
|
2
|
+
class Addresses
|
3
|
+
|
4
|
+
def initialize(api_hash)
|
5
|
+
@api_hash = api_hash
|
6
|
+
end
|
7
|
+
|
8
|
+
# Fetch Address By Contact Id
|
9
|
+
def fetch (contact_id)
|
10
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/addresses", @api_hash, "GET")
|
11
|
+
end
|
12
|
+
|
13
|
+
# Update Address
|
14
|
+
def update (contact_id, address_id, params)
|
15
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/addresses/#{address_id}", @api_hash, 'PUT', params)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Create New Address
|
19
|
+
def create (contact_id, params)
|
20
|
+
update(contact_id, 0, params)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Delete Address
|
24
|
+
def delete (contact_id, address_id)
|
25
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/addresses/#{address_id}", @api_hash, 'DELETE')
|
26
|
+
end
|
27
|
+
|
28
|
+
# Fetch Phones By Contact Id
|
29
|
+
def phones (contact_id)
|
30
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/phones", @api_hash, "GET")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Update Phone
|
34
|
+
def update_phone (contact_id, phone_id, params)
|
35
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/phones/#{phone_id}", @api_hash, 'PUT', params)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create New Phone
|
39
|
+
def create_phone (contact_id, params)
|
40
|
+
update(contact_id, 0, params)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Delete Phone
|
44
|
+
def delete_phone (contact_id, phone_id)
|
45
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/phones/#{phone_id}", @api_hash, 'DELETE')
|
46
|
+
end
|
47
|
+
|
48
|
+
# Fetch Internet Addresses By Contact Id
|
49
|
+
def internet_addresses (contact_id)
|
50
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/internets", @api_hash, "GET")
|
51
|
+
end
|
52
|
+
|
53
|
+
# Update Internet Address
|
54
|
+
def update_internet_address (contact_id, internet_id, params)
|
55
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/phones/#{internet_id}", @api_hash, 'PUT', params)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Create New Internet Address
|
59
|
+
def create_internet_address (contact_id, params)
|
60
|
+
update_internet_address(contact_id, 0, params)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Delete Internet Address
|
64
|
+
def delete_internet_address (contact_id, internet_id)
|
65
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/phones/#{internet_id}", @api_hash, 'DELETE')
|
66
|
+
end
|
67
|
+
|
68
|
+
# Fetch Assets and Liabilities
|
69
|
+
def assets_and_liabilities (contact_id)
|
70
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/assets-liabilities", @api_hash, "GET")
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module RubyRedtail
|
2
|
+
class Contacts
|
3
|
+
|
4
|
+
CONTACT_SEARCH_FIELDS = ['LastUpdate','Name','RecAdd','PhoneNumber','Tag_Group','FirstName','LastName','FamilyName','FamilyHead','ClientStatus','ContactType','ClientSource','TaxId']
|
5
|
+
CONTACT_SEARCH_OPERANDS = ['=','>','<','!=','Like','BeginsWith','IsEmpty']
|
6
|
+
|
7
|
+
def initialize(api_hash)
|
8
|
+
@api_hash = api_hash
|
9
|
+
end
|
10
|
+
|
11
|
+
# Search Contact By Name or Part of Name
|
12
|
+
def search_by_name (value, page = 1)
|
13
|
+
RubyRedtail::Query.run("contacts/search?value=#{value}&page=#{page}", @api_hash, "GET")["Contacts"]
|
14
|
+
end
|
15
|
+
|
16
|
+
# TODO: Test this properly
|
17
|
+
# Search Contact by Custom Query
|
18
|
+
def search (query, page = 1)
|
19
|
+
body = Array.new(query.length) { {} }
|
20
|
+
query.each_with_index do |expr, i|
|
21
|
+
body[i]["Field"] = CONTACT_SEARCH_FIELDS.index expr[0]
|
22
|
+
body[i]["Operand"] = CONTACT_SEARCH_OPERANDS.index expr[1]
|
23
|
+
body[i]["Value"] = expr[2]
|
24
|
+
end
|
25
|
+
RubyRedtail::Query.run("contacts/search?page=#{page}", @api_hash, "POST", body)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Fetch Contact By Contact Id
|
29
|
+
def fetch (contact_id, recent = false, basic = false)
|
30
|
+
if basic
|
31
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/basic?recent=#{recent ? 1 : 0}", @api_hash, "GET")
|
32
|
+
else
|
33
|
+
RubyRedtail::Query.run("contacts/#{contact_id}?recent=#{recent ? 1 : 0}", @api_hash, "GET")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Update Contact
|
38
|
+
def update (contact_id, params)
|
39
|
+
RubyRedtail::Query.run("contacts/#{contact_id}", @api_hash, 'PUT', params)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Create New Contact
|
43
|
+
def create (params)
|
44
|
+
update(0, params)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Delete Contact
|
48
|
+
def delete (contact_id)
|
49
|
+
RubyRedtail::Query.run("contacts/#{contact_id}", @api_hash, 'DELETE')['Status'] == 0
|
50
|
+
end
|
51
|
+
|
52
|
+
# Master Fetch Contact
|
53
|
+
def master_fetch (contact_id)
|
54
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/master", @api_hash, 'GET')
|
55
|
+
end
|
56
|
+
|
57
|
+
# Fetch Contact Details
|
58
|
+
def details (contact_id)
|
59
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/details", @api_hash, "GET")
|
60
|
+
end
|
61
|
+
|
62
|
+
# Update Contact Details
|
63
|
+
# Is this required? (Deprecated on API website). Ask Client?
|
64
|
+
def update_details (contact_id, params)
|
65
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/details", @api_hash, 'PUT', params)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Fetch Contact Family
|
69
|
+
def family (contact_id)
|
70
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/family", @api_hash, "GET")
|
71
|
+
end
|
72
|
+
|
73
|
+
# Fetch Contact Memberships
|
74
|
+
def memberships (contact_id)
|
75
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/memberships", @api_hash, "GET")
|
76
|
+
end
|
77
|
+
|
78
|
+
# Fetch Contact Personal Profile
|
79
|
+
def personal_profile (contact_id)
|
80
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/personalprofile", @api_hash, "GET")
|
81
|
+
end
|
82
|
+
|
83
|
+
# Update Contact Personal Profile
|
84
|
+
def update_personal_profile (contact_id, personal_profile_id, params)
|
85
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/personalprofile/#{personal_profile_id}", @api_hash, 'PUT', params)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Fetch Contact Important Information
|
89
|
+
def inportant_information (contact_id)
|
90
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/importantinfo", @api_hash, "GET")
|
91
|
+
end
|
92
|
+
|
93
|
+
# Update Contact Important Information
|
94
|
+
def update_important_information (contact_id, params)
|
95
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/importantinfo", @api_hash, 'PUT', params)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Fetch Contact Departments
|
99
|
+
def departments (contact_id)
|
100
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/importantinfo", @api_hash, "GET")
|
101
|
+
end
|
102
|
+
|
103
|
+
# Fetch User Defined Fields for Contact
|
104
|
+
def user_defined_fields (contact_id)
|
105
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/udf", @api_hash, "GET")
|
106
|
+
end
|
107
|
+
|
108
|
+
# Update User Defined Field for Contact
|
109
|
+
def update_user_defined_field (contact_id, udf_id, params)
|
110
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/udf/#{udf_id}", @api_hash, 'PUT', params)
|
111
|
+
end
|
112
|
+
|
113
|
+
# Create User Defined Field for Contact
|
114
|
+
def create_user_defined_field (contact_id, params)
|
115
|
+
update_user_defined_field(contact_id, 0, params)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module RubyRedtail
|
2
|
+
class Notes
|
3
|
+
def initialize (api_hash)
|
4
|
+
@api_hash = api_hash
|
5
|
+
end
|
6
|
+
|
7
|
+
# Fetch Notes By Contact Id
|
8
|
+
def fetch (contact_id, page = 1)
|
9
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/notes?page=#{page}", @api_hash, "GET")
|
10
|
+
end
|
11
|
+
|
12
|
+
# Update Note
|
13
|
+
def update (contact_id, note_id, params)
|
14
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/notes/#{note_id}", @api_hash, 'PUT', params)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Create New Note
|
18
|
+
def create (contact_id, params)
|
19
|
+
update(contact_id, 0, params)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Fetch Recently Added Notes
|
23
|
+
def recent
|
24
|
+
RubyRedtail::Query.run("contacts/notes/recent", @api_hash, 'GET')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RubyRedtail
|
2
|
+
class Query
|
3
|
+
# TODO: Refactor (Lots of repetition)
|
4
|
+
def self.run (uri, auth_hash, method, request_body = nil)
|
5
|
+
base_uri = RubyRedtail.config.api_uri
|
6
|
+
if method == "GET" || method == "POST"
|
7
|
+
@response = HTTParty.get(base_uri + uri, :headers => {"Authorization" => auth_hash, 'Content-Type' => 'text/json'}).parsed_response
|
8
|
+
elsif method == "POST"
|
9
|
+
@response = HTTParty.post(base_uri + uri, :headers => {"Authorization" => auth_hash, 'Content-Type' => 'text/json'}, :body => request_body.to_json).parsed_response
|
10
|
+
elsif method == "PUT"
|
11
|
+
@response = HTTParty.put(base_uri + uri, :headers => {"Authorization" => auth_hash, 'Content-Type' => 'text/json'}, :body => request_body.to_json).parsed_response
|
12
|
+
elsif method == "DELETE"
|
13
|
+
@response = HTTParty.post(base_uri + uri, :headers => {"Authorization" => auth_hash, 'Content-Type' => 'text/json'}, :body => "").parsed_response
|
14
|
+
end
|
15
|
+
|
16
|
+
return @response
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RubyRedtail
|
2
|
+
class Settings
|
3
|
+
METHODS = {
|
4
|
+
:activity_types => 'activitytypes',
|
5
|
+
:master_categories => 'mcl',
|
6
|
+
:salutations => 'salutations',
|
7
|
+
:user_defined_fields => 'udf',
|
8
|
+
:tag_groups => 'taggroups'
|
9
|
+
}
|
10
|
+
METHODS_WITH_DELETE = {
|
11
|
+
:contact_statuses => 'csl',
|
12
|
+
:contact_categories => 'mccl',
|
13
|
+
:contact_sources => 'mcsl',
|
14
|
+
:servicing_advisors => 'sal',
|
15
|
+
:writing_advisors => 'wal'
|
16
|
+
}
|
17
|
+
|
18
|
+
def initialize api_hash
|
19
|
+
@api_hash = api_hash
|
20
|
+
end
|
21
|
+
|
22
|
+
METHODS.each do |name, uri|
|
23
|
+
define_method(name) { RubyRedtail::Query.run("settings/#{uri}", @api_hash, "GET") }
|
24
|
+
end
|
25
|
+
|
26
|
+
METHODS_WITH_DELETE.each do |name, uri|
|
27
|
+
define_method(name) { |deleted=false| RubyRedtail::Query.run("settings/#{uri}?deleted=#{deleted ? 1 : 0}", @api_hash, "GET")}
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RubyRedtail
|
2
|
+
class TagGroups
|
3
|
+
def initialize api_hash
|
4
|
+
@api_hash = api_hash
|
5
|
+
end
|
6
|
+
|
7
|
+
def fetch(tag_id)
|
8
|
+
RubyRedtail::Query.run("taggroups/#{tag_id}", @api_hash, "GET")
|
9
|
+
end
|
10
|
+
|
11
|
+
def fetch_contacts(tag_id)
|
12
|
+
RubyRedtail::Query.run("taggroups/#{tag_id}/contacts", @api_hash, "GET")
|
13
|
+
end
|
14
|
+
|
15
|
+
def fetch_by_contact(contact_id)
|
16
|
+
RubyRedtail::Query.run("contacts/#{contact_id}/taggroups", @api_hash, "GET")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'ruby-redtail/contacts'
|
2
|
+
require 'ruby-redtail/addresses'
|
3
|
+
require 'ruby-redtail/notes'
|
4
|
+
require 'ruby-redtail/accounts'
|
5
|
+
require 'ruby-redtail/activities'
|
6
|
+
require 'ruby-redtail/tag_groups'
|
7
|
+
require 'ruby-redtail/settings'
|
8
|
+
|
9
|
+
module RubyRedtail
|
10
|
+
class User
|
11
|
+
attr_accessor :api_hash
|
12
|
+
|
13
|
+
def initialize type, *args
|
14
|
+
if type == "Basic"
|
15
|
+
self.api_hash = "Basic " + Base64.strict_encode64("#{RubyRedtail.config.api_key}:#{args[0]}:#{args[1]}")
|
16
|
+
elsif type == "UserKey"
|
17
|
+
self.api_hash = "Userkeyauth " + Base64.strict_encode64("#{RubyRedtail.config.api_key}:#{args[0]}")
|
18
|
+
elsif type == "UserToken"
|
19
|
+
self.api_hash = "UsertokenAuth " + Base64.strict_encode64("#{RubyRedtail.config.api_key}:#{args[0]}")
|
20
|
+
else
|
21
|
+
raise ArgumentError
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.authenticate_via_basic(username, password)
|
26
|
+
yield self.new('Basic',username,password)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.authenticate_via_user_key(key)
|
30
|
+
yield self.new('UserKey',key)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.authenticate_via_user_token(token)
|
34
|
+
yield self.new('UserToken',token)
|
35
|
+
end
|
36
|
+
|
37
|
+
# def self.method_missing(method_name, *args)
|
38
|
+
# method_array = method_name.to_s.split('_')
|
39
|
+
# if method_array.first == 'authenticate'
|
40
|
+
# type = method_array[2]
|
41
|
+
# type += ('' if type == 'basic') || ('auth' if type == 'userkey') || 'Auth'
|
42
|
+
# yield RubyRedtail::User.new type.to_s.capitalize, *args
|
43
|
+
# else
|
44
|
+
# super
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
|
48
|
+
def authentication
|
49
|
+
RubyRedtail::Query.run("authentication", self.api_hash, "GET")
|
50
|
+
end
|
51
|
+
|
52
|
+
def sso
|
53
|
+
Redtail::Query.run("sso", self.api_hash, "GET")
|
54
|
+
end
|
55
|
+
|
56
|
+
def contacts
|
57
|
+
RubyRedtail::Contacts.new self.api_hash
|
58
|
+
end
|
59
|
+
|
60
|
+
def addresses
|
61
|
+
RubyRedtail::Addresses.new self.api_hash
|
62
|
+
end
|
63
|
+
|
64
|
+
def notes
|
65
|
+
RubyRedtail::Notes.new self.api_hash
|
66
|
+
end
|
67
|
+
|
68
|
+
def accounts
|
69
|
+
RubyRedtail::Accounts.new self.api_hash
|
70
|
+
end
|
71
|
+
|
72
|
+
def activities
|
73
|
+
RubyRedtail::Activities.new self.api_hash
|
74
|
+
end
|
75
|
+
|
76
|
+
def tag_groups
|
77
|
+
RubyRedtail::TagGroups.new self.api_hash
|
78
|
+
end
|
79
|
+
|
80
|
+
def settings
|
81
|
+
RubyRedtail::Settings.new self.api_hash
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: ruby-redtail 0.1.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "ruby-redtail"
|
9
|
+
s.version = "0.1.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Nathan Colgate"]
|
13
|
+
s.date = "2014-03-07"
|
14
|
+
s.description = "The gem offers various methods to access the Redtail CRM API"
|
15
|
+
s.email = "nathan@brandnewbox.com"
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"Guardfile",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/ruby-redtail.rb",
|
30
|
+
"lib/ruby-redtail/accounts.rb",
|
31
|
+
"lib/ruby-redtail/activities.rb",
|
32
|
+
"lib/ruby-redtail/addresses.rb",
|
33
|
+
"lib/ruby-redtail/contacts.rb",
|
34
|
+
"lib/ruby-redtail/exceptions.rb",
|
35
|
+
"lib/ruby-redtail/notes.rb",
|
36
|
+
"lib/ruby-redtail/query.rb",
|
37
|
+
"lib/ruby-redtail/settings.rb",
|
38
|
+
"lib/ruby-redtail/tag_groups.rb",
|
39
|
+
"lib/ruby-redtail/user.rb",
|
40
|
+
"ruby-redtail.gemspec",
|
41
|
+
"test/helper.rb",
|
42
|
+
"test/user_test.rb"
|
43
|
+
]
|
44
|
+
s.homepage = "http://github.com/nathancolgate/ruby-redtail"
|
45
|
+
s.licenses = ["MIT"]
|
46
|
+
s.require_paths = ["lib"]
|
47
|
+
s.rubygems_version = "2.1.11"
|
48
|
+
s.summary = "A gem to access the Redtail CRM API"
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
s.specification_version = 4
|
52
|
+
|
53
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
57
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
59
|
+
s.add_development_dependency(%q<guard>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<guard-test>, [">= 0"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
63
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
64
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
65
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
66
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
67
|
+
s.add_dependency(%q<guard>, [">= 0"])
|
68
|
+
s.add_dependency(%q<guard-test>, [">= 0"])
|
69
|
+
end
|
70
|
+
else
|
71
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
72
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
73
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
74
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
75
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
76
|
+
s.add_dependency(%q<guard>, [">= 0"])
|
77
|
+
s.add_dependency(%q<guard-test>, [">= 0"])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'ruby-redtail'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
def setup
|
19
|
+
@redtail_api_key = 'E45FC97D-5AB2-4FD7-B05F-80BC64227A80'
|
20
|
+
@redtail_secret_key = '31CE58601D694E31B681C209D29936F6'
|
21
|
+
@redtail_uri = 'http://dev.api2.redtailtechnology.com/crm/v1/rest'
|
22
|
+
@redtail_user_key = 'CF5DAEC8-4F73-404C-9F1A-8C944F2DDC51'
|
23
|
+
@redtail_user_name = 'Statementone'
|
24
|
+
@redtail_user_password = 'sonedemo'
|
25
|
+
@num = 4
|
26
|
+
RubyRedtail.configure do |config|
|
27
|
+
config.api_key = @redtail_api_key
|
28
|
+
config.secret_key = @redtail_secret_key
|
29
|
+
config.api_uri = @redtail_uri
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/test/user_test.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class UserTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
should "be able to fetch UserKey via Basic authentication" do
|
6
|
+
user = RubyRedtail::User.new('Basic', @redtail_user_name, @redtail_user_password)
|
7
|
+
authentication = user.authentication
|
8
|
+
assert_equal("Success", authentication["Message"])
|
9
|
+
assert_equal(41974, authentication["UserID"])
|
10
|
+
assert_equal(@redtail_user_key, authentication["UserKey"])
|
11
|
+
end
|
12
|
+
|
13
|
+
should "be able to fetch user data via Basic authentication" do
|
14
|
+
user = RubyRedtail::User.new('Basic', @redtail_user_name, @redtail_user_password)
|
15
|
+
tag_groups = user.settings.tag_groups
|
16
|
+
assert_equal(Array, tag_groups.class)
|
17
|
+
end
|
18
|
+
|
19
|
+
should "be able to fetch user data via UserKey authentication" do
|
20
|
+
user = RubyRedtail::User.new('UserKey', @redtail_user_key)
|
21
|
+
tag_groups = user.settings.tag_groups
|
22
|
+
assert_equal(Array, tag_groups.class)
|
23
|
+
end
|
24
|
+
|
25
|
+
should "be able to fetch user data via UserToken authentication" do
|
26
|
+
# TODO: We need a user token
|
27
|
+
# user = RubyRedtail::User.new('UserToken',@redtail_user_token)
|
28
|
+
# tag_groups = user.settings.tag_groups
|
29
|
+
# assert_equal(Array,tag_groups.class)
|
30
|
+
end
|
31
|
+
|
32
|
+
should "be able to fetch user data via Basic authentication block" do
|
33
|
+
RubyRedtail::User.authenticate_via_basic(@redtail_user_name, @redtail_user_password) do |user|
|
34
|
+
tag_groups = user.settings.tag_groups
|
35
|
+
assert_equal(Array, tag_groups.class)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
should "be able to fetch user data via UserKey authentication block" do
|
40
|
+
RubyRedtail::User.authenticate_via_user_key(@redtail_user_key) do |user|
|
41
|
+
tag_groups = user.settings.tag_groups
|
42
|
+
assert_equal(Array, tag_groups.class)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
should "be able to fetch user data via UserToken authentication block" do
|
47
|
+
# TODO: We need a user token
|
48
|
+
# RubyRedtail::User.authenticate_via_user_token(@redtail_user_token) do |user|
|
49
|
+
# tag_groups = user.settings.tag_groups
|
50
|
+
# assert_equal(Array,tag_groups.class)
|
51
|
+
# end
|
52
|
+
end
|
53
|
+
|
54
|
+
should "not be able to fetch user data via faulty Basic authentication" do
|
55
|
+
user = RubyRedtail::User.new('Basic', @redtail_user_name, 'hacker_hackity_hack')
|
56
|
+
tag_groups = user.settings.tag_groups
|
57
|
+
assert_equal(nil, tag_groups)
|
58
|
+
end
|
59
|
+
|
60
|
+
should "not be able to fetch user data via faulty UserKey authentication" do
|
61
|
+
user = RubyRedtail::User.new('UserKey', 'hacker_hackity_hack')
|
62
|
+
tag_groups = user.settings.tag_groups
|
63
|
+
assert_equal(nil, tag_groups)
|
64
|
+
end
|
65
|
+
|
66
|
+
should "not be able to fetch user data via faulty UserToken authentication" do
|
67
|
+
user = RubyRedtail::User.new('UserToken', 'hacker_hackity_hack')
|
68
|
+
tag_groups = user.settings.tag_groups
|
69
|
+
assert_equal(nil, tag_groups)
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
metadata
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-redtail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nathan Colgate
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: shoulda
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: !binary |-
|
48
|
+
My4xMg==
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: !binary |-
|
56
|
+
My4xMg==
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: bundler
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ~>
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: jeweler
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.0.1
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ~>
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 2.0.1
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: guard
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: guard-test
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
type: :development
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
description: The gem offers various methods to access the Redtail CRM API
|
114
|
+
email: nathan@brandnewbox.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files:
|
118
|
+
- LICENSE.txt
|
119
|
+
- README.rdoc
|
120
|
+
files:
|
121
|
+
- .document
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- Guardfile
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.rdoc
|
127
|
+
- Rakefile
|
128
|
+
- VERSION
|
129
|
+
- lib/ruby-redtail.rb
|
130
|
+
- lib/ruby-redtail/accounts.rb
|
131
|
+
- lib/ruby-redtail/activities.rb
|
132
|
+
- lib/ruby-redtail/addresses.rb
|
133
|
+
- lib/ruby-redtail/contacts.rb
|
134
|
+
- lib/ruby-redtail/exceptions.rb
|
135
|
+
- lib/ruby-redtail/notes.rb
|
136
|
+
- lib/ruby-redtail/query.rb
|
137
|
+
- lib/ruby-redtail/settings.rb
|
138
|
+
- lib/ruby-redtail/tag_groups.rb
|
139
|
+
- lib/ruby-redtail/user.rb
|
140
|
+
- ruby-redtail.gemspec
|
141
|
+
- test/helper.rb
|
142
|
+
- test/user_test.rb
|
143
|
+
homepage: http://github.com/nathancolgate/ruby-redtail
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ! '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.1.11
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: A gem to access the Redtail CRM API
|
167
|
+
test_files: []
|