Class: Breathe::Resource
- Inherits:
-
Object
- Object
- Breathe::Resource
- Defined in:
- lib/breathe/resource.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #get(id) ⇒ Object
-
#initialize(client) ⇒ Resource
constructor
A new instance of Resource.
- #list(args = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ Resource
Returns a new instance of Resource.
5 6 7 |
# File 'lib/breathe/resource.rb', line 5 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
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 |