lib |
5y .gitignore |
5y Gemfile |
5y Gemfile.lock |
5y LICENSE.txt |
5y README.md |
5y Rakefile |
5y TESTING.md |
5y service_m8.gemspec |
A Ruby wrapper for the ServiceM8 REST API.
Add this line to your application's Gemfile:
gem 'service_m8'
And then execute:
$ bundle
Or install it yourself as:
$ gem install service_m8
Before you can make calls to ServiceM8 you must configure the library with a valid email & password or a valid OAuth access token.
There are two ways to configure the gem. You can pass a hash of configuration options when you create a client, or you can use a configure block.
Using an OAuth access token:
client = ServiceM8.client(access_token: "YOUR_ACCESS_TOKEN_HERE")
Using a Basic access authentication:
ServiceM8.configure do |config| config.email = "YOUR_EMAIL_HERE" config.password = "YOUR_PASSWORD_HERE" end
Using OAuth access token
ServiceM8.configure do |config| config.access_token = 'ACCESS_TOKEN' end
Create ServiceM8 client
client = ServiceM8.client
get specific client details
client.client('CLIENT_UUID')
get all the clients
client.clients
get clients by page, first page cursor value will always be -1 and next page cursor value can be obtained from current page response
client.clients(cursor: -1)
filter clients by date
client.clients(filter: 'edit_date gt 2017-01-01')
filter clients by date and get all the records by page
client.clients(cursor: 'NEXT_CURSOR_VALUE_FROM_RESPONSE', filter: 'edit_date gt 2017-01-01')
get specific client's contact details
client.company_contacts(filter: 'company_uuid eq CLIENT_UUID')
get all the client's contacts
client.company_contacts
get specific job details
client.job('JOB_UUID')
get all the jobs
client.jobs
get all the jobs by page: first page cursor value will always be -1 and next page cursor value can be obtained from current page response
client.jobs(cursor: -1)
filter jobs by date
client.jobs(filter: 'date gt 2017-02-02')
filter jobs by date and get all the records by page
client.jobs(cursor: 'NEXT_CURSOR_VALUE_FROM_RESPONSE', filter: 'date gt 2017-02-02')
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)