class Sipwizard::Relation

Attributes

relation[R]

Public Class Methods

new() click to toggle source
# File lib/sipwizard/relation.rb, line 5
def initialize
  @relation = Hashie::Clash.new
end

Public Instance Methods

count(nb) click to toggle source
# File lib/sipwizard/relation.rb, line 14
def count(nb)
  @relation.merge!({count: nb})
  self
end
where(params) click to toggle source
# File lib/sipwizard/relation.rb, line 9
def where(params)
  @relation.where( hash_to_query(params) )
  self
end

Private Instance Methods

hash_to_query(h) click to toggle source

Hack to comply with the api spec … which sucks

# File lib/sipwizard/relation.rb, line 22
def hash_to_query(h)
  h = Hash[h.map{|k,v| [k, "\"#{v}\""]}]
  Rack::Utils.unescape Rack::Utils.build_query(h)
end