Class: Holistics::Model::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/holistics/models/resource.rb

Direct Known Subclasses

Job, JobDefinition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, name) ⇒ Resource

Returns a new instance of Resource.


7
8
9
10
# File 'lib/holistics/models/resource.rb', line 7

def initialize(client, name)
  @client = client
  @name = name
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors


5
6
7
# File 'lib/holistics/models/resource.rb', line 5

def errors
  @errors
end

#nameObject

Returns the value of attribute name


4
5
6
# File 'lib/holistics/models/resource.rb', line 4

def name
  @name
end

Instance Method Details

#all(params = {}) ⇒ Object


12
13
14
15
# File 'lib/holistics/models/resource.rb', line 12

def all(params = {})
  status, body = @client.get("/#{@name}.json", { params: params })
  handle_http_result(status, body)
end

#delete(id, params = {}) ⇒ Object


22
23
24
25
# File 'lib/holistics/models/resource.rb', line 22

def delete(id, params = {})
  status, body = @client.delete("/#{@name}/#{id}.json", { params: params })
  handle_http_result(status, body)
end

#find(id, params = {}) ⇒ Object


17
18
19
20
# File 'lib/holistics/models/resource.rb', line 17

def find(id, params = {})
  status, body = @client.get("/#{@name}/#{id}.json", { params: params })
  handle_http_result(status, body)
end