No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for Unleashed API https://apidocs.unleashedsoftware.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.7, >= 2.7.6
>= 0

Runtime

~> 0.18.0, >= 0.18.1
 Project Readme

Unleashed

A Ruby wrapper for Unleashed

Check out example app here and example app repo here.

Documentation

The documentation for Unleashed API can be found here

Supported Resources

This library supports the following resources:

Installation

Add this line to your application's Gemfile:

gem 'unleashed_client'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install unleashed_client

Getting Started

1. Unleashed API key and API ID

Before you can use the gem, you will have to register and get your API key and API ID. Check out Unleashed get started page for more information.

2. Set your ENV

Set your API_KEY and API_ID as your environment variables. If you're managing your environment variables dotenv add API_KEY=your_key and API_ID=your_id to your .env file, or if you're using something like Figaro set your API_KEY: your_key and your API_ID: your_id.

3. Use it

require 'unleashed_client'

@client = UnleashedClient::SalesOrder.new(api_key: ENV['API_KEY'], api_id: ENV['API_ID'])

Get total number of pages

This is useful if you need to iterate over all pages and get all the data:

pages = @client.get_number_of_pages

Get the first 200 sales orders

Returns the first 200 sales orders because page number 1 is the default:

items = @client.get_first_200

Get sales orders from a specific page

your_page_number = 2

items = @client.get_orders_from_page(page_number: your_page_number)

Example usage: You can combine get_orders_from_page with get_number_of_pages. This will allow you to loop through all available pages and get the data (for example, if you are creating records in your local database):

require 'unleashed_client'

@client = UnleashedClient::SalesOrder.new(api_key: ENV['API_KEY'], api_id: ENV['API_ID'])

number_of_pages = @client.get_number_of_pages

number_of_pages.downto(1).each do |i|
    items = @client.get_orders_from_page(page_number: i)
    # do stuff with items
end

Get sales orders details

Returns details of a particular sales order using sales order guid value (ex guid: E6E8163F-6911-40e9-B740-90E5A0A3A996)

your_guid = "E6E8163F-6911-40e9-B740-90E5A0A3A996"
response = @client.get_details(guid: your_guid)

# response["Guid"] => "E6E8163F-6911-40e9-B740-90E5A0A3A996"
# response["OrderNumber"] => "SO-xxx"
# ...

TODO

  • Add better tests wth Rspec;
  • Let users pick returned data type between JSON and Xml;

What has to be added for SalesOrders resource:

  • creating new sales orders;
  • complete a sales order;
  • update a sales order;

Other resources to be added:

Author