The Teamsupport Ruby Gem
A Ruby interface to the Teamsupport API.
gem install teamsupport
To access custom fields you will need to use the attrs method along with the api field name:
customer = client.customer(213747670) customer.attrs[:CustomField1]
Caveat: The TeamSupport API currently returns boolean values as "True"/"False" strings. A workaround has been applied to the teamsupport gem that will return a boolean true/false for any of the standard TeamSupport values that should be a boolean (ie. IsActive on customers and IsClosed on tickets). Any additional custom fields that were created in TeamSupport will return the "True"/"False" string value instead of the proper boolean.
The Teamsupport API requires you to authenticate via Basic Auth, using an Organization ID (aka API Key) and an API Token (aka API Secret).
You'll need to configure these values before you make a request or else you'll get the error:
Bad Authentication data
You can pass configuration options as a block to
client = Teamsupport::REST::Client.new do |config| config.api_key = "TEAMSUPPORT_ORGANIZATION_ID" config.api_secret = "TEAMSUPPORT_API_TOKEN" config.api_url = "TEAMSUPPORT_API_URL" end
The API url is not required and will default to
https://app.teamsupport.com if not defined in config.
After configuring a
client, you can do the following things.
Fetch a single customer (by organization ID)
Fetch a list of customers with details (by organization ID, or by implicit authenticated parent organization)
Fetch a single product (by product ID)
Fetch a list of products with details (by product ID, or by implicit authenticated parent organization)
Fetch a list of products for a customer (by customer ID)
Fetch a single ticket (by ticket ID, or by ticket Number)
Fetch a list of tickets with details (by ticket ID, or by implicit authenticated parent organization)
Fetch a list of tickets for a customer (by customer ID)
This entity-relationship diagram is generated programatically. If you add or remove any Teamsupport objects, please regenerate the ERD with the following command:
bundle exec rake erd
Supported Ruby Versions
This library aims to support and is tested against the following Ruby versions:
- Ruby 2.0.0
- Ruby 2.1
- Ruby 2.2
- JRuby 126.96.36.199
Copyright (c) 2016 Jon Beilke. See LICENSE for details.