class Morpheus::ReadInterface

Interface class to be subclassed by interfaces that are read-only and only provide list() and get() methods, not full CRUD Subclasses must override the base_path method

Public Instance Methods

base_path() click to toggle source

subclasses should override in your interface Example: “/api/things”

# File lib/morpheus/api/read_interface.rb, line 10
def base_path
  raise "#{self.class} has not defined base_path!" if @options[:base_path].nil?
  @options[:base_path]
end
get(id, params={}, headers={}) click to toggle source
# File lib/morpheus/api/read_interface.rb, line 19
def get(id, params={}, headers={})
  validate_id!(id)
  execute(method: :get, url: "#{base_path}/#{CGI::escape(id.to_s)}", params: params, headers: headers)
end
list(params={}, headers={}) click to toggle source
# File lib/morpheus/api/read_interface.rb, line 15
def list(params={}, headers={})
  execute(method: :get, url: "#{base_path}", params: params, headers: headers)
end