module ActiveShotgun::Model::Read::ClassMethods

Public Instance Methods

all() click to toggle source
# File lib/active_shotgun/model/read.rb, line 36
def all
  prepare_new_query.all
end
count() click to toggle source
# File lib/active_shotgun/model/read.rb, line 73
def count
  prepare_new_query.count
end
find(id) click to toggle source
# File lib/active_shotgun/model/read.rb, line 68
def find(id)
  sg_result = shotgun_client.find(id)
  parse_shotgun_results(sg_result)
end
find_by(conditions) click to toggle source
# File lib/active_shotgun/model/read.rb, line 56
def find_by(conditions)
  prepare_new_query.find_by(conditions)
end
first(number = 1) click to toggle source
# File lib/active_shotgun/model/read.rb, line 48
def first(number = 1)
  prepare_new_query.first(number)
end
limit(number) click to toggle source
# File lib/active_shotgun/model/read.rb, line 40
def limit(number)
  prepare_new_query.limit(number)
end
offset(number) click to toggle source
# File lib/active_shotgun/model/read.rb, line 44
def offset(number)
  prepare_new_query.limit(number)
end
orders(new_orders) click to toggle source
# File lib/active_shotgun/model/read.rb, line 60
def orders(new_orders)
  prepare_new_query.orders(new_orders)
end
parse_shotgun_results(sg_result) click to toggle source
# File lib/active_shotgun/model/read.rb, line 81
def parse_shotgun_results(sg_result)
  new(
    sg_result.attributes.to_h.merge(id: sg_result.id),
    sg_result.relationships.transform_values{ |v| v["data"] }.with_indifferent_access
  )
end
prepare_new_query() click to toggle source
# File lib/active_shotgun/model/read.rb, line 64
def prepare_new_query
  Query.new(type: shotgun_type, klass: self)
end
size() click to toggle source
# File lib/active_shotgun/model/read.rb, line 77
def size
  prepare_new_query.size
end
where(conditions) click to toggle source
# File lib/active_shotgun/model/read.rb, line 52
def where(conditions)
  prepare_new_query.where(conditions)
end