class Morpheus::SecondaryReadInterface

Interface class to be subclassed by interfaces that provide CRUD endpoints for objects underneath another resource Subclasses must override the base_path(resource_id) method

Public Instance Methods

base_path(resource_id) click to toggle source

subclasses should override in your interface Example: “/api/things/#{resource_id}/widgets”

# File lib/morpheus/api/secondary_read_interface.rb, line 10
def base_path(resource_id)
  raise "#{self.class} has not defined base_path(resource_id)!"
end
get(resource_id, id, params={}, headers={}) click to toggle source
# File lib/morpheus/api/secondary_read_interface.rb, line 19
def get(resource_id, id, params={}, headers={})
  validate_id!(resource_id)
  validate_id!(id)
  execute(method: :get, url: "#{base_path(resource_id)}/#{CGI::escape(id.to_s)}", params: params, headers: headers)
end
list(resource_id, params={}, headers={}) click to toggle source
# File lib/morpheus/api/secondary_read_interface.rb, line 14
def list(resource_id, params={}, headers={})
  validate_id!(resource_id)
  execute(method: :get, url: "#{base_path(resource_id)}", params: params, headers: headers)
end