class ServiceNow::Client

Public Class Methods

new(config = {}) click to toggle source
# File lib/servicenow/client.rb, line 12
def initialize(config = {})
  @config = config
  @instance = @config['instance']
  @username = @config['username']
  @password = @config['password']

  # Set httparty default_options
  self.class.base_uri "https://#{@instance}.service-now.com/"
  self.class.basic_auth @username, @password
  self.class.headers 'Content-Type' => 'application/json'
end

Public Instance Methods

get(url, params) click to toggle source
# File lib/servicenow/client.rb, line 24
def get(url, params)
  self.class.get(url, query: params)
end
post(url, body) click to toggle source
# File lib/servicenow/client.rb, line 28
def post(url, body)
  self.class.post(url, body: body.to_json)
end