Sha256: bb94a8a5497865a902e3895d9c61b42615c5b349a43af4c6ad1de8d7664c10d5

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

module Masheri
  module QueryInstanceMethods
    def initialize(attributes)
      attributes.each do |key, value|
        send("#{key}=", value)
      end
    end
  end

  module QueryClassMethods
    def items(argument)
      default_query.items(argument)
    end

    def where(argument)
      default_query.where(argument)
    end

    def page(argument)
      default_query.page(argument)
    end

    def find_each(&block)
      default_query.find_each(&block)
    end

    def standard_query
      Masheri.rpc.query_builder(self).from(object_type).items(100)
    end

    def default_query
      standard_query
    end

    def first
      Masheri::Service.new standard_query.items(1).all.items[0]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
masheri-0.3.5 lib/masheri/query_methods.rb
masheri-0.3.4 lib/masheri/query_methods.rb