Class: ServiceNow::Configuration
- Inherits:
-
Object
- Object
- ServiceNow::Configuration
- Defined in:
- lib/classes/configuration.rb
Class Method Summary collapse
- .configure(auth_hash = {}) ⇒ Object
- .get_resource(query_hash = {}, displayvalue = false, table) ⇒ Object
- .post_resource(table) ⇒ Object
- .update_resource(incident_number, table) ⇒ Object
Class Method Details
.configure(auth_hash = {}) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/classes/configuration.rb', line 4 def self.configure(auth_hash = {}) $root_url = auth_hash[:sn_url].sub(/(\/)+$/, '') #remove trailing slash if there are any $username = auth_hash[:sn_username] $password = auth_hash[:sn_password] "SN::Success: Configuration successful" end |
.get_resource(query_hash = {}, displayvalue = false, table) ⇒ Object
11 12 13 14 |
# File 'lib/classes/configuration.rb', line 11 def self.get_resource(query_hash = {}, displayvalue = false, table) # to be filled in RestClient::Resource.new(URI.escape($root_url + "/#{table}.do?JSON&sysparm_action=getRecords&sysparm_query=#{hash_to_query(query_hash)}&displayvalue=#{displayvalue}"), $username, $password) end |
.post_resource(table) ⇒ Object
16 17 18 |
# File 'lib/classes/configuration.rb', line 16 def self.post_resource(table) RestClient::Resource.new(URI.escape($root_url + "/#{table}.do?JSON&sysparm_action=insert"), $username, $password) end |
.update_resource(incident_number, table) ⇒ Object
20 21 22 |
# File 'lib/classes/configuration.rb', line 20 def self.update_resource(incident_number, table) RestClient::Resource.new(URI.escape($root_url + "/#{table}.do?JSON&sysparm_query=number=#{incident_number}&sysparm_action=update"), $username, $password) end |