Sha256: fb193ac7a36765629c7250903b98d2218a3c09565973a44f47a9d87332e8f62a
Contents?: true
Size: 659 Bytes
Versions: 2
Compression:
Stored size: 659 Bytes
Contents
module Loquor module Representation module ClassMethods [:find, :find_each, :where, :create].each do |proxy| define_method proxy do |*args, &block| new.send proxy, *args, &block end end end module InstanceMethods def find(id) ApiCall::Show.new(self.class.path, id).execute end def find_each(&block) ApiCall::Index.new(self.class.path).find_each(&block) end def where(*args) ApiCall::Index.new(self.class.path).where(*args) end def create(payload) ApiCall::Create.new(self.class.path, payload).execute end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
loquor-0.1.1 | lib/loquor/representation.rb |
loquor-0.1.0 | lib/loquor/representation.rb |