Class: Leeno::Api::History

Inherits:
Base
  • Object
show all
Defined in:
lib/leeno/api/history.rb

Constant Summary

Constants inherited from Base

Base::DOMAIN

Constants included from Leeno

VERSION

Class Method Summary collapse

Methods inherited from Base

get, model_class, request_index, request_index!, request_show, request_show!, result_set, result_set!, search_index, search_show, set_options!, success?

Class Method Details

.find(c_id, h_id, options = {}) ⇒ Object



3
4
5
6
# File 'lib/leeno/api/history.rb', line 3

def find c_id, h_id, options={}
  return nil if (c_id.nil? || h_id.nil?)
  search_show({canvas_id: c_id.to_s, history_id: h_id.to_s}.merge(options))
end

.find!(c_id, h_id, options = {}) ⇒ Object



8
9
10
11
# File 'lib/leeno/api/history.rb', line 8

def find! c_id, h_id, options={}
  raise(Leeno::DocumentNotFound.new("#{model_class}: canvas_id or history_id NilClass")) if (c_id.nil? || h_id.nil?)
  search_show({canvas_id: c_id.to_s, history_id: h_id.to_s}.merge(options), true)
end

.find_histories(id, options = {}) ⇒ Object



13
14
15
16
# File 'lib/leeno/api/history.rb', line 13

def find_histories id, options={}
  return Leeno::Array.new if id.nil?
  search_index({canvas_id: id.to_s}.merge(options))
end

.find_histories!(id, options = {}) ⇒ Object



18
19
20
21
# File 'lib/leeno/api/history.rb', line 18

def find_histories! id, options={}
  raise(Leeno::DocumentNotFound.new("#{model_class}: id NilClass")) if id.nil?
  search_index({canvas_id: id.to_s}.merge(options), true)
end