zoho_hub 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +20 -25
- data/.ruby-version +1 -1
- data/README.md +23 -20
- data/lib/zoho_hub/base_record.rb +1 -1
- data/lib/zoho_hub/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d69358949e8262ad9da808101b0bbb2da5d0eae262d2d34ab032e5097d58f5ba
|
4
|
+
data.tar.gz: a0b64a4714925fa5a6392e43ecd991aaf71e9b3991e4505a5d2703bca22f8269
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d02305e21aae61e11f09a010b8f22dab327af638b036ca075abb47e0943eaad1870355e976c208b00c9a5dfa87f05ff82f60754fd50f1eccee97e37a7e3c8967
|
7
|
+
data.tar.gz: 756fb2bd03d39e70f46fdc04eb34bea1310701b72ba363a3b6c79fab033ccf5defa2b615edcae9af6c86cae45dacf24bcefd59c3c17ff2a4c3b7456f0595b0ed
|
data/.github/workflows/ci.yml
CHANGED
@@ -6,17 +6,17 @@ jobs:
|
|
6
6
|
lint:
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
steps:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- uses: ruby/setup-ruby@v1
|
11
|
+
with:
|
12
|
+
ruby-version: '2.5'
|
13
|
+
bundler-cache: true
|
14
|
+
- name: rubocop version
|
15
|
+
timeout-minutes: 1
|
16
|
+
run: bundle exec rubocop --version
|
17
|
+
- name: rubocop
|
18
|
+
timeout-minutes: 5
|
19
|
+
run: bundle exec rubocop -c .rubocop.yml
|
20
20
|
|
21
21
|
test:
|
22
22
|
runs-on: ubuntu-latest
|
@@ -24,19 +24,14 @@ jobs:
|
|
24
24
|
strategy:
|
25
25
|
fail-fast: false
|
26
26
|
matrix:
|
27
|
-
ruby: [
|
27
|
+
ruby: ['2.5', '2.6', '2.7', '3.0']
|
28
28
|
experimental: [false]
|
29
|
-
include:
|
30
|
-
- ruby: "jruby"
|
31
|
-
experimental: true
|
32
|
-
- ruby: "truffleruby"
|
33
|
-
experimental: true
|
34
29
|
steps:
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
30
|
+
- uses: actions/checkout@v2
|
31
|
+
- uses: ruby/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: ${{matrix.ruby}}
|
34
|
+
bundler-cache: true
|
35
|
+
- name: Run tests
|
36
|
+
timeout-minutes: 5
|
37
|
+
run: ${{matrix.env}} bundle exec rspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.6
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# ZohoHub
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.com/rikas/zoho_hub.svg?branch=master)](https://travis-ci.com/rikas/zoho_hub)
|
4
3
|
[![Gem Version](https://badge.fury.io/rb/zoho_hub.svg)](https://badge.fury.io/rb/zoho_hub)
|
5
4
|
|
6
5
|
Simple wrapper around Zoho CRM version2, using
|
@@ -75,10 +74,10 @@ This will give you a **Client ID** and a **secret**, that you'll use in
|
|
75
74
|
Registration and authorization requests are made to Zoho's domain-specific Accounts URL which
|
76
75
|
varies depending on your region:
|
77
76
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
- China: https://accounts.zoho.com.cn
|
78
|
+
- EU: https://accounts.zoho.eu
|
79
|
+
- India: https://accounts.zoho.in
|
80
|
+
- US: https://accounts.zoho.com
|
82
81
|
|
83
82
|
ZohoHub uses the EU Account URL by default, but this can be overriden in a `ZohoHub.configure` block
|
84
83
|
via the `api_domain` method ([step 2](#2-configure-zohohub-with-your-credentials).)
|
@@ -97,8 +96,8 @@ authorization (see [3.2](#32-self-client-authorization).)
|
|
97
96
|
|
98
97
|
### 2. Configure ZohoHub with your credentials
|
99
98
|
|
100
|
-
> **Note:** Treat these credentials like an important password. It is
|
101
|
-
> paste them anywhere in plain text. Do
|
99
|
+
> **Note:** Treat these credentials like an important password. It is _strongly_ recommended to not
|
100
|
+
> paste them anywhere in plain text. Do _not_ add them to version control; keep them out of your
|
102
101
|
> code directly by referencing them via environment variables. Use something like the dotenv gem or
|
103
102
|
> encrypted credentials in Rails to keep them as secret and secure as possible.
|
104
103
|
|
@@ -168,7 +167,7 @@ ZohoCRM.modules.all
|
|
168
167
|
To get the URL for a different scope you can provide a `scope` argument:
|
169
168
|
|
170
169
|
```ruby
|
171
|
-
ZohoHub::Auth.auth_url(
|
170
|
+
ZohoHub::Auth.auth_url(scopes: ['ZohoCRM.modules.custom.all', 'ZohoCRM.modules.all'])
|
172
171
|
# => "https://accounts.zoho.eu/oauth/v2/auth?access_type=offline&client_id=&redirect_uri=&response_type=code&scope=ZohoCRM.modules.custom.all,ZohoCRM.modules.all"
|
173
172
|
```
|
174
173
|
|
@@ -214,7 +213,7 @@ To use an **access token** with ZohoHub, pass it to the `ZohoHub.setup_connectio
|
|
214
213
|
|
215
214
|
This gem automatically refresh the access token.
|
216
215
|
|
217
|
-
If you want automatic refresh, use the refresh_token argument as in the next chapter.
|
216
|
+
If you want automatic refresh, use the `refresh_token` argument as in the next chapter.
|
218
217
|
|
219
218
|
---
|
220
219
|
|
@@ -363,10 +362,13 @@ attachment = Lead.download_attachment(parent_id: lead.id, attachment_id:attachme
|
|
363
362
|
```
|
364
363
|
|
365
364
|
## 8 Notifications
|
365
|
+
|
366
366
|
Zoho allows you to receive a notification when a record of a module changes. Supported operation types are create, delete, edit, all.
|
367
367
|
|
368
368
|
### 8.1 Enable notifications
|
369
|
+
|
369
370
|
In order to receive notifications, you have to enable them first.
|
371
|
+
|
370
372
|
```ruby
|
371
373
|
# Enable notifications for a given channel:
|
372
374
|
notification_url = 'https://example.org/api/notifications' # Zoho will send notifications by POST to this url
|
@@ -383,6 +385,7 @@ After enabling notifications, Zoho will execute a POST request to the provided n
|
|
383
385
|
For a list of an in-depth description of the response, check the [Zoho documentation](https://www.zoho.com/crm/developer/docs/api/notifications/overview.html)
|
384
386
|
|
385
387
|
### 8.2 List notifications
|
388
|
+
|
386
389
|
You can also retrieve all notifications that are currently enabled and that you are receiving uppdates for.
|
387
390
|
|
388
391
|
```ruby
|
@@ -392,21 +395,21 @@ ZohoHub::Notifications.all
|
|
392
395
|
|
393
396
|
### 8.3 Caveats
|
394
397
|
|
395
|
-
|
396
|
-
|
398
|
+
- Zoho does not notify you when records are merged.
|
399
|
+
- Since Zoho does not tell you what changed, you will have to request the record by yourself. Due to this you can miss changes, when they occur quickly after another. This is especially important for status changes, as you might miss state changes.
|
397
400
|
|
398
401
|
## Tips and suggestions
|
399
402
|
|
400
|
-
|
403
|
+
- Using a tool such as Postman or curl to issue HTTP requests and verify responses in isolation
|
401
404
|
can be a great sanity check during setup.
|
402
|
-
|
405
|
+
- Downloading ZohoHub code (as opposed to the gem) and running `bin/console` is a great way to
|
403
406
|
learn how the code works and test aspects of setup and Zoho's API in isolation.
|
404
|
-
|
407
|
+
- [The Zoho API Documentation](https://www.zoho.com/crm/help/developer/api/overview.html) is your
|
405
408
|
friend - especially the sample HTTP requests and responses in the various sections under "Rest
|
406
409
|
API" on the left.
|
407
|
-
|
410
|
+
- If you're manually implementing your record classes (rather than using the reflection mechanism),
|
408
411
|
the files in `/examples/models/` can help you get started.
|
409
|
-
|
412
|
+
- Requests can be issued to Zoho CRM's
|
410
413
|
[Sandbox](https://help.zoho.com/portal/kb/articles/using-sandbox)
|
411
414
|
by configuring `https://crmsandbox.zoho.com/crm` (or regional equivalent) as the `api_domain`.
|
412
415
|
|
@@ -430,8 +433,8 @@ ZohoHub::Notifications.all
|
|
430
433
|
```
|
431
434
|
|
432
435
|
2. [Register your application](#1-register-your-application) to obtain a **client ID** and
|
433
|
-
**secret**. (Leave the [Zoho API Credentials page](https://accounts.zoho.com/developerconsole) open;
|
434
|
-
you'll need it in step 5.)
|
436
|
+
**secret**. (Leave the [Zoho API Credentials page](https://accounts.zoho.com/developerconsole) open;
|
437
|
+
you'll need it in step 5.)
|
435
438
|
3. Determine your [Zoho Accounts URL](#11-zoho-accounts-url).
|
436
439
|
4. Add your registration and account URL information to a `.env` file:
|
437
440
|
|
@@ -444,9 +447,9 @@ ZOHO_API_DOMAIN=YOUR_ZOHO_ACCOUNTS_URL
|
|
444
447
|
```
|
445
448
|
|
446
449
|
5. On the [Zoho API Credentials page](https://accounts.zoho.com/developerconsole) from step 1, click
|
447
|
-
the three vertical dots and select `Self client`.
|
450
|
+
the three vertical dots and select `Self client`.
|
448
451
|
6. Paste this into the `Scope` field: `ZohoCRM.users.ALL`, choose an expiration time, and click
|
449
|
-
`View Code`; this is your **Grant token**.
|
452
|
+
`View Code`; this is your **Grant token**.
|
450
453
|
7. Run the ZohoHub console from your terminal: `bin/console`
|
451
454
|
8. Issue a token request with the **grant token** (notice the quotes around the token value):
|
452
455
|
|
data/lib/zoho_hub/base_record.rb
CHANGED
@@ -122,7 +122,7 @@ module ZohoHub
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def update_all(records)
|
125
|
-
zoho_params = records.transform_keys { |key| attr_to_zoho_key(key) }
|
125
|
+
zoho_params = records.map { |record| record.transform_keys { |key| attr_to_zoho_key(key) } }
|
126
126
|
|
127
127
|
body = put(File.join(request_path), data: zoho_params)
|
128
128
|
|
data/lib/zoho_hub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoho_hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Otero
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -316,7 +316,7 @@ homepage: https://github.com/rikas/zoho_hub
|
|
316
316
|
licenses:
|
317
317
|
- MIT
|
318
318
|
metadata: {}
|
319
|
-
post_install_message:
|
319
|
+
post_install_message:
|
320
320
|
rdoc_options: []
|
321
321
|
require_paths:
|
322
322
|
- lib
|
@@ -331,9 +331,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
331
|
- !ruby/object:Gem::Version
|
332
332
|
version: '0'
|
333
333
|
requirements: []
|
334
|
-
|
335
|
-
|
336
|
-
signing_key:
|
334
|
+
rubygems_version: 3.1.6
|
335
|
+
signing_key:
|
337
336
|
specification_version: 4
|
338
337
|
summary: Simple gem to connect to Zoho CRM API V2
|
339
338
|
test_files: []
|