lib/servicenow/client.rb in servicenow-1.1.2 vs lib/servicenow/client.rb in servicenow-1.1.3
- old
+ new
@@ -2,10 +2,11 @@
require 'httpi'
require 'json'
module Servicenow
+ # Client is the client to interact with the ServiceNow REST API
class Client
attr_reader :snow_api_base_url, :snow_table_url
# Initialization parameters for username, password and URL are normally
@@ -40,12 +41,12 @@
#
# @return [Array<Servicenow::Change>]
def get_changes_by_user(user_id)
url = format('%s/change_request', @snow_table_url)
query = {
- sysparm_limit: 10,
- sysparm_query: "active=true^GOTOu_cr_requester.u_name_idLIKE#{user_id}"
+ sysparm_limit: 10,
+ sysparm_query: "active=true^GOTOu_cr_requester.u_name_idLIKE#{user_id}"
}
response = send_request(url, query)
obj = JSON.parse response.body
@@ -59,13 +60,13 @@
#
# @return [Array<Servicenow::Change>]
def get_changes_by_query(encodedquery, limit=10, page=1)
url = format('%s/change_request', @snow_table_url)
query = {
- sysparm_limit: limit,
- sysparm_page: page,
- sysparm_query: encodedquery
+ sysparm_limit: limit,
+ sysparm_page: page,
+ sysparm_query: encodedquery
}
response = send_request(url, query)
Servicenow.logger.debug response
@@ -78,11 +79,11 @@
#
# @return [Servicenow::Change]
def get_change(number)
url = format('%s/change_request', @snow_table_url)
query = {
- sysparm_limit: 1,
- number: number
+ sysparm_limit: 1,
+ number: number
}
response = send_request(url, query)
obj = JSON.parse response.body