class Kintone::Query
Public Class Methods
new(&block)
click to toggle source
# File lib/kintone/query.rb, line 4 def initialize(&block) @query = [] instance_eval(&block) if block_given? end
Public Instance Methods
and!()
click to toggle source
# File lib/kintone/query.rb, line 15 def and! @query << 'and' end
field(code)
click to toggle source
# File lib/kintone/query.rb, line 9 def field(code) condition = Field.new(code) @query << condition condition end
Also aliased as: f
inspect()
click to toggle source
# File lib/kintone/query.rb, line 67 def inspect to_s end
last_month()
click to toggle source
# File lib/kintone/query.rb, line 43 def last_month function_string('LAST_MONTH()') end
limit(count)
click to toggle source
# File lib/kintone/query.rb, line 55 def limit(count) @query << "limit #{count}" end
login_user()
click to toggle source
# File lib/kintone/query.rb, line 27 def login_user function_string('LOGINUSER()') end
now()
click to toggle source
# File lib/kintone/query.rb, line 31 def now function_string('NOW()') end
offset(index)
click to toggle source
# File lib/kintone/query.rb, line 59 def offset(index) @query << "offset #{index}" end
or!()
click to toggle source
# File lib/kintone/query.rb, line 19 def or! @query << 'or' end
order_by(field, sort = :asc)
click to toggle source
# File lib/kintone/query.rb, line 51 def order_by(field, sort = :asc) @query << "order by #{field} #{sort}" end
precede(&block)
click to toggle source
# File lib/kintone/query.rb, line 23 def precede(&block) @query << "(#{Kintone::Query.new(&block)})" if block_given? end
this_month()
click to toggle source
# File lib/kintone/query.rb, line 39 def this_month function_string('THIS_MONTH()') end
this_year()
click to toggle source
# File lib/kintone/query.rb, line 47 def this_year function_string('THIS_YEAR()') end
to_s()
click to toggle source
# File lib/kintone/query.rb, line 63 def to_s @query.map(&:to_s).join(' ') end
today()
click to toggle source
# File lib/kintone/query.rb, line 35 def today function_string('TODAY()') end
Private Instance Methods
function_string(function)
click to toggle source
# File lib/kintone/query.rb, line 75 def function_string(function) function.instance_eval do class << self define_method :query_format, proc { self } end end function end