Skip to content

customerlobby/zoho_api

Repository files navigation

ZohoApi

A Ruby wrapper for the Zoho REST API.

Installation

Add this line to your application's Gemfile:

gem 'zoho_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install zoho_api

Usage

Configuration

Before you can make calls to Zoho you must configure the library with a valid client_id, client_secret and redirect_uri.

There are two ways to configure the gem. You can pass a hash of configuration options when you create a client, or you can use a configure block.

Initializing Zoho Invoice client:

client = ZohoApi::Invoice::Client.new(client_id: "YOUR_CLIENT_ID_HERE",
                                      client_secret: "YOUR_CLIENT_SECRET_HERE",
                                      redirect_uri: "YOUR_REDIRECT_URI_HERE",
                                      access_token: "YOUR_ACCESS_TOKEN_HERE",
                                      refresh_token: "YOUR_REFRESH_TOKEN_HERE")

Initializing Zoho Books client:

client = ZohoApi::Books::Client.new(client_id: "YOUR_CLIENT_ID_HERE",
                                    client_secret: "YOUR_CLIENT_SECRET_HERE",
                                    redirect_uri: "YOUR_REDIRECT_URI_HERE",
                                    access_token: "YOUR_ACCESS_TOKEN_HERE",
                                    refresh_token: "YOUR_REFRESH_TOKEN_HERE")

Initializing Zoho Books client with sandbox environment:

client = ZohoApi.client(client_id: "YOUR_CLIENT_ID_HERE",
                        client_secret: "YOUR_CLIENT_SECRET_HERE",
                        redirect_uri: "YOUR_REDIRECT_URI_HERE",
                        auth_code: "YOUR_AUTH_CODE_HERE",
                        sandbox: true)

Token Apis

Generate access and refresh tokens from auth_code

client.fetch_tokens

Generate access token from refresh token

client.renew_token

Note: You don't need to refresh client's access and refresh tokens after hitting these apis

Customer Apis (Zoho Invoice/Books)

Get specific contact details

client.contact('CONTACT_UUID')

Get all the contacts

client.contacts

Get contacts by page

# default value of page is 1
# default value of per_page is 200  
client.clients(page: 2, per_page: 10)

Invoice Apis (Zoho Invoice/Books)

Get specific invoice details

client.invoice('INVOICE_UUID')

Get all the invoices

client.invoices

Get invoices by page

# default value of page is 1
# default value of per_page is 200  
client.invoices(page: 2, per_page: 10)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Wrapper for the Zoho API

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •