Class: ServiceNow::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/servicenow/api.rb

Direct Known Subclasses

Client::CMDB, Client::Tables

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Api

Returns a new instance of Api.



5
6
7
# File 'lib/servicenow/api.rb', line 5

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



3
4
5
# File 'lib/servicenow/api.rb', line 3

def connection
  @connection
end

Instance Method Details

#delete(path) ⇒ Object



29
30
31
# File 'lib/servicenow/api.rb', line 29

def delete(path)
  connection.delete(path)
end

#get_many(path, params = {}) ⇒ Object



9
10
11
# File 'lib/servicenow/api.rb', line 9

def get_many(path, params = {})
  ServiceNow::Collection.new connection.get(path, params)
end

#get_one(path, params = {}) ⇒ Object



13
14
15
# File 'lib/servicenow/api.rb', line 13

def get_one(path, params = {})
  ServiceNow::Response.new connection.get(path, params)
end

#patch(path, params = {}) ⇒ Object



21
22
23
# File 'lib/servicenow/api.rb', line 21

def patch(path, params = {})
  ServiceNow::Response.new connection.patch(path, params)
end

#post(path, params = {}) ⇒ Object



17
18
19
# File 'lib/servicenow/api.rb', line 17

def post(path, params = {})
  ServiceNow::Response.new connection.post(path, params)
end

#put(path, params = {}) ⇒ Object



25
26
27
# File 'lib/servicenow/api.rb', line 25

def put(path, params = {})
  ServiceNow::Response.new connection.put(path, params)
end