class Breathe::Resource

Attributes

client[R]

Public Class Methods

new(client) click to toggle source
# File lib/breathe/resource.rb, line 5
def initialize(client)
  @client = client
end

Public Instance Methods

get(id) click to toggle source
# 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 = {}) click to toggle source
# 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

Private Instance Methods

resource_name() click to toggle source
# File lib/breathe/resource.rb, line 30
def resource_name
  @resource_name ||= self.class::RESOURCE_NAME
end