Sha256: ece14e0605665f19eceb915e26182fcbb61f666ecb2a1483bf0ac3c8021d4c80
Contents?: true
Size: 1016 Bytes
Versions: 1
Compression:
Stored size: 1016 Bytes
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.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.standard_query Mashery.rpc.query_builder(self).from(object_type).items(100) end def self.default_query standard_query end def self.first new(standard_query.items(1).all.items[0]) end def self.object_type self.name.underscore.split('/').last.pluralize end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mashery_rails-0.6.2 | lib/mashery/rpc_client/base.rb |