Sha256: f20287e1811ac811a12437a03ff0418f3acce0ddb81102fbd8dfdbd2f491289d
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
module Mashery class RpcClient class Base def initialize(attributes) attributes.each do |key, value| send("#{key}=", value) end end def self.count default_query.items(1).to_json["result"]["total_items"] end def self.all default_query.all end def self.select(argument) default_query.select(argument) end def self.items(argument) default_query.items(argument) end def self.where(argument) default_query.where(argument) end def self.page(argument) default_query.page(argument) end def self.find_each(&block) default_query.find_each(&block) end def self.first new(standard_query.items(1).all.items[0]) end protected def self.standard_query Mashery.rpc.query_builder(self).from(object_type).items(100) end def self.default_query standard_query end def self.object_type self.name.underscore.split('/').last.pluralize end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mashery_rails-0.6.7 | lib/mashery/rpc_client/base.rb |
mashery_rails-0.6.6 | lib/mashery/rpc_client/base.rb |
mashery_rails-0.6.3 | lib/mashery/rpc_client/base.rb |