Class: Breathe::Resource
- Inherits:
-
Object
show all
- Defined in:
- lib/breathe/resource.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(client) ⇒ Resource
5
6
7
|
# File 'lib/breathe/resource.rb', line 5
def initialize(client)
@client = client
end
|
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
3
4
5
|
# File 'lib/breathe/resource.rb', line 3
def client
@client
end
|
Instance Method Details
#get(id) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/breathe/resource.rb', line 19
def get(id)
raise NotSupportedError unless self.class::SUPPORTED_ENDPOINTS.include?(:get)
client.response(
method: :get,
path: "#{resource_name}/#{id.to_i}"
)
end
|
#list(args = {}) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/breathe/resource.rb', line 9
def list(args = {})
raise NotSupportedError unless self.class::SUPPORTED_ENDPOINTS.include?(:list)
client.response(
method: :get,
path: resource_name,
args: args
)
end
|