Module: SObjectModel::QueryMethods::ClassMethods

Defined in:
lib/sobject_model/query_methods.rb

Instance Method Summary collapse

Instance Method Details

#allObject



42
43
44
45
# File 'lib/sobject_model/query_methods.rb', line 42

def all
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.all
end

#countObject



62
63
64
65
# File 'lib/sobject_model/query_methods.rb', line 62

def count
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.count
end

#find(id) ⇒ Object



33
34
35
# File 'lib/sobject_model/query_methods.rb', line 33

def find(id)
  connection.find(name.to_sym, id, Object.const_get(name.to_sym))
end

#find_by(*find_condition) ⇒ Object



37
38
39
40
# File 'lib/sobject_model/query_methods.rb', line 37

def find_by(*find_condition)
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.where(*find_condition).take
end

#limit(num) ⇒ Object



22
23
24
25
26
# File 'lib/sobject_model/query_methods.rb', line 22

def limit(num)
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.limit(num)
  qc
end

#max(field_name) ⇒ Object



67
68
69
70
# File 'lib/sobject_model/query_methods.rb', line 67

def max(field_name)
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.max(field_name)
end

#min(field_name) ⇒ Object



72
73
74
75
# File 'lib/sobject_model/query_methods.rb', line 72

def min(field_name)
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.min(field_name)
end

#order(*field_names) ⇒ Object



28
29
30
31
32
# File 'lib/sobject_model/query_methods.rb', line 28

def order(*field_names)
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.order(*field_names)
  qc
end

#pluck(field_name) ⇒ Object



52
53
54
55
# File 'lib/sobject_model/query_methods.rb', line 52

def pluck(field_name)
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.pluck(field_name)
end

#select(*fields) ⇒ Object



16
17
18
19
20
# File 'lib/sobject_model/query_methods.rb', line 16

def select(*fields)
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.select(*fields)
  return qc
end

#takeObject



57
58
59
60
# File 'lib/sobject_model/query_methods.rb', line 57

def take
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.take
end

#to_csvObject



47
48
49
50
# File 'lib/sobject_model/query_methods.rb', line 47

def to_csv
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.to_csv
end

#where(*expr) ⇒ Object



10
11
12
13
14
# File 'lib/sobject_model/query_methods.rb', line 10

def where(*expr)
  qc = QueryCondition.new(connection, self.name, self.field_names)
  qc.where(*expr)
  return qc
end