Sha256: 9b1db900cf084337f8f0d1e865c54991493cfbacf75fafc6b219728d29d58327
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
module Sifterology class Resource attr_reader :session, :factory attr_accessor :last_request def self.sifter_attrs(*args) args.each do |name| define_method(name) do instance_variable_get("@_sifter_#{name}") end define_method("#{name}=") do |value| instance_variable_set("@_sifter_#{name}", value) end end end def initialize(session, factory=nil) @session = session @factory = factory end def get(*args) request(:get, *args) end def post(*args) request(:post, *args) end def put(*args) request(:put, *args) end def delete(*args) request(:delete, *args) end def attributes=(hash) hash.each_pair do |name, value| instance_variable_set("@_sifter_#{ name }", value) end end def local_attributes=(hash) hash.each_pair do |name, value| instance_variable_set("@#{ name }", value) end end private def request(*args) @last_request = Request.new(self) @last_request.perform(*args) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sifterology-0.1.1 | lib/sifterology/resource.rb |