zoho-crm 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +26 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/zoho_crm.rb +24 -0
- data/lib/zoho_crm/account.rb +46 -0
- data/lib/zoho_crm/configuration.rb +10 -0
- data/lib/zoho_crm/fetch.rb +18 -0
- data/lib/zoho_crm/lead.rb +42 -0
- data/lib/zoho_crm/response_object.rb +10 -0
- data/lib/zoho_crm/version.rb +3 -0
- data/lib/zoho_crm/zoho_api_utils.rb +32 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 748ffb0dc7979f6034b1e7783316bdf2906ffd47fa10ce7fca915835fb2aa78d
|
4
|
+
data.tar.gz: d2437364fa1805027283a6e256416569bafb6d2ae843f76b0a3ecd2821bbe813
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e2d48afdf6d83f9857c8ae7f26069192ba0ad8ede02e31b19ea1799f1d41becd052befc08d04c4204d3006aec4ca181ec858a737d6dfd8745fde84db7dc1f80d
|
7
|
+
data.tar.gz: 4bd9440b57369576a5f058cb14a251aa036645d189ff5a139dfd1caa6a38ad09677573a69473987fda616073eb6a3313bca673f4c61fdefa36021bf62da8fa4b
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at chalcchuck@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
zoho_crm (0.1.0)
|
5
|
+
httparty (~> 0.16.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
httparty (0.16.2)
|
11
|
+
multi_xml (>= 0.5.2)
|
12
|
+
minitest (5.11.3)
|
13
|
+
multi_xml (0.6.0)
|
14
|
+
rake (10.5.0)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
ruby
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
bundler (~> 1.16)
|
21
|
+
minitest (~> 5.0)
|
22
|
+
rake (~> 10.0)
|
23
|
+
zoho_crm!
|
24
|
+
|
25
|
+
BUNDLED WITH
|
26
|
+
1.16.1
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# ZohoCrm
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/zoho_crm`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'zoho_crm'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install zoho_crm
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/chalchuck/zoho_crm. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## Code of Conduct
|
38
|
+
|
39
|
+
Everyone interacting in the ZohoCrm project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/chalchuck/zoho_crm/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "zoho_crm"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/zoho_crm.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'zoho_crm/configuration'
|
2
|
+
require 'httparty'
|
3
|
+
require 'rexml/document'
|
4
|
+
require 'zoho_crm/zoho_api_utils'
|
5
|
+
require 'zoho_crm/fetch'
|
6
|
+
require 'zoho_crm/account'
|
7
|
+
require 'zoho_crm/lead'
|
8
|
+
require 'zoho_crm/response_object'
|
9
|
+
require 'zoho_crm/version'
|
10
|
+
|
11
|
+
module ZohoCrm
|
12
|
+
class << self
|
13
|
+
|
14
|
+
attr_writer :configuration
|
15
|
+
|
16
|
+
def configuration
|
17
|
+
@configuration ||= Configuration.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def setup
|
21
|
+
yield(configuration)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module ZohoCrm
|
2
|
+
module Account
|
3
|
+
class << self
|
4
|
+
|
5
|
+
# ZohoCrm::Account.fields
|
6
|
+
#
|
7
|
+
def fields
|
8
|
+
query = Hash(authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi')
|
9
|
+
ZohoCrm::Fetch.get(ZohoCrm::ZohoApiUtils.create_url('Accounts', 'getField'), query)
|
10
|
+
end
|
11
|
+
|
12
|
+
# ZohoCrm::Account.find(id)
|
13
|
+
#
|
14
|
+
def find(account_id)
|
15
|
+
raise "Arguments missing: account_id" if account_id.nil?
|
16
|
+
query = Hash(authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi', id: account_id)
|
17
|
+
ZohoCrm::Fetch.get(ZohoCrm::ZohoApiUtils.create_url('Accounts', 'getRecordById'), query)
|
18
|
+
end
|
19
|
+
|
20
|
+
# account_attributes = {}
|
21
|
+
# ZohoCrm::Account.create(account_attributes)
|
22
|
+
#
|
23
|
+
def create(account_attributes)
|
24
|
+
query =
|
25
|
+
Hash(
|
26
|
+
authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi',
|
27
|
+
xmlData: ZohoCrm::ZohoApiUtils.build_attributes('Accounts', account_attributes)
|
28
|
+
)
|
29
|
+
ZohoCrm::Fetch.post(ZohoCrm::ZohoApiUtils.create_url('Accounts', 'insertRecords'), query)
|
30
|
+
end
|
31
|
+
|
32
|
+
# account_attributes={}
|
33
|
+
# ZohoCrm::Account.update(account_id, account_attributes)
|
34
|
+
#
|
35
|
+
def update(account_id, account_attributes)
|
36
|
+
raise "Arguments missing: account_id" if account_id.nil?
|
37
|
+
query =
|
38
|
+
Hash(
|
39
|
+
authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi', id: account_id,
|
40
|
+
xmlData: ZohoCrm::ZohoApiUtils.build_attributes('Accounts', account_attributes)
|
41
|
+
)
|
42
|
+
ZohoCrm::Fetch.post(ZohoCrm::ZohoApiUtils.create_url('Accounts', 'updateRecords'), query)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ZohoCrm
|
2
|
+
module Fetch
|
3
|
+
include HTTParty
|
4
|
+
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def get(url, query)
|
8
|
+
response = HTTParty.get(url, query: query, headers: {'Content-Type' => 'application/json'})
|
9
|
+
ZohoCrm::ResponseObject.new(response)
|
10
|
+
end
|
11
|
+
|
12
|
+
def post(url, query)
|
13
|
+
response = HTTParty.post(url, query: query, headers: {'Content-Type' => 'application/xml'})
|
14
|
+
ZohoCrm::ResponseObject.new(response)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module ZohoCrm
|
2
|
+
module Lead
|
3
|
+
class << self
|
4
|
+
|
5
|
+
# ZohoCrm::Leads.fields
|
6
|
+
def fields
|
7
|
+
query = Hash(authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi')
|
8
|
+
ZohoCrm::Fetch.get(ZohoCrm::ZohoApiUtils.create_url('Leads', 'getField'), query)
|
9
|
+
end
|
10
|
+
|
11
|
+
# ZohoCrm::Lead.find(id)
|
12
|
+
def find(lead_id)
|
13
|
+
raise "Arguments missing: lead_id" if lead_id.nil?
|
14
|
+
query = Hash(authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi', id: lead_id)
|
15
|
+
ZohoCrm::Fetch.get(ZohoCrm::ZohoApiUtils.create_url('Leads', 'getRecordById'), query)
|
16
|
+
end
|
17
|
+
|
18
|
+
# lead_attributes = {}
|
19
|
+
# ZohoCrm::Lead.create(lead_attributes)
|
20
|
+
def create(lead_attributes)
|
21
|
+
query =
|
22
|
+
Hash(
|
23
|
+
authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi',
|
24
|
+
xmlData: ZohoCrm::ZohoApiUtils.build_attributes('Leads', lead_attributes)
|
25
|
+
)
|
26
|
+
ZohoCrm::Fetch.post(ZohoCrm::ZohoApiUtils.create_url('Leads', 'insertRecords'), query)
|
27
|
+
end
|
28
|
+
|
29
|
+
# ZohoCrm::Lead.update(lead_id, lead_attributes)
|
30
|
+
# lead_attributes={}
|
31
|
+
def update(lead_id, lead_attributes)
|
32
|
+
raise "Arguments missing: lead_id" if lead_id.nil?
|
33
|
+
query =
|
34
|
+
Hash(
|
35
|
+
authtoken: ZohoCrm.configuration.api_token, scope: 'crmapi',
|
36
|
+
id: lead_id, xmlData: ZohoCrm::ZohoApiUtils.build_attributes('Leads', lead_attributes)
|
37
|
+
)
|
38
|
+
ZohoCrm::Fetch.post(ZohoCrm::ZohoApiUtils.create_url('Leads', 'updateRecords'), query)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module ZohoCrm
|
2
|
+
module ZohoApiUtils
|
3
|
+
class << self
|
4
|
+
#/// api_call ////////
|
5
|
+
# -> insertRecords
|
6
|
+
# -> updateRecords
|
7
|
+
# -> getModules
|
8
|
+
#
|
9
|
+
def create_url(module_name, api_call)
|
10
|
+
"https://crm.zoho.com/crm/private/xml/#{module_name}/#{api_call}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def build_attributes(module_name, field_values_hash)
|
14
|
+
rexml = REXML::Document.new
|
15
|
+
element = rexml.add_element(module_name)
|
16
|
+
row = element.add_element('row', {'no' => '1'})
|
17
|
+
field_values_hash.each_pair { |k, v| add_field(row, k, v) }
|
18
|
+
rexml.to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def add_field(row, field, value)
|
24
|
+
r = (REXML::Element.new 'FL')
|
25
|
+
r.attributes['val'] = field.to_s
|
26
|
+
r.add_text("#{value}")
|
27
|
+
row.elements << r
|
28
|
+
row
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zoho-crm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Charles Chuck
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-26 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.16.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.16.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
description: Ruby Wrapper for ZohoCrm
|
70
|
+
email:
|
71
|
+
- chalcchuck@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- CODE_OF_CONDUCT.md
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- lib/zoho_crm.rb
|
86
|
+
- lib/zoho_crm/account.rb
|
87
|
+
- lib/zoho_crm/configuration.rb
|
88
|
+
- lib/zoho_crm/fetch.rb
|
89
|
+
- lib/zoho_crm/lead.rb
|
90
|
+
- lib/zoho_crm/response_object.rb
|
91
|
+
- lib/zoho_crm/version.rb
|
92
|
+
- lib/zoho_crm/zoho_api_utils.rb
|
93
|
+
homepage: https://gitlab.org/touchinspiration/zoho_crm
|
94
|
+
licenses: []
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.7.7
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Ruby Wrapper for ZohoCrm
|
116
|
+
test_files: []
|