Skip to content

tomasz-buchta/service_monster

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ServiceMonster

A Ruby wrapper for the Service Monster REST API.

Installation

Add this line to your application's Gemfile:

gem 'service_monster'

And then execute:

$ bundle

Or install it yourself as:

$ gem install service_monster

Usage

Configuration

Before you can make calls to ServiceMonster you must configure the library with a valid API Token. You can request a token be generated by ServiceMonster. The API Token ties the API request to a particualr ServiceMonster company id.

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

client = ServiceMonster.client({api_key: "YOUR_KEY_HERE"})
ServiceMonster.configure do |config|
  config.api_key = "YOUR_KEY_HERE"
end

client = ServiceMonster.client

Resources

There are currently two Service Monster resources implemented in this client; Accounts and Orders. See the parameters section below for information about what kinds of parameters can be sent to Service Monster.

Getting a list of accounts:

client.accounts(params)

Getting a single account (the id parameter is the Service Monster GUID for the account):

client.account(id, params)

Getting a list of orders:

client.orders(params)

Getting a single order (the id parameter is the Service Monster GUID for the order):

client.order(id, params)

Parameters

ServiceMonster supports several parameters that can be passed to their API to change the results you receive.

  • q: Search term. Supply this parameter with a value to return results on which this search term matches at least one of the fields.
  • fields: Field list. Supply a comma separated list of fields you would like to be returned. See http://developer.servicemonster.net/Documentation.aspx?ID=1 for a list of resources and the available fields for each.
  • limit: The number of records to return in the result. Defaults to 10.
  • page: The page of data to return in the result. Defaults to the first page of data.

If you wish to filter a resource for a particular value in a field or set of dates use the following three parameters.

  • wField: A field name from the resource to filter on.
  • wOperator: An operator to use with the filter field. This can be one of:
    • gt
    • lt
    • eq
  • wValue: The value used to filter the wField with.

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 Service Monster API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%