rubyzoho 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/Gemfile.lock +6 -6
- data/README.rdoc +93 -4
- data/VERSION +1 -1
- data/rubyzoho-0.0.2.gem +0 -0
- data/rubyzoho.gemspec +3 -2
- data/spec/ruby_zoho_spec.rb +3 -0
- metadata +3 -2
data/.rspec
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (3.2.
|
4
|
+
activesupport (3.2.12)
|
5
5
|
i18n (~> 0.6)
|
6
6
|
multi_json (~> 1.0)
|
7
7
|
archive-tar-minitar (0.5.2)
|
@@ -26,16 +26,16 @@ GEM
|
|
26
26
|
git (>= 1.2.5)
|
27
27
|
rake
|
28
28
|
rdoc
|
29
|
-
json (1.7.
|
29
|
+
json (1.7.7)
|
30
30
|
metaclass (0.0.1)
|
31
|
-
mime-types (1.
|
31
|
+
mime-types (1.21)
|
32
32
|
mocha (0.10.5)
|
33
33
|
metaclass (~> 0.0.1)
|
34
|
-
multi_json (1.5.
|
35
|
-
multi_xml (0.5.
|
34
|
+
multi_json (1.5.1)
|
35
|
+
multi_xml (0.5.3)
|
36
36
|
nokogiri (1.5.6)
|
37
37
|
rake (10.0.3)
|
38
|
-
rdoc (3.12)
|
38
|
+
rdoc (3.12.1)
|
39
39
|
json (~> 1.4)
|
40
40
|
relish (0.6)
|
41
41
|
archive-tar-minitar (>= 0.5.2)
|
data/README.rdoc
CHANGED
@@ -7,23 +7,112 @@ Travis CI - YRI 1.9.x
|
|
7
7
|
Abstracting Zoho's API into a set of Ruby classes, with reflection of Zoho's fields using a more familiar
|
8
8
|
ActiveRecord lifecycle but without ActiveRecord.
|
9
9
|
|
10
|
-
==
|
10
|
+
== Install
|
11
11
|
gem install rubyzoho
|
12
12
|
|
13
|
-
==
|
13
|
+
== Configure
|
14
14
|
Put the following in an initializer (e.g. zoho.rb):
|
15
15
|
|
16
16
|
RubyZoho.configure do |config|
|
17
|
-
config.api_key = << API Key from Zoho>>
|
17
|
+
config.api_key = '<< API Key from Zoho>>'
|
18
18
|
end
|
19
19
|
|
20
20
|
Please be aware that Zoho limits API calls. So running tests repeatedly will quickly exhaust
|
21
21
|
your daily allowance.
|
22
22
|
|
23
|
+
|
24
|
+
== Use
|
25
|
+
RubyZoho attempts to follow the ActiveRecord lifecycle, i.e. new, save and delete
|
26
|
+
at this point.
|
27
|
+
|
28
|
+
To get a list of supported attributes for a Zoho CRM contact:
|
29
|
+
|
30
|
+
require 'ruby_zoho'
|
31
|
+
|
32
|
+
c = RubyZoho::Crm::Contact.new
|
33
|
+
c.attr_writers # => Give a list of updatable attributes
|
34
|
+
c.fields # => Hash of all fields
|
35
|
+
|
36
|
+
Attributes are reflected from the current API instance of Zoho, dynamically on
|
37
|
+
initialization of the API, when the RubyZoho.configure block is called. This
|
38
|
+
includes custom fields.
|
39
|
+
|
40
|
+
Another example:
|
41
|
+
|
42
|
+
l = RubyZoho::Crm::Lead.new
|
43
|
+
l.attr_writers # => Give a list of updatable attributes
|
44
|
+
l.fields # => Hash of all fields
|
45
|
+
|
46
|
+
To retrieve an existing record:
|
47
|
+
|
48
|
+
l = RubyZoho::Crm::Lead.find_by_email('email@domain.com')
|
49
|
+
|
50
|
+
Returns one or more records matching the query. The find_by_<attribute> follows
|
51
|
+
ActiveRecord style reflections, so if the attribute is present in the API, it can
|
52
|
+
be queried. There is currently a single attribute limitation imposed by the Zoho
|
53
|
+
API. Note, what is returned is an Array class. Use subscripts at this point to access
|
54
|
+
or iterate through the returned set of records.
|
55
|
+
|
56
|
+
Equality is the only match currently supported.
|
57
|
+
|
58
|
+
To get a list of all accounts:
|
59
|
+
|
60
|
+
a = RubyZoho::Crm::Account.all
|
61
|
+
a.each do |account|
|
62
|
+
pp account.account_name
|
63
|
+
end
|
64
|
+
|
65
|
+
Or for all quotes:
|
66
|
+
|
67
|
+
q = RubyZoho::Crm::Quote.all
|
68
|
+
q.each do |quote|
|
69
|
+
pp quote.subject
|
70
|
+
pp quote.quote_name
|
71
|
+
end
|
72
|
+
|
73
|
+
To create a new record:
|
74
|
+
|
75
|
+
c = RubyZoho::Crm::Contact.new(
|
76
|
+
:first_name => 'First Name',
|
77
|
+
:last_name => 'Last Name',
|
78
|
+
:email => 'email@domain.com',
|
79
|
+
etc.
|
80
|
+
)
|
81
|
+
c.save
|
82
|
+
r = RubyZoho::Crm::Contact.find_by_email('email@domain.com')
|
83
|
+
r[0].contactid # => Has the newly created contact's ID
|
84
|
+
|
85
|
+
|
86
|
+
To add a contact to an existing account:
|
87
|
+
|
88
|
+
a = RubyZoho::Crm::Account.find_by_account_name('Very Big Account')
|
89
|
+
c = RubyZoho::Crm::Contact.new(
|
90
|
+
:first_name => 'First Name',
|
91
|
+
:last_name => 'Last Name',
|
92
|
+
:email => 'email@domain.com',
|
93
|
+
:account_name => a[0].account_name,
|
94
|
+
:accountid => a[0].accountid # accountid instead of account_id because of Zoho's convention
|
95
|
+
etc.
|
96
|
+
)
|
97
|
+
c.save
|
98
|
+
|
99
|
+
|
100
|
+
Objects currently supported are:
|
101
|
+
RubyZoho::Crm::Account
|
102
|
+
RubyZoho::Crm::Contact
|
103
|
+
RubyZoho::Crm::Lead
|
104
|
+
RubyZoho::Crm::Potential
|
105
|
+
RubyZoho::Crm::Quote
|
106
|
+
|
107
|
+
|
108
|
+
==Bugs and Enhancments
|
109
|
+
Please open an issue on GitHub. Or better yet, send in a pull request.
|
110
|
+
|
23
111
|
---
|
24
112
|
|
25
113
|
== Contributing to rubyzoho
|
26
|
-
|
114
|
+
|
115
|
+
* Pull requests with unit tests or specs and a version branch are welcomed.
|
27
116
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
28
117
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
29
118
|
* Fork the project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/rubyzoho-0.0.2.gem
ADDED
Binary file
|
data/rubyzoho.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rubyzoho"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["amalc"]
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/api_utils.rb",
|
31
31
|
"lib/ruby_zoho.rb",
|
32
32
|
"lib/zoho_api.rb",
|
33
|
+
"rubyzoho-0.0.2.gem",
|
33
34
|
"rubyzoho.gemspec",
|
34
35
|
"spec/api_utils_spec.rb",
|
35
36
|
"spec/fixtures/sample_contact.xml",
|
@@ -44,7 +45,7 @@ Gem::Specification.new do |s|
|
|
44
45
|
s.homepage = "http://github.com/amalc/rubyzoho"
|
45
46
|
s.licenses = ["MIT"]
|
46
47
|
s.require_paths = ["lib"]
|
47
|
-
s.rubygems_version = "1.8.
|
48
|
+
s.rubygems_version = "1.8.24"
|
48
49
|
s.summary = "A set of Ruby classes supporting the ActiveRecord lifecycle for the Zoho API."
|
49
50
|
|
50
51
|
if s.respond_to? :specification_version then
|
data/spec/ruby_zoho_spec.rb
CHANGED
@@ -37,6 +37,9 @@ describe RubyZoho::Crm do
|
|
37
37
|
r.each { |m| m.email.should eq('bob@smith.com') }
|
38
38
|
r = RubyZoho::Crm::Contact.find_by_last_name('Smithereens')
|
39
39
|
r.should_not eq(nil)
|
40
|
+
r.first.should_not eq(nil)
|
41
|
+
r.last.should_not eq(nil)
|
42
|
+
r.map { |c| c.last_name }.count.should eq(3)
|
40
43
|
r.first.last_name.should eq('Smithereens')
|
41
44
|
r.each { |m| RubyZoho::Crm::Contact.delete(m.contactid) }
|
42
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyzoho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- lib/api_utils.rb
|
209
209
|
- lib/ruby_zoho.rb
|
210
210
|
- lib/zoho_api.rb
|
211
|
+
- rubyzoho-0.0.2.gem
|
211
212
|
- rubyzoho.gemspec
|
212
213
|
- spec/api_utils_spec.rb
|
213
214
|
- spec/fixtures/sample_contact.xml
|
@@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
240
|
version: '0'
|
240
241
|
requirements: []
|
241
242
|
rubyforge_project:
|
242
|
-
rubygems_version: 1.8.
|
243
|
+
rubygems_version: 1.8.24
|
243
244
|
signing_key:
|
244
245
|
specification_version: 3
|
245
246
|
summary: A set of Ruby classes supporting the ActiveRecord lifecycle for the Zoho
|