Module: Signable::Concerns::Query::ClassMethods

Defined in:
lib/signable/concerns/query.rb

Instance Method Summary collapse

Instance Method Details

#all(offset = 0, limit = 10) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/signable/concerns/query.rb', line 37

def all(offset = 0, limit = 10)
  response = client.all(entry_point, offset, limit)

  if response.ok?
    List.new(self, response.object)
  else
    []
  end
end

#clientObject



61
62
63
# File 'lib/signable/concerns/query.rb', line 61

def client
  @client ||= Signable::Query::Client.new
end

#entry_pointObject



57
58
59
# File 'lib/signable/concerns/query.rb', line 57

def entry_point
  prefix.pluralize
end

#find(id) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'lib/signable/concerns/query.rb', line 47

def find(id)
  response = client.find(entry_point, id)

  if response.ok?
    self.new response.object
  else
    nil
  end
end