Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

customerlobby / service_monster   ruby

Repository URL to install this package:

  lib
  spec
2y   .gitignore
2y   .rspec
2y   Gemfile
2y   LICENSE.txt
2y   README.md
2y   Rakefile
2y   service_monster.gemspec
  README.md

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 four Service Monster resources implemented in this client; Accounts, Orders, Jobs and Reminders. 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)

Getting a list of jobs:

client.jobs(params)

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

client.job(id, params)

Getting a list of reminders:

client.reminders(params)

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

client.reminder(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. Page count starts from 0

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