module Signaling::Base::Finders::ClassMethods

Public Instance Methods

all(params = {}) click to toggle source
# File lib/signaling/base/finders.rb, line 9
def all(params = {})
  from_response(request(:index, params))
end
find(id) click to toggle source
# File lib/signaling/base/finders.rb, line 5
def find(id)
  from_response(request(:show, id: id))
end
from_response(response) click to toggle source
# File lib/signaling/base/finders.rb, line 13
def from_response(response)
  case response
  when Hash, Hashie::Mash
    self.new(response)
  when Array
    response.map {|i| from_response(i) }
  else
    response
  end
end