Class: Buzz::Resource
- Inherits:
-
Object
show all
- Defined in:
- lib/buzz/resource.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(client) ⇒ Resource
Returns a new instance of Resource.
7
8
9
|
# File 'lib/buzz/resource.rb', line 7
def initialize(client)
@client = client
end
|
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5
6
7
|
# File 'lib/buzz/resource.rb', line 5
def client
@client
end
|
Instance Method Details
#create(attributes = {}) ⇒ Object
20
21
22
23
|
# File 'lib/buzz/resource.rb', line 20
def create(attributes = {})
response = client.post(resource_path, attributes)
response.data
end
|
#delete(id) ⇒ Object
30
31
32
33
|
# File 'lib/buzz/resource.rb', line 30
def delete(id)
response = client.delete("#{resource_path}/#{id}")
response.data
end
|
#find(id) ⇒ Object
15
16
17
18
|
# File 'lib/buzz/resource.rb', line 15
def find(id)
response = client.get("#{resource_path}/#{id}")
response.data
end
|
#list(params = {}) ⇒ Object
11
12
13
|
# File 'lib/buzz/resource.rb', line 11
def list(params = {})
Paginator.new(client, resource_path, params)
end
|
#update(id, attributes = {}) ⇒ Object
25
26
27
28
|
# File 'lib/buzz/resource.rb', line 25
def update(id, attributes = {})
response = client.put("#{resource_path}/#{id}", attributes)
response.data
end
|