0.02
No release in over 3 years
Low commit activity in last 3 years
Ruby wrapper for the ServiceNow REST API (formerly servicenow-ruby)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.16
>= 0
>= 12.3.3
~> 3.0

Runtime

 Project Readme

ServiceNow

The ServiceNow Ruby library provides convenient access to the ServiceNow REST API. The library is structured such that it can be used to manage multiple ServiceNow tenants.

Note: Not all API endpoints are implemented and more continue to be added as time permits.

Documentation

API documentation:

Installation

Add this line to your application's Gemfile:

gem 'servicenow-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install servicenow-api

Usage

To create a client for a ServiceNow instance using OAuth:

client = ServiceNow::Client.authenticate(
    "myhost.service-now.com",
    "client_id",
    "client_secret",
    "username",
    "password"
)

# get all incidents
client.incidents.all()

API methods are organized in the client based on the record type. For example, methods for creating/modifying/deleting incidents can be accessed through the incidents namespace:

# get all incidents
client.incidents.all()

# create a new incident
client.incidents.create(
    short_description: "My First Incident",
    description: "This incident is the best incident because..."
)

Table Access

Any table can be accessed using the tables() method of the client. Simply specify the table name and you can interact with the table through the ServiceNow Tables API methods.

# get a reference to the table
mytable = client.tables("my_table")

# get all the table rows
mytable.all()

Filtering, Sorting, Paging

Not yet implemented.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Run all tests:

bundle exec rake spec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/huntresslabs/servicenow-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the servicenow-ruby project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.