rubyzoho 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +3 -0
- data/.rvmrc +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +84 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +39 -0
- data/Rakefile +60 -0
- data/VERSION +1 -0
- data/lib/api_utils.rb +21 -0
- data/lib/ruby_zoho.rb +221 -0
- data/lib/zoho_api.rb +118 -0
- data/rubyzoho.gemspec +92 -0
- data/spec/api_utils_spec.rb +33 -0
- data/spec/fixtures/sample_contact.xml +2 -0
- data/spec/fixtures/sample_contact_search.xml +2 -0
- data/spec/fixtures/sample_contacts.xml +2 -0
- data/spec/fixtures/sample_contacts_list.xml +2 -0
- data/spec/fixtures/sample_leads_list.xml +2 -0
- data/spec/ruby_zoho_spec.rb +127 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/zoho_api_spec.rb +78 -0
- metadata +247 -0
data/.document
ADDED
data/.rspec
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.3@rubyzoho --create
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
|
9
|
+
gem 'httparty'
|
10
|
+
gem 'roxml'
|
11
|
+
|
12
|
+
|
13
|
+
group :development, :test do
|
14
|
+
gem "bundler"
|
15
|
+
gem 'cucumber'
|
16
|
+
gem "jeweler", "~> 1.8.4"
|
17
|
+
gem 'relish'
|
18
|
+
gem "rdoc"
|
19
|
+
gem 'rspec', ">= 2.12.0"
|
20
|
+
gem "shoulda", ">= 0"
|
21
|
+
gem 'xml-simple'
|
22
|
+
gem 'simplecov', :require => false, :group => :test
|
23
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.2.11)
|
5
|
+
i18n (~> 0.6)
|
6
|
+
multi_json (~> 1.0)
|
7
|
+
archive-tar-minitar (0.5.2)
|
8
|
+
bourne (1.1.2)
|
9
|
+
mocha (= 0.10.5)
|
10
|
+
builder (3.1.4)
|
11
|
+
cucumber (1.2.1)
|
12
|
+
builder (>= 2.1.2)
|
13
|
+
diff-lcs (>= 1.1.3)
|
14
|
+
gherkin (~> 2.11.0)
|
15
|
+
json (>= 1.4.6)
|
16
|
+
diff-lcs (1.1.3)
|
17
|
+
gherkin (2.11.6)
|
18
|
+
json (>= 1.7.6)
|
19
|
+
git (1.2.5)
|
20
|
+
httparty (0.10.2)
|
21
|
+
multi_json (~> 1.0)
|
22
|
+
multi_xml (>= 0.5.2)
|
23
|
+
i18n (0.6.1)
|
24
|
+
jeweler (1.8.4)
|
25
|
+
bundler (~> 1.0)
|
26
|
+
git (>= 1.2.5)
|
27
|
+
rake
|
28
|
+
rdoc
|
29
|
+
json (1.7.6)
|
30
|
+
metaclass (0.0.1)
|
31
|
+
mime-types (1.19)
|
32
|
+
mocha (0.10.5)
|
33
|
+
metaclass (~> 0.0.1)
|
34
|
+
multi_json (1.5.0)
|
35
|
+
multi_xml (0.5.2)
|
36
|
+
nokogiri (1.5.6)
|
37
|
+
rake (10.0.3)
|
38
|
+
rdoc (3.12)
|
39
|
+
json (~> 1.4)
|
40
|
+
relish (0.6)
|
41
|
+
archive-tar-minitar (>= 0.5.2)
|
42
|
+
json (>= 1.4.6)
|
43
|
+
rest-client (>= 1.6.1)
|
44
|
+
rest-client (1.6.7)
|
45
|
+
mime-types (>= 1.16)
|
46
|
+
roxml (3.3.1)
|
47
|
+
activesupport (>= 2.3.0)
|
48
|
+
nokogiri (>= 1.3.3)
|
49
|
+
rspec (2.12.0)
|
50
|
+
rspec-core (~> 2.12.0)
|
51
|
+
rspec-expectations (~> 2.12.0)
|
52
|
+
rspec-mocks (~> 2.12.0)
|
53
|
+
rspec-core (2.12.2)
|
54
|
+
rspec-expectations (2.12.1)
|
55
|
+
diff-lcs (~> 1.1.3)
|
56
|
+
rspec-mocks (2.12.2)
|
57
|
+
shoulda (3.3.2)
|
58
|
+
shoulda-context (~> 1.0.1)
|
59
|
+
shoulda-matchers (~> 1.4.1)
|
60
|
+
shoulda-context (1.0.2)
|
61
|
+
shoulda-matchers (1.4.2)
|
62
|
+
activesupport (>= 3.0.0)
|
63
|
+
bourne (~> 1.1.2)
|
64
|
+
simplecov (0.7.1)
|
65
|
+
multi_json (~> 1.0)
|
66
|
+
simplecov-html (~> 0.7.1)
|
67
|
+
simplecov-html (0.7.1)
|
68
|
+
xml-simple (1.1.2)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
bundler
|
75
|
+
cucumber
|
76
|
+
httparty
|
77
|
+
jeweler (~> 1.8.4)
|
78
|
+
rdoc
|
79
|
+
relish
|
80
|
+
roxml
|
81
|
+
rspec (>= 2.12.0)
|
82
|
+
shoulda
|
83
|
+
simplecov
|
84
|
+
xml-simple
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 amalc
|
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,39 @@
|
|
1
|
+
Travis CI - YRI 1.9.x
|
2
|
+
|
3
|
+
{<img src="https://travis-ci.org/amalc/rubyzoho.png?branch=master" alt="Build Status" />}[https://travis-ci.org/amalc/rubyzoho]
|
4
|
+
|
5
|
+
= rubyzoho
|
6
|
+
|
7
|
+
Abstracting Zoho's API into a set of Ruby classes, with reflection of Zoho's fields using a more familiar
|
8
|
+
ActiveRecord lifecycle but without ActiveRecord.
|
9
|
+
|
10
|
+
== Installation
|
11
|
+
gem install rubyzoho
|
12
|
+
|
13
|
+
== Configuration
|
14
|
+
Put the following in an initializer (e.g. zoho.rb):
|
15
|
+
|
16
|
+
RubyZoho.configure do |config|
|
17
|
+
config.api_key = << API Key from Zoho>>
|
18
|
+
end
|
19
|
+
|
20
|
+
Please be aware that Zoho limits API calls. So running tests repeatedly will quickly exhaust
|
21
|
+
your daily allowance.
|
22
|
+
|
23
|
+
---
|
24
|
+
|
25
|
+
== Contributing to rubyzoho
|
26
|
+
|
27
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
28
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
29
|
+
* Fork the project.
|
30
|
+
* Start a feature/bugfix branch.
|
31
|
+
* Commit and push until you are happy with your contribution.
|
32
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
33
|
+
* 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.
|
34
|
+
|
35
|
+
== Copyright
|
36
|
+
|
37
|
+
Copyright (c) 2013 amalc. Released under the MIT license. See LICENSE.txt for
|
38
|
+
further details.
|
39
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
|
6
|
+
require "bundler/gem_tasks"
|
7
|
+
require 'rspec/core/rake_task'
|
8
|
+
require 'cucumber/rake/task'
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
|
+
|
12
|
+
task :default => :spec
|
13
|
+
|
14
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
15
|
+
t.cucumber_opts = "features --format progress"
|
16
|
+
end
|
17
|
+
|
18
|
+
begin
|
19
|
+
Bundler.setup(:default, :development)
|
20
|
+
rescue Bundler::BundlerError => e
|
21
|
+
$stderr.puts e.message
|
22
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
23
|
+
exit e.status_code
|
24
|
+
end
|
25
|
+
require 'rake'
|
26
|
+
|
27
|
+
require 'jeweler'
|
28
|
+
Jeweler::Tasks.new do |gem|
|
29
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
30
|
+
gem.name = "rubyzoho"
|
31
|
+
gem.homepage = "http://github.com/amalc/rubyzoho"
|
32
|
+
gem.license = "MIT"
|
33
|
+
gem.summary = "A set of Ruby classes supporting the ActiveRecord lifecycle for the Zoho API."
|
34
|
+
gem.description = ""
|
35
|
+
gem.email = ""
|
36
|
+
gem.authors = ["amalc"]
|
37
|
+
# dependencies defined in Gemfile
|
38
|
+
end
|
39
|
+
|
40
|
+
Jeweler::RubygemsDotOrgTasks.new
|
41
|
+
|
42
|
+
require 'rake/testtask'
|
43
|
+
Rake::TestTask.new(:test) do |test|
|
44
|
+
test.libs << 'lib' << 'test'
|
45
|
+
test.pattern = 'test/**/test_*.rb'
|
46
|
+
test.verbose = true
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
task :default => :test
|
51
|
+
|
52
|
+
require 'rdoc/task'
|
53
|
+
Rake::RDocTask.new do |rdoc|
|
54
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
55
|
+
|
56
|
+
rdoc.rdoc_dir = 'rdoc'
|
57
|
+
rdoc.title = "rubyzoho #{version}"
|
58
|
+
rdoc.rdoc_files.include('README*')
|
59
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
60
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
data/lib/api_utils.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
|
3
|
+
module ApiUtils
|
4
|
+
|
5
|
+
def self.camelize_with_space(str)
|
6
|
+
str.split('_').map {|w| w.capitalize}.join(' ')
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.string_to_method_name(s)
|
10
|
+
s.gsub(' ', '_').downcase
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.string_to_symbol(s)
|
14
|
+
s.gsub(' ', '_').downcase.to_sym
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.symbol_to_string(sym)
|
18
|
+
sym.class == Symbol ? self.camelize_with_space(sym.to_s) : self.camelize_with_space(sym)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/lib/ruby_zoho.rb
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
require 'zoho_api'
|
2
|
+
require 'api_utils'
|
3
|
+
|
4
|
+
|
5
|
+
module RubyZoho
|
6
|
+
|
7
|
+
class Configuration
|
8
|
+
attr_accessor :api, :api_key
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
self.api_key = nil
|
12
|
+
self.api = nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class << self
|
17
|
+
attr_accessor :configuration
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.configure
|
21
|
+
self.configuration ||= Configuration.new
|
22
|
+
yield(configuration) if block_given?
|
23
|
+
self.configuration.api = ZohoApi::Crm.new(self.configuration.api_key)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
class Crm
|
29
|
+
|
30
|
+
class << self
|
31
|
+
attr_accessor :module_name
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(object_attribute_hash = {})
|
35
|
+
@fields = RubyZoho.configuration.api.module_fields[
|
36
|
+
ApiUtils.string_to_symbol(Crm.module_name)]
|
37
|
+
RubyZoho::Crm.create_accessor(self.class, @fields)
|
38
|
+
object_attribute_hash.map { |(k, v)| public_send("#{k}=", v) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def attr_writers
|
42
|
+
self.methods.grep(/\w=$/)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.create_accessor(klass, names)
|
46
|
+
names.each do |name|
|
47
|
+
n = name
|
48
|
+
n = name.to_s if name.class == Symbol
|
49
|
+
create_getter(klass, n)
|
50
|
+
create_setter(klass, n)
|
51
|
+
end
|
52
|
+
names
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.create_getter(klass, *names)
|
56
|
+
names.each do |name|
|
57
|
+
klass.send(:define_method, "#{name}") { instance_variable_get("@#{name}") }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.create_setter(klass, *names)
|
62
|
+
names.each do |name|
|
63
|
+
klass.send(:define_method, "#{name}=") { |val| instance_variable_set("@#{name}", val) }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def create(object_attribute_hash)
|
68
|
+
initialize(object_attribute_hash)
|
69
|
+
save
|
70
|
+
end
|
71
|
+
|
72
|
+
def save
|
73
|
+
h = {}
|
74
|
+
@fields.each { |f| h.merge!({ f => eval("self.#{f.to_s}") }) }
|
75
|
+
RubyZoho.configuration.api.add_record(Crm.module_name, h)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.all #TODO Refactor into low level API
|
79
|
+
result = []
|
80
|
+
i = 1
|
81
|
+
begin
|
82
|
+
batch = RubyZoho.configuration.api.some(Crm.module_name, i, 200)
|
83
|
+
i += 200
|
84
|
+
result.concat(batch) unless batch.nil?
|
85
|
+
end while !batch.nil?
|
86
|
+
result.collect { |r| new(r) }
|
87
|
+
end
|
88
|
+
|
89
|
+
def self.delete(id)
|
90
|
+
RubyZoho.configuration.api.delete_record(Crm.module_name, id)
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.method_missing(meth, *args, &block)
|
94
|
+
if meth.to_s =~ /^find_by_(.+)$/
|
95
|
+
run_find_by_method($1, *args, &block)
|
96
|
+
else
|
97
|
+
super
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.run_find_by_method(attrs, *args, &block)
|
102
|
+
attrs = attrs.split('_and_')
|
103
|
+
conditions = Array.new(args.size, '=')
|
104
|
+
h = RubyZoho.configuration.api.find_records(
|
105
|
+
Crm.module_name, ApiUtils.string_to_symbol(attrs[0]), conditions[0], args[0]
|
106
|
+
)
|
107
|
+
return h.collect { |r| new(r) } unless h.nil?
|
108
|
+
nil
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
class Account < RubyZoho::Crm
|
113
|
+
include RubyZoho
|
114
|
+
attr_reader :fields
|
115
|
+
Crm.module_name = 'Accounts'
|
116
|
+
|
117
|
+
def initialize(object_attribute_hash = {})
|
118
|
+
Crm.module_name = 'Accounts'
|
119
|
+
super
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.all
|
123
|
+
Crm.module_name = 'Accounts'
|
124
|
+
super
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.delete(id)
|
128
|
+
Crm.module_name = 'Accounts'
|
129
|
+
super
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
class Contact < RubyZoho::Crm
|
135
|
+
include RubyZoho
|
136
|
+
attr_reader :fields
|
137
|
+
Crm.module_name = 'Contacts'
|
138
|
+
|
139
|
+
def initialize(object_attribute_hash = {})
|
140
|
+
Crm.module_name = 'Contacts'
|
141
|
+
super
|
142
|
+
end
|
143
|
+
|
144
|
+
def self.all
|
145
|
+
Crm.module_name = 'Contacts'
|
146
|
+
super
|
147
|
+
end
|
148
|
+
|
149
|
+
def self.delete(id)
|
150
|
+
Crm.module_name = 'Contacts'
|
151
|
+
super
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
class Lead < RubyZoho::Crm
|
157
|
+
include RubyZoho
|
158
|
+
attr_reader :fields
|
159
|
+
Crm.module_name = 'Leads'
|
160
|
+
|
161
|
+
def initialize(object_attribute_hash = {})
|
162
|
+
Crm.module_name = 'Leads'
|
163
|
+
super
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.all
|
167
|
+
Crm.module_name = 'Leads'
|
168
|
+
super
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.delete(id)
|
172
|
+
Crm.module_name = 'Leads'
|
173
|
+
super
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
class Potential < RubyZoho::Crm
|
178
|
+
include RubyZoho
|
179
|
+
attr_reader :fields
|
180
|
+
Crm.module_name = 'Potentials'
|
181
|
+
|
182
|
+
def initialize(object_attribute_hash = {})
|
183
|
+
Crm.module_name = 'Potentials'
|
184
|
+
super
|
185
|
+
end
|
186
|
+
|
187
|
+
def self.all
|
188
|
+
Crm.module_name = 'Potentials'
|
189
|
+
super
|
190
|
+
end
|
191
|
+
|
192
|
+
def self.delete(id)
|
193
|
+
Crm.module_name = 'Potentials'
|
194
|
+
super
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
class Quote < RubyZoho::Crm
|
199
|
+
include RubyZoho
|
200
|
+
attr_reader :fields
|
201
|
+
Crm.module_name = 'Quotes'
|
202
|
+
|
203
|
+
def initialize(object_attribute_hash = {})
|
204
|
+
Crm.module_name = 'Quotes'
|
205
|
+
super
|
206
|
+
end
|
207
|
+
|
208
|
+
def self.all
|
209
|
+
Crm.module_name = 'Quotes'
|
210
|
+
super
|
211
|
+
end
|
212
|
+
|
213
|
+
def self.delete(id)
|
214
|
+
Crm.module_name = 'Quotes'
|
215
|
+
super
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
data/lib/zoho_api.rb
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
$:.unshift File.join('..', File.dirname(__FILE__), 'lib')
|
2
|
+
|
3
|
+
require 'httparty'
|
4
|
+
require 'rexml/document'
|
5
|
+
require 'ruby_zoho'
|
6
|
+
require 'yaml'
|
7
|
+
require 'api_utils'
|
8
|
+
|
9
|
+
module ZohoApi
|
10
|
+
|
11
|
+
include ApiUtils
|
12
|
+
|
13
|
+
class Crm
|
14
|
+
NUMBER_OF_RECORDS_TO_GET = 200
|
15
|
+
|
16
|
+
include HTTParty
|
17
|
+
|
18
|
+
#debug_output $stderr
|
19
|
+
|
20
|
+
attr_reader :auth_token, :module_fields
|
21
|
+
|
22
|
+
def initialize(auth_token)
|
23
|
+
@auth_token = auth_token
|
24
|
+
@module_fields = reflect_module_fields
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_record(module_name, fields_values_hash)
|
28
|
+
x = REXML::Document.new
|
29
|
+
contacts = x.add_element module_name
|
30
|
+
row = contacts.add_element 'row', { 'no' => '1'}
|
31
|
+
fields_values_hash.each_pair { |k, v| add_field(row, ApiUtils.symbol_to_string(k), v) }
|
32
|
+
r = self.class.post(create_url(module_name, 'insertRecords'),
|
33
|
+
:query => { :newFormat => 1, :authtoken => @auth_token,
|
34
|
+
:scope => 'crmapi', :xmlData => x },
|
35
|
+
:headers => { 'Content-length' => '0' })
|
36
|
+
raise('Adding record failed', RuntimeError, r.response.body.to_s) unless r.response.code == '200'
|
37
|
+
r.response.code
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_field(row, field, value)
|
41
|
+
r = (REXML::Element.new 'FL')
|
42
|
+
r.attributes['val'] = field
|
43
|
+
r.add_text(value)
|
44
|
+
row.elements << r
|
45
|
+
row
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_url(module_name, api_call)
|
49
|
+
"https://crm.zoho.com/crm/private/xml/#{module_name}/#{api_call}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def delete_record(module_name, record_id)
|
53
|
+
r = self.class.post(create_url(module_name, 'deleteRecords'),
|
54
|
+
:query => { :newFormat => 1, :authtoken => @auth_token,
|
55
|
+
:scope => 'crmapi', :id => record_id },
|
56
|
+
:headers => { 'Content-length' => '0' })
|
57
|
+
raise('Adding contact failed', RuntimeError, r.response.body.to_s) unless r.response.code == '200'
|
58
|
+
end
|
59
|
+
|
60
|
+
def fields(module_name)
|
61
|
+
record = first(module_name)
|
62
|
+
record[0].keys
|
63
|
+
end
|
64
|
+
|
65
|
+
def first(module_name)
|
66
|
+
some(module_name, 1, 1)
|
67
|
+
end
|
68
|
+
|
69
|
+
def find_records(module_name, field, condition, value)
|
70
|
+
sc_field = ApiUtils.symbol_to_string(field)
|
71
|
+
search_condition = '(' + sc_field + '|' + condition + '|' + value + ')'
|
72
|
+
r = self.class.get(create_url("#{module_name}", 'getSearchRecords'),
|
73
|
+
:query => { :newFormat => 2, :authtoken => @auth_token, :scope => 'crmapi',
|
74
|
+
:selectColumns => 'All', :searchCondition => search_condition,
|
75
|
+
:fromIndex => 1, :toIndex => NUMBER_OF_RECORDS_TO_GET })
|
76
|
+
raise(RuntimeError, 'Bad query', "#{sc_field} #{condition} #{value}") unless r.body.index('<error>').nil?
|
77
|
+
x = REXML::Document.new(r.body).elements.to_a("/response/result/#{module_name}/row")
|
78
|
+
to_hash(x)
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.module_names
|
82
|
+
%w{Leads Accounts Contacts Potentials Quotes Invoices SalesOrders}
|
83
|
+
end
|
84
|
+
|
85
|
+
def reflect_module_fields
|
86
|
+
module_names = ZohoApi::Crm.module_names
|
87
|
+
module_fields = {}
|
88
|
+
module_names.each { |n| module_fields.merge!({ ApiUtils.string_to_symbol(n) => fields(n) }) }
|
89
|
+
module_fields
|
90
|
+
end
|
91
|
+
|
92
|
+
def some(module_name, index = 1, number_of_records = nil)
|
93
|
+
r = self.class.get(create_url(module_name, 'getRecords'),
|
94
|
+
:query => { :newFormat => 2, :authtoken => @auth_token, :scope => 'crmapi',
|
95
|
+
:fromIndex => index, :toIndex => number_of_records || NUMBER_OF_RECORDS_TO_GET })
|
96
|
+
return nil unless r.response.code == '200'
|
97
|
+
x = REXML::Document.new(r.body).elements.to_a("/response/result/#{module_name}/row")
|
98
|
+
to_hash(x)
|
99
|
+
end
|
100
|
+
|
101
|
+
def to_hash(xml_results)
|
102
|
+
r = []
|
103
|
+
xml_results.each do |e|
|
104
|
+
record = {}
|
105
|
+
e.elements.to_a.each do |n|
|
106
|
+
k = ApiUtils.string_to_symbol(n.attribute('val').to_s.gsub('val=', ''))
|
107
|
+
v = n.text == 'null' ? nil : n.text
|
108
|
+
record.merge!({ k => v })
|
109
|
+
end
|
110
|
+
r << record
|
111
|
+
end
|
112
|
+
return nil if r == []
|
113
|
+
r
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
data/rubyzoho.gemspec
ADDED
@@ -0,0 +1,92 @@
|
|
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
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "rubyzoho"
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["amalc"]
|
12
|
+
s.date = "2013-02-12"
|
13
|
+
s.description = ""
|
14
|
+
s.email = ""
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".rvmrc",
|
23
|
+
".travis.yml",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE.txt",
|
27
|
+
"README.rdoc",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION",
|
30
|
+
"lib/api_utils.rb",
|
31
|
+
"lib/ruby_zoho.rb",
|
32
|
+
"lib/zoho_api.rb",
|
33
|
+
"rubyzoho.gemspec",
|
34
|
+
"spec/api_utils_spec.rb",
|
35
|
+
"spec/fixtures/sample_contact.xml",
|
36
|
+
"spec/fixtures/sample_contact_search.xml",
|
37
|
+
"spec/fixtures/sample_contacts.xml",
|
38
|
+
"spec/fixtures/sample_contacts_list.xml",
|
39
|
+
"spec/fixtures/sample_leads_list.xml",
|
40
|
+
"spec/ruby_zoho_spec.rb",
|
41
|
+
"spec/spec_helper.rb",
|
42
|
+
"spec/zoho_api_spec.rb"
|
43
|
+
]
|
44
|
+
s.homepage = "http://github.com/amalc/rubyzoho"
|
45
|
+
s.licenses = ["MIT"]
|
46
|
+
s.require_paths = ["lib"]
|
47
|
+
s.rubygems_version = "1.8.23"
|
48
|
+
s.summary = "A set of Ruby classes supporting the ActiveRecord lifecycle for the Zoho API."
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
s.specification_version = 3
|
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_runtime_dependency(%q<roxml>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
59
|
+
s.add_development_dependency(%q<relish>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<rspec>, [">= 2.12.0"])
|
62
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<xml-simple>, [">= 0"])
|
64
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
65
|
+
else
|
66
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
67
|
+
s.add_dependency(%q<roxml>, [">= 0"])
|
68
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
69
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
70
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
71
|
+
s.add_dependency(%q<relish>, [">= 0"])
|
72
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
73
|
+
s.add_dependency(%q<rspec>, [">= 2.12.0"])
|
74
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
75
|
+
s.add_dependency(%q<xml-simple>, [">= 0"])
|
76
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
77
|
+
end
|
78
|
+
else
|
79
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
80
|
+
s.add_dependency(%q<roxml>, [">= 0"])
|
81
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
82
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
83
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
84
|
+
s.add_dependency(%q<relish>, [">= 0"])
|
85
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
86
|
+
s.add_dependency(%q<rspec>, [">= 2.12.0"])
|
87
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
88
|
+
s.add_dependency(%q<xml-simple>, [">= 0"])
|
89
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
$:.unshift File.join('..', File.dirname(__FILE__), 'lib')
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'api_utils'
|
5
|
+
|
6
|
+
describe ApiUtils do
|
7
|
+
|
8
|
+
it 'should camelize a method name' do
|
9
|
+
ApiUtils.camelize_with_space('method_name').should eq('Method Name')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should convert a string to a method name' do
|
13
|
+
ApiUtils.string_to_method_name('First Name').should eq('first__name')
|
14
|
+
ApiUtils.string_to_method_name('First name').should eq('first_name')
|
15
|
+
ApiUtils.string_to_method_name('last Name').should eq('last_name')
|
16
|
+
ApiUtils.string_to_method_name('FirstName').should eq('firstname')
|
17
|
+
ApiUtils.string_to_method_name('first name').should eq('first_name')
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should convert a string to symbol' do
|
21
|
+
ApiUtils.string_to_symbol('First Name').should eq(:first__name)
|
22
|
+
ApiUtils.string_to_symbol('First Name').should eq(:first_name)
|
23
|
+
ApiUtils.string_to_symbol('Last Name').should eq(:last_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should convert a symbol to a string' do
|
27
|
+
ApiUtils.symbol_to_string(:first_name).should eq('First Name')
|
28
|
+
ApiUtils.symbol_to_string(:constid).should eq('Constid')
|
29
|
+
ApiUtils.symbol_to_string(:first).should eq('First')
|
30
|
+
ApiUtils.symbol_to_string(:first_name_last).should eq('First Name Last')
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<response uri="/crm/private/xml/Contacts/getRecords"><result><Contacts><row no="1"><FL val="CONTACTID">748054000000056089</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[null]]></FL><FL val="First Name"><![CDATA[Tom]]></FL><FL val="Last Name"><![CDATA[Andrews]]></FL><FL val="ACCOUNTID">748054000000056087</FL><FL val="Account Name"><![CDATA[Canyon Capital Advisors]]></FL><FL val="VENDORID">null</FL><FL val="Vendor Name"><![CDATA[null]]></FL><FL val="Email"><![CDATA[tom@andrews.com]]></FL><FL val="Title"><![CDATA[null]]></FL><FL val="Department"><![CDATA[null]]></FL><FL val="Phone"><![CDATA[310-272-1000]]></FL><FL val="Home Phone"><![CDATA[null]]></FL><FL val="Other Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Date of Birth"><![CDATA[null]]></FL><FL val="Assistant"><![CDATA[null]]></FL><FL val="Asst Phone"><![CDATA[null]]></FL><FL val="Reports To"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056001</FL><FL val="Modified By"><![CDATA[Amal Chaudhuri]]></FL><FL val="Created Time"><![CDATA[2013-01-06 18:15:24]]></FL><FL val="Modified Time"><![CDATA[2013-01-28 15:40:42]]></FL><FL val="Mailing Street"><![CDATA[2000 Avenue of the Stars]]></FL><FL val="Other Street"><![CDATA[null]]></FL><FL val="Mailing City"><![CDATA[Los Angeles]]></FL><FL val="Other City"><![CDATA[null]]></FL><FL val="Mailing State"><![CDATA[CA]]></FL><FL val="Other State"><![CDATA[null]]></FL><FL val="Mailing Zip"><![CDATA[90067]]></FL><FL val="Other Zip"><![CDATA[null]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Other Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-28 15:40:42]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row></Contacts></result></response>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<response uri="/crm/private/xml/Contacts/getSearchRecords"><result><Contacts><row no="1"><FL val="CONTACTID">748054000000056069</FL><FL val="First Name"><![CDATA[Jane]]></FL><FL val="Last Name"><![CDATA[Smith]]></FL><FL val="Email"><![CDATA[jane@smith.com]]></FL></row></Contacts></result></response>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<response uri="/crm/private/xml/Contacts/getRecords"><result><Contacts><row no="1"><FL val="CONTACTID">748054000000056089</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="First Name"><![CDATA[Tom]]></FL><FL val="Last Name"><![CDATA[Andrews]]></FL><FL val="ACCOUNTID">748054000000056087</FL><FL val="Account Name"><![CDATA[Canyon Capital Advisors]]></FL><FL val="Email"><![CDATA[tom@andrews.com]]></FL><FL val="Phone"><![CDATA[310-272-1000]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056001</FL><FL val="Modified By"><![CDATA[Amal Chaudhuri]]></FL><FL val="Created Time"><![CDATA[2013-01-06 18:15:24]]></FL><FL val="Modified Time"><![CDATA[2013-01-28 15:40:42]]></FL><FL val="Mailing Street"><![CDATA[2000 Avenue of the Stars]]></FL><FL val="Mailing City"><![CDATA[Los Angeles]]></FL><FL val="Mailing State"><![CDATA[CA]]></FL><FL val="Mailing Zip"><![CDATA[90067]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-28 15:40:42]]></FL></row><row no="2"><FL val="CONTACTID">748054000000056085</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="First Name"><![CDATA[Greg]]></FL><FL val="Last Name"><![CDATA[Jones]]></FL><FL val="ACCOUNTID">748054000000056083</FL><FL val="Account Name"><![CDATA[Gurtin Fixed Income]]></FL><FL val="Title"><![CDATA[Investment Officer]]></FL><FL val="Department"><![CDATA[Fixed Income]]></FL><FL val="Phone"><![CDATA[858-436-2200]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-06 17:43:43]]></FL><FL val="Modified Time"><![CDATA[2013-01-06 17:43:43]]></FL><FL val="Mailing Street"><![CDATA[440 Stevens Avenue]]></FL><FL val="Mailing City"><![CDATA[San Diego]]></FL><FL val="Mailing State"><![CDATA[CA]]></FL><FL val="Mailing Zip"><![CDATA[92075]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-06 20:05:03]]></FL></row><row no="3"><FL val="CONTACTID">748054000000056081</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="First Name"><![CDATA[Kim]]></FL><FL val="Last Name"><![CDATA[Adams]]></FL><FL val="ACCOUNTID">748054000000056079</FL><FL val="Account Name"><![CDATA[Eaton Vance]]></FL><FL val="Title"><![CDATA[Vice President]]></FL><FL val="Department"><![CDATA[Municipal Finance]]></FL><FL val="Phone"><![CDATA[800-225-6265]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-06 17:35:11]]></FL><FL val="Modified Time"><![CDATA[2013-01-06 17:35:38]]></FL><FL val="Mailing Street"><![CDATA[Two International Place]]></FL><FL val="Mailing City"><![CDATA[Boston]]></FL><FL val="Mailing State"><![CDATA[MA]]></FL><FL val="Mailing Zip"><![CDATA[02110]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Salutation"><![CDATA[Ms.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-06 19:59:22]]></FL></row><row no="4"><FL val="CONTACTID">748054000000056077</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="First Name"><![CDATA[Jane]]></FL><FL val="Last Name"><![CDATA[Collins]]></FL><FL val="ACCOUNTID">748054000000056075</FL><FL val="Account Name"><![CDATA[Loomis Sayles]]></FL><FL val="Title"><![CDATA[Portfolio Manager]]></FL><FL val="Department"><![CDATA[Fixed Income]]></FL><FL val="Phone"><![CDATA[800-343-2029]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-06 17:27:51]]></FL><FL val="Modified Time"><![CDATA[2013-01-06 17:27:51]]></FL><FL val="Mailing Street"><![CDATA[One Financial Center]]></FL><FL val="Mailing City"><![CDATA[Boston]]></FL><FL val="Mailing State"><![CDATA[MA]]></FL><FL val="Mailing Zip"><![CDATA[02111]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Salutation"><![CDATA[Mrs.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-06 17:27:51]]></FL></row><row no="5"><FL val="CONTACTID">748054000000056073</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="First Name"><![CDATA[Mike]]></FL><FL val="Last Name"><![CDATA[Thompson]]></FL><FL val="ACCOUNTID">748054000000056071</FL><FL val="Account Name"><![CDATA[BlackRock]]></FL><FL val="Phone"><![CDATA[212-810-5300]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-06 17:15:04]]></FL><FL val="Modified Time"><![CDATA[2013-01-06 17:17:50]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-06 17:17:50]]></FL></row><row no="6"><FL val="CONTACTID">748054000000056069</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[Employee Referral]]></FL><FL val="First Name"><![CDATA[Jane]]></FL><FL val="Last Name"><![CDATA[Smith]]></FL><FL val="ACCOUNTID">748054000000056067</FL><FL val="Account Name"><![CDATA[Fidelity Investments]]></FL><FL val="Email"><![CDATA[jane@smith.com]]></FL><FL val="Title"><![CDATA[Vice President]]></FL><FL val="Department"><![CDATA[Municipal Sales Trading]]></FL><FL val="Phone"><![CDATA[1-800-445-9448]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056001</FL><FL val="Modified By"><![CDATA[Amal Chaudhuri]]></FL><FL val="Created Time"><![CDATA[2013-01-04 16:06:07]]></FL><FL val="Modified Time"><![CDATA[2013-01-28 15:41:21]]></FL><FL val="Mailing Street"><![CDATA[801 Boylston Street]]></FL><FL val="Mailing City"><![CDATA[Boston]]></FL><FL val="Mailing State"><![CDATA[Massachusetts]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Salutation"><![CDATA[Ms.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-28 15:41:21]]></FL></row><row no="7"><FL val="CONTACTID">748054000000056063</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[Cold Call]]></FL><FL val="First Name"><![CDATA[John]]></FL><FL val="Last Name"><![CDATA[Doe]]></FL><FL val="ACCOUNTID">748054000000056061</FL><FL val="Account Name"><![CDATA[PIMCO]]></FL><FL val="Title"><![CDATA[Vice President]]></FL><FL val="Department"><![CDATA[Fixed Income]]></FL><FL val="Phone"><![CDATA[1 949-720-6000]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-04 15:54:25]]></FL><FL val="Modified Time"><![CDATA[2013-01-04 15:54:25]]></FL><FL val="Mailing Street"><![CDATA[840 Newport Center Drive, Suite 100]]></FL><FL val="Mailing City"><![CDATA[Newport Beach]]></FL><FL val="Mailing State"><![CDATA[California]]></FL><FL val="Mailing Zip"><![CDATA[92660]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-04 15:54:25]]></FL></row></Contacts></result></response>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<response uri="/crm/private/xml/Contacts/getRecords"><result><Contacts><row no="1"><FL val="CONTACTID">748054000000056089</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[null]]></FL><FL val="First Name"><![CDATA[Tom]]></FL><FL val="Last Name"><![CDATA[Andrews]]></FL><FL val="ACCOUNTID">748054000000056087</FL><FL val="Account Name"><![CDATA[Canyon Capital Advisors]]></FL><FL val="VENDORID">null</FL><FL val="Vendor Name"><![CDATA[null]]></FL><FL val="Email"><![CDATA[tom@andrews.com]]></FL><FL val="Title"><![CDATA[null]]></FL><FL val="Department"><![CDATA[null]]></FL><FL val="Phone"><![CDATA[310-272-1000]]></FL><FL val="Home Phone"><![CDATA[null]]></FL><FL val="Other Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Date of Birth"><![CDATA[null]]></FL><FL val="Assistant"><![CDATA[null]]></FL><FL val="Asst Phone"><![CDATA[null]]></FL><FL val="Reports To"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056001</FL><FL val="Modified By"><![CDATA[Amal Chaudhuri]]></FL><FL val="Created Time"><![CDATA[2013-01-06 18:15:24]]></FL><FL val="Modified Time"><![CDATA[2013-01-28 15:40:42]]></FL><FL val="Mailing Street"><![CDATA[2000 Avenue of the Stars]]></FL><FL val="Other Street"><![CDATA[null]]></FL><FL val="Mailing City"><![CDATA[Los Angeles]]></FL><FL val="Other City"><![CDATA[null]]></FL><FL val="Mailing State"><![CDATA[CA]]></FL><FL val="Other State"><![CDATA[null]]></FL><FL val="Mailing Zip"><![CDATA[90067]]></FL><FL val="Other Zip"><![CDATA[null]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Other Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-28 15:40:42]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row><row no="2"><FL val="CONTACTID">748054000000056085</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[null]]></FL><FL val="First Name"><![CDATA[Greg]]></FL><FL val="Last Name"><![CDATA[Jones]]></FL><FL val="ACCOUNTID">748054000000056083</FL><FL val="Account Name"><![CDATA[Gurtin Fixed Income]]></FL><FL val="VENDORID">null</FL><FL val="Vendor Name"><![CDATA[null]]></FL><FL val="Email"><![CDATA[null]]></FL><FL val="Title"><![CDATA[Investment Officer]]></FL><FL val="Department"><![CDATA[Fixed Income]]></FL><FL val="Phone"><![CDATA[858-436-2200]]></FL><FL val="Home Phone"><![CDATA[null]]></FL><FL val="Other Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Date of Birth"><![CDATA[null]]></FL><FL val="Assistant"><![CDATA[null]]></FL><FL val="Asst Phone"><![CDATA[null]]></FL><FL val="Reports To"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-06 17:43:43]]></FL><FL val="Modified Time"><![CDATA[2013-01-06 17:43:43]]></FL><FL val="Mailing Street"><![CDATA[440 Stevens Avenue]]></FL><FL val="Other Street"><![CDATA[null]]></FL><FL val="Mailing City"><![CDATA[San Diego]]></FL><FL val="Other City"><![CDATA[null]]></FL><FL val="Mailing State"><![CDATA[CA]]></FL><FL val="Other State"><![CDATA[null]]></FL><FL val="Mailing Zip"><![CDATA[92075]]></FL><FL val="Other Zip"><![CDATA[null]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Other Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-06 20:05:03]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row><row no="3"><FL val="CONTACTID">748054000000056081</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[null]]></FL><FL val="First Name"><![CDATA[Kim]]></FL><FL val="Last Name"><![CDATA[Adams]]></FL><FL val="ACCOUNTID">748054000000056079</FL><FL val="Account Name"><![CDATA[Eaton Vance]]></FL><FL val="VENDORID">null</FL><FL val="Vendor Name"><![CDATA[null]]></FL><FL val="Email"><![CDATA[null]]></FL><FL val="Title"><![CDATA[Vice President]]></FL><FL val="Department"><![CDATA[Municipal Finance]]></FL><FL val="Phone"><![CDATA[800-225-6265]]></FL><FL val="Home Phone"><![CDATA[null]]></FL><FL val="Other Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Date of Birth"><![CDATA[null]]></FL><FL val="Assistant"><![CDATA[null]]></FL><FL val="Asst Phone"><![CDATA[null]]></FL><FL val="Reports To"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-06 17:35:11]]></FL><FL val="Modified Time"><![CDATA[2013-01-06 17:35:38]]></FL><FL val="Mailing Street"><![CDATA[Two International Place]]></FL><FL val="Other Street"><![CDATA[null]]></FL><FL val="Mailing City"><![CDATA[Boston]]></FL><FL val="Other City"><![CDATA[null]]></FL><FL val="Mailing State"><![CDATA[MA]]></FL><FL val="Other State"><![CDATA[null]]></FL><FL val="Mailing Zip"><![CDATA[02110]]></FL><FL val="Other Zip"><![CDATA[null]]></FL><FL val="Mailing Country"><![CDATA[null]]></FL><FL val="Other Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="Salutation"><![CDATA[Ms.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-06 19:59:22]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row><row no="4"><FL val="CONTACTID">748054000000056077</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[null]]></FL><FL val="First Name"><![CDATA[Jane]]></FL><FL val="Last Name"><![CDATA[Collins]]></FL><FL val="ACCOUNTID">748054000000056075</FL><FL val="Account Name"><![CDATA[Loomis Sayles]]></FL><FL val="VENDORID">null</FL><FL val="Vendor Name"><![CDATA[null]]></FL><FL val="Email"><![CDATA[null]]></FL><FL val="Title"><![CDATA[Portfolio Manager]]></FL><FL val="Department"><![CDATA[Fixed Income]]></FL><FL val="Phone"><![CDATA[800-343-2029]]></FL><FL val="Home Phone"><![CDATA[null]]></FL><FL val="Other Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Date of Birth"><![CDATA[null]]></FL><FL val="Assistant"><![CDATA[null]]></FL><FL val="Asst Phone"><![CDATA[null]]></FL><FL val="Reports To"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-06 17:27:51]]></FL><FL val="Modified Time"><![CDATA[2013-01-06 17:27:51]]></FL><FL val="Mailing Street"><![CDATA[One Financial Center]]></FL><FL val="Other Street"><![CDATA[null]]></FL><FL val="Mailing City"><![CDATA[Boston]]></FL><FL val="Other City"><![CDATA[null]]></FL><FL val="Mailing State"><![CDATA[MA]]></FL><FL val="Other State"><![CDATA[null]]></FL><FL val="Mailing Zip"><![CDATA[02111]]></FL><FL val="Other Zip"><![CDATA[null]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Other Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="Salutation"><![CDATA[Mrs.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-06 17:27:51]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row><row no="5"><FL val="CONTACTID">748054000000056073</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[null]]></FL><FL val="First Name"><![CDATA[Mike]]></FL><FL val="Last Name"><![CDATA[Thompson]]></FL><FL val="ACCOUNTID">748054000000056071</FL><FL val="Account Name"><![CDATA[BlackRock]]></FL><FL val="VENDORID">null</FL><FL val="Vendor Name"><![CDATA[null]]></FL><FL val="Email"><![CDATA[null]]></FL><FL val="Title"><![CDATA[null]]></FL><FL val="Department"><![CDATA[null]]></FL><FL val="Phone"><![CDATA[212-810-5300]]></FL><FL val="Home Phone"><![CDATA[null]]></FL><FL val="Other Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Date of Birth"><![CDATA[null]]></FL><FL val="Assistant"><![CDATA[null]]></FL><FL val="Asst Phone"><![CDATA[null]]></FL><FL val="Reports To"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-06 17:15:04]]></FL><FL val="Modified Time"><![CDATA[2013-01-06 17:17:50]]></FL><FL val="Mailing Street"><![CDATA[null]]></FL><FL val="Other Street"><![CDATA[null]]></FL><FL val="Mailing City"><![CDATA[null]]></FL><FL val="Other City"><![CDATA[null]]></FL><FL val="Mailing State"><![CDATA[null]]></FL><FL val="Other State"><![CDATA[null]]></FL><FL val="Mailing Zip"><![CDATA[null]]></FL><FL val="Other Zip"><![CDATA[null]]></FL><FL val="Mailing Country"><![CDATA[null]]></FL><FL val="Other Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-06 17:17:50]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row><row no="6"><FL val="CONTACTID">748054000000056069</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[Employee Referral]]></FL><FL val="First Name"><![CDATA[Jane]]></FL><FL val="Last Name"><![CDATA[Smith]]></FL><FL val="ACCOUNTID">748054000000056067</FL><FL val="Account Name"><![CDATA[Fidelity Investments]]></FL><FL val="VENDORID">null</FL><FL val="Vendor Name"><![CDATA[null]]></FL><FL val="Email"><![CDATA[jane@smith.com]]></FL><FL val="Title"><![CDATA[Vice President]]></FL><FL val="Department"><![CDATA[Municipal Sales Trading]]></FL><FL val="Phone"><![CDATA[1-800-445-9448]]></FL><FL val="Home Phone"><![CDATA[null]]></FL><FL val="Other Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Date of Birth"><![CDATA[null]]></FL><FL val="Assistant"><![CDATA[null]]></FL><FL val="Asst Phone"><![CDATA[null]]></FL><FL val="Reports To"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056001</FL><FL val="Modified By"><![CDATA[Amal Chaudhuri]]></FL><FL val="Created Time"><![CDATA[2013-01-04 16:06:07]]></FL><FL val="Modified Time"><![CDATA[2013-01-28 15:41:21]]></FL><FL val="Mailing Street"><![CDATA[801 Boylston Street]]></FL><FL val="Other Street"><![CDATA[null]]></FL><FL val="Mailing City"><![CDATA[Boston]]></FL><FL val="Other City"><![CDATA[null]]></FL><FL val="Mailing State"><![CDATA[Massachusetts]]></FL><FL val="Other State"><![CDATA[null]]></FL><FL val="Mailing Zip"><![CDATA[null]]></FL><FL val="Other Zip"><![CDATA[null]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Other Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="Salutation"><![CDATA[Ms.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-28 15:41:21]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row><row no="7"><FL val="CONTACTID">748054000000056063</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Contact Owner"><![CDATA[Louis]]></FL><FL val="Lead Source"><![CDATA[Cold Call]]></FL><FL val="First Name"><![CDATA[John]]></FL><FL val="Last Name"><![CDATA[Doe]]></FL><FL val="ACCOUNTID">748054000000056061</FL><FL val="Account Name"><![CDATA[PIMCO]]></FL><FL val="VENDORID">null</FL><FL val="Vendor Name"><![CDATA[null]]></FL><FL val="Email"><![CDATA[null]]></FL><FL val="Title"><![CDATA[Vice President]]></FL><FL val="Department"><![CDATA[Fixed Income]]></FL><FL val="Phone"><![CDATA[1 949-720-6000]]></FL><FL val="Home Phone"><![CDATA[null]]></FL><FL val="Other Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Date of Birth"><![CDATA[null]]></FL><FL val="Assistant"><![CDATA[null]]></FL><FL val="Asst Phone"><![CDATA[null]]></FL><FL val="Reports To"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-04 15:54:25]]></FL><FL val="Modified Time"><![CDATA[2013-01-04 15:54:25]]></FL><FL val="Mailing Street"><![CDATA[840 Newport Center Drive, Suite 100]]></FL><FL val="Other Street"><![CDATA[null]]></FL><FL val="Mailing City"><![CDATA[Newport Beach]]></FL><FL val="Other City"><![CDATA[null]]></FL><FL val="Mailing State"><![CDATA[California]]></FL><FL val="Other State"><![CDATA[null]]></FL><FL val="Mailing Zip"><![CDATA[92660]]></FL><FL val="Other Zip"><![CDATA[null]]></FL><FL val="Mailing Country"><![CDATA[USA]]></FL><FL val="Other Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Add to QuickBooks"><![CDATA[false]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-04 15:54:25]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row></Contacts></result></response>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<response uri="/crm/private/xml/Leads/getRecords"><result><Leads><row no="1"><FL val="LEADID">748054000000060001</FL><FL val="SMOWNERID">748054000000056043</FL><FL val="Lead Owner"><![CDATA[Louis]]></FL><FL val="Company"><![CDATA[Reynolds Asset Managment]]></FL><FL val="First Name"><![CDATA[Jim]]></FL><FL val="Last Name"><![CDATA[Reynolds]]></FL><FL val="Designation"><![CDATA[null]]></FL><FL val="Email"><![CDATA[null]]></FL><FL val="Phone"><![CDATA[null]]></FL><FL val="Fax"><![CDATA[null]]></FL><FL val="Mobile"><![CDATA[null]]></FL><FL val="Website"><![CDATA[null]]></FL><FL val="Lead Source"><![CDATA[null]]></FL><FL val="Lead Status"><![CDATA[null]]></FL><FL val="Industry"><![CDATA[null]]></FL><FL val="No of Employees"><![CDATA[0]]></FL><FL val="Annual Revenue"><![CDATA[0]]></FL><FL val="Rating"><![CDATA[null]]></FL><FL val="CAMPAIGNID">null</FL><FL val="Campaign Source"><![CDATA[null]]></FL><FL val="SMCREATORID">748054000000056043</FL><FL val="Created By"><![CDATA[Louis]]></FL><FL val="MODIFIEDBY">748054000000056043</FL><FL val="Modified By"><![CDATA[Louis]]></FL><FL val="Created Time"><![CDATA[2013-01-23 14:36:42]]></FL><FL val="Modified Time"><![CDATA[2013-01-23 14:36:42]]></FL><FL val="Street"><![CDATA[null]]></FL><FL val="City"><![CDATA[null]]></FL><FL val="State"><![CDATA[null]]></FL><FL val="Zip Code"><![CDATA[null]]></FL><FL val="Country"><![CDATA[null]]></FL><FL val="Description"><![CDATA[null]]></FL><FL val="Skype ID"><![CDATA[null]]></FL><FL val="Email Opt Out"><![CDATA[false]]></FL><FL val="Salutation"><![CDATA[Mr.]]></FL><FL val="Secondary Email"><![CDATA[null]]></FL><FL val="Last Activity Time"><![CDATA[2013-01-23 14:36:42]]></FL><FL val="Twitter"><![CDATA[null]]></FL></row></Leads></result></response>
|
@@ -0,0 +1,127 @@
|
|
1
|
+
$:.unshift File.join('..', File.dirname(__FILE__), 'lib')
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'zoho_api'
|
5
|
+
|
6
|
+
describe RubyZoho::Crm do
|
7
|
+
|
8
|
+
before(:all) do
|
9
|
+
base_path = File.join(File.dirname(__FILE__), 'fixtures')
|
10
|
+
config_file = File.join(base_path, 'zoho_api_configuration.yaml')
|
11
|
+
#params = YAML.load(File.open(config_file))
|
12
|
+
RubyZoho.configure do |config|
|
13
|
+
#config.api_key = params['auth_token']
|
14
|
+
config.api_key = '62cedfe9427caef8afb9ea3b5bf68154'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should add accessors using a list of names' do
|
19
|
+
c = RubyZoho::Crm::Contact.new
|
20
|
+
c.first_name = 'Raj'
|
21
|
+
c.first_name.should eq('Raj')
|
22
|
+
c.email = 'raj@portra.com'
|
23
|
+
c.email.should eq('raj@portra.com')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should find a contact by email or last name' do
|
27
|
+
1.upto(3) do
|
28
|
+
c = RubyZoho::Crm::Contact.new(
|
29
|
+
:first_name => 'Bob',
|
30
|
+
:last_name => 'Smithereens',
|
31
|
+
:email => 'bob@smith.com')
|
32
|
+
c.save
|
33
|
+
end
|
34
|
+
r = RubyZoho::Crm::Contact.find_by_email('bob@smith.com')
|
35
|
+
r.should_not eq(nil)
|
36
|
+
r.count.should eq(3)
|
37
|
+
r.each { |m| m.email.should eq('bob@smith.com') }
|
38
|
+
r = RubyZoho::Crm::Contact.find_by_last_name('Smithereens')
|
39
|
+
r.should_not eq(nil)
|
40
|
+
r.first.last_name.should eq('Smithereens')
|
41
|
+
r.each { |m| RubyZoho::Crm::Contact.delete(m.contactid) }
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should get a list of attr_writers for accounts' do
|
45
|
+
c = RubyZoho::Crm::Account.new
|
46
|
+
c.attr_writers.count.should be >= 34
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should get a list of attr_writers for contacts' do
|
50
|
+
c = RubyZoho::Crm::Contact.new
|
51
|
+
c.attr_writers.count.should be >= 43
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should get a list of attr_writers for leads' do
|
55
|
+
c = RubyZoho::Crm::Lead.new
|
56
|
+
c.attr_writers.count.should be >= 34
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should get a list of attr_writers for potentials' do
|
60
|
+
c = RubyZoho::Crm::Potential.new
|
61
|
+
c.attr_writers.count.should be >= 26
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should get a list of attr_writers for quotes' do
|
65
|
+
c = RubyZoho::Crm::Quote.new
|
66
|
+
c.attr_writers.count.should be >= 33
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should get a list of accounts' do
|
70
|
+
r = RubyZoho::Crm::Account.all
|
71
|
+
r.count.should be > 1
|
72
|
+
r.map { |r| r.class.should eq(RubyZoho::Crm::Account) }
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'should get a list of contacts' do
|
76
|
+
r = RubyZoho::Crm::Contact.all
|
77
|
+
r.count.should be > 1
|
78
|
+
r.map { |r| r.class.should eq(RubyZoho::Crm::Contact) }
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should get a list of potentials' do
|
82
|
+
r = RubyZoho::Crm::Potential.all
|
83
|
+
r.count.should be > 1
|
84
|
+
r.map { |r| r.class.should eq(RubyZoho::Crm::Potential) }
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should get a list of quotes' do
|
88
|
+
r = RubyZoho::Crm::Quote.all
|
89
|
+
r.count.should be >= 1
|
90
|
+
r.map { |r| r.class.should eq(RubyZoho::Crm::Quote) }
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should save a contact record' do
|
94
|
+
c = RubyZoho::Crm::Contact.new(
|
95
|
+
:first_name => 'Raj',
|
96
|
+
:last_name => 'Portra',
|
97
|
+
:email => 'raj@portra.com')
|
98
|
+
c.save
|
99
|
+
r = RubyZoho::Crm::Contact.find_by_email('raj@portra.com')
|
100
|
+
r.each { |c| RubyZoho::Crm::Contact.delete(c.contactid) }
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should save a lead record' do
|
104
|
+
l = RubyZoho::Crm::Lead.new(
|
105
|
+
:first_name => 'Raj',
|
106
|
+
:last_name => 'Portra',
|
107
|
+
:email => 'raj@portra.com')
|
108
|
+
l.save
|
109
|
+
r = RubyZoho::Crm::Lead.find_by_email('raj@portra.com')
|
110
|
+
r.each { |c| RubyZoho::Crm::Lead.delete(c.leadid) }
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should save a potential record' do
|
114
|
+
potentials = RubyZoho::Crm::Potential.all
|
115
|
+
p = RubyZoho::Crm::Potential.new(
|
116
|
+
:potential_name => 'A very big potential INDEED!!!!!!!!!!!!!',
|
117
|
+
:accountid => potentials[0].accountid,
|
118
|
+
:account_name => potentials[0].account_name,
|
119
|
+
:closing_date => '1/1/2014',
|
120
|
+
:type => 'New Business',
|
121
|
+
:stage => 'Needs Analysis')
|
122
|
+
p.save
|
123
|
+
r = RubyZoho::Crm::Potential.find_by_potential_name(p.potential_name)
|
124
|
+
r.each { |c| RubyZoho::Crm::Potential.delete(c.potentialid) }
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
$:.unshift File.join('..', File.dirname(__FILE__), 'lib')
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'zoho_api'
|
5
|
+
require 'xmlsimple'
|
6
|
+
|
7
|
+
describe ZohoApi do
|
8
|
+
|
9
|
+
def add_dummy_contact
|
10
|
+
c = {:first_name => 'BobDifficultToMatch', :last_name => 'SmithDifficultToMatch',
|
11
|
+
:email => 'bob@smith.com'}
|
12
|
+
@zoho.add_record('Contacts', c)
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete_dummy_contact
|
16
|
+
c = @zoho.find_records(
|
17
|
+
'Contacts', :email, '=', 'bob@smith.com')
|
18
|
+
@zoho.delete_record('Contacts', c[0][:contactid]) unless c == []
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
before(:all) do
|
23
|
+
base_path = File.join(File.dirname(__FILE__), 'fixtures')
|
24
|
+
config_file = File.join(base_path, 'zoho_api_configuration.yaml')
|
25
|
+
#params = YAML.load(File.open(config_file))
|
26
|
+
#@zoho = ZohoApi::Crm.new(params['auth_token'])
|
27
|
+
@zoho = ZohoApi::Crm.new('62cedfe9427caef8afb9ea3b5bf68154')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should add a new contact' do
|
31
|
+
h = { :first_name => 'Robert',
|
32
|
+
:last_name => 'Smith',
|
33
|
+
:email => 'rsmith@smithereens.com',
|
34
|
+
:department => 'Waste Collection and Management',
|
35
|
+
:phone => '13452129087',
|
36
|
+
:mobile => '12341238790'
|
37
|
+
}
|
38
|
+
@zoho.add_record('Contacts', h)
|
39
|
+
contact = @zoho.find_records('Contacts', :email, '=', h[:email])
|
40
|
+
@zoho.delete_record('Contacts', contact[0][:contactid])
|
41
|
+
contact.should_not eq(nil)
|
42
|
+
contact.count.should eq(1)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should delete a contact record with id' do
|
46
|
+
add_dummy_contact
|
47
|
+
c = @zoho.find_records('Contacts', :email, '=', 'bob@smith.com')
|
48
|
+
@zoho.delete_record('Contacts', c[0][:contactid])
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should find by module and field for columns' do
|
52
|
+
add_dummy_contact
|
53
|
+
r = @zoho.find_records('Contacts', :email, '=', 'bob@smith.com')
|
54
|
+
r[0][:email].should eq('bob@smith.com')
|
55
|
+
delete_dummy_contact
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should get a list of fields for a module' do
|
59
|
+
r = @zoho.fields('Contacts')
|
60
|
+
r.count.should be >= 43
|
61
|
+
r = @zoho.fields('Leads')
|
62
|
+
r.count.should be >= 34
|
63
|
+
r = @zoho.fields('Quotes')
|
64
|
+
r.count.should be >= 33
|
65
|
+
r = @zoho.fields('SalesOrders')
|
66
|
+
r.count.should >= 45
|
67
|
+
r = @zoho.fields('Invoices')
|
68
|
+
r.count.should >= 41
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should retrieve records by module name' do
|
72
|
+
r = @zoho.some('Contacts')
|
73
|
+
r.should_not eq(nil)
|
74
|
+
r[0][:email].should_not eq(nil)
|
75
|
+
r.count.should be > 1
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
metadata
ADDED
@@ -0,0 +1,247 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubyzoho
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- amalc
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httparty
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: roxml
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: cucumber
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: jeweler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.8.4
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.8.4
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: relish
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rdoc
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rspec
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 2.12.0
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: 2.12.0
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: shoulda
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: xml-simple
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: simplecov
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
description: ''
|
191
|
+
email: ''
|
192
|
+
executables: []
|
193
|
+
extensions: []
|
194
|
+
extra_rdoc_files:
|
195
|
+
- LICENSE.txt
|
196
|
+
- README.rdoc
|
197
|
+
files:
|
198
|
+
- .document
|
199
|
+
- .rspec
|
200
|
+
- .rvmrc
|
201
|
+
- .travis.yml
|
202
|
+
- Gemfile
|
203
|
+
- Gemfile.lock
|
204
|
+
- LICENSE.txt
|
205
|
+
- README.rdoc
|
206
|
+
- Rakefile
|
207
|
+
- VERSION
|
208
|
+
- lib/api_utils.rb
|
209
|
+
- lib/ruby_zoho.rb
|
210
|
+
- lib/zoho_api.rb
|
211
|
+
- rubyzoho.gemspec
|
212
|
+
- spec/api_utils_spec.rb
|
213
|
+
- spec/fixtures/sample_contact.xml
|
214
|
+
- spec/fixtures/sample_contact_search.xml
|
215
|
+
- spec/fixtures/sample_contacts.xml
|
216
|
+
- spec/fixtures/sample_contacts_list.xml
|
217
|
+
- spec/fixtures/sample_leads_list.xml
|
218
|
+
- spec/ruby_zoho_spec.rb
|
219
|
+
- spec/spec_helper.rb
|
220
|
+
- spec/zoho_api_spec.rb
|
221
|
+
homepage: http://github.com/amalc/rubyzoho
|
222
|
+
licenses:
|
223
|
+
- MIT
|
224
|
+
post_install_message:
|
225
|
+
rdoc_options: []
|
226
|
+
require_paths:
|
227
|
+
- lib
|
228
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
229
|
+
none: false
|
230
|
+
requirements:
|
231
|
+
- - ! '>='
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: '0'
|
234
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
|
+
none: false
|
236
|
+
requirements:
|
237
|
+
- - ! '>='
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
version: '0'
|
240
|
+
requirements: []
|
241
|
+
rubyforge_project:
|
242
|
+
rubygems_version: 1.8.23
|
243
|
+
signing_key:
|
244
|
+
specification_version: 3
|
245
|
+
summary: A set of Ruby classes supporting the ActiveRecord lifecycle for the Zoho
|
246
|
+
API.
|
247
|
+
test_files: []
|