lib/yao/resources/restfully_accessible.rb in yao-0.0.2.rc3 vs lib/yao/resources/restfully_accessible.rb in yao-0.0.2
- old
+ new
@@ -3,11 +3,10 @@
module Yao::Resources
module RestfullyAccessible
def self.extended(base)
base.class_eval do
class << self
- attr_reader :client
attr_accessor :resource_name, :resources_name
extend Forwardable
%w(get post put delete).each do |method_name|
def_delegator :client, method_name, method_name.upcase
@@ -16,14 +15,17 @@
end
end
def service=(name)
@service = name
- @client = Yao.default_client.pool[name]
end
def service
@service
+ end
+
+ def client
+ Yao.default_client.pool[service]
end
# restful methods
def list
return_resources(GET(resources_name).body[resources_name_in_json])