class WinewooCore::Repositories::Mongo::Queries::WinewooUserQuery

Public Class Methods

new() click to toggle source
# File lib/winewoo_core/repositories/mongo/queries/winewoo_user_query.rb, line 5
def initialize
  super User.where(user_roles: :winewoo_user)
end

Public Instance Methods

for_interpro(interpro_id) { |winewoo_user| ... } click to toggle source
# File lib/winewoo_core/repositories/mongo/queries/winewoo_user_query.rb, line 20
def for_interpro(interpro_id)
  @relation = @relation
    .in(interpro_ids: BSON::ObjectId.from_string(interpro_id))

  block_given? ?
    @relation.each { |winewoo_user| yield winewoo_user } :
    self
end
for_os(os) { |winewoo_user| ... } click to toggle source
# File lib/winewoo_core/repositories/mongo/queries/winewoo_user_query.rb, line 40
def for_os(os)
  @relation = @relation
    .where(device_os: os)

  block_given? ?
    @relation.each { |winewoo_user| yield winewoo_user } :
    self
end
for_producer(producer_id) { |winewoo_user| ... } click to toggle source
# File lib/winewoo_core/repositories/mongo/queries/winewoo_user_query.rb, line 30
def for_producer(producer_id)
  @relation = @relation
    .in(producer_ids: BSON::ObjectId.from_string(producer_id))

  block_given? ?
    @relation.each { |winewoo_user| yield winewoo_user } :
    self
end
for_winewoo() { |winewoo_user| ... } click to toggle source
# File lib/winewoo_core/repositories/mongo/queries/winewoo_user_query.rb, line 10
def for_winewoo
  @relation = @relation
    .where(:interpro_ids.with_size => 0)

  block_given? ?
    @relation.each { |winewoo_user| yield winewoo_user } :
    self
end
with_email(email) click to toggle source
# File lib/winewoo_core/repositories/mongo/queries/winewoo_user_query.rb, line 61
def with_email(email)
  @relation.where(email: email).first
end
with_push_token(token = nil) { |winewoo_user| ... } click to toggle source
# File lib/winewoo_core/repositories/mongo/queries/winewoo_user_query.rb, line 50
def with_push_token(token = nil)
  @relation = token ?
    @relation.where(device_push_token: token) :
    @relation.where(:device_push_token.exists => true)

  block_given? ?
    @relation.each { |winewoo_user| yield winewoo_user } :
    self
end