This gem is a wrapper for the Zoho Inventory API.
Add this line to your application's Gemfile:
gem 'zoho_inventory'
And then execute:
$ bundle
Or install it yourself as:
$ gem install zoho_inventory
In order to authenticate to the Zoho Inventory API, do the following:
ZohoInventory.auth_token = "REPLACE_WITH_YOUR_AUTH_TOKEN"
ZohoInventory.organization_id = "REPLACE_WITH_YOUR_ORGANIZATION_ID"
Every API call that result in an error from zoho will result in a ZohoError
exception thrown.
begin
# Zoho API Call
ZohoInventory::Item.retrieve("item_id")
rescue ZohoError => e
# Exception thrown
puts e.message
end
The gem implements all CRUD operations available to the different Zoho models. More info on available operations here
For example, with items:
# Create an item
ZohoInventory::Item.create({ name: "Death Star", ... })
# List all items
ZohoInventory::Item.list
# Retrieve an item
ZohoInventory::Item.retrieve(item_id)
# Update an item
ZohoInventory::Item.update(item_id, { name: "X-Wing", ... })
# Delete an item
ZohoInventory::Item.delete(item_id)
The Zoho models avaiable in the gem are: organizations
, items
, users
, invoices
and contacts
.
Special model-specific actions such as mark_as_active
will be added once all model CRUD actions are implemented. It will be documented below
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
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.
Bug reports and pull requests are welcome on GitHub at https://github.com/Virolea/zoho_inventory. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the ZohoInventory project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Ping me on Twitter for any question!