Class: Rod::Rest::ProxyFactory
- Inherits:
-
Object
- Object
- Rod::Rest::ProxyFactory
- Defined in:
- lib/rod/rest/proxy_factory.rb
Instance Method Summary collapse
-
#build(object_description) ⇒ Object
Build new object-proxy from the hash-like
object_description
. -
#initialize(metadata, client, options = {}) ⇒ ProxyFactory
constructor
Creates new proxy factory based on the
metadata
and using given webclient
.
Constructor Details
#initialize(metadata, client, options = {}) ⇒ ProxyFactory
Creates new proxy factory based on the metadata
and using given web client
. Options:
-
proxy_class - the class used to create the resource proxy factories.
10 11 12 13 14 15 16 |
# File 'lib/rod/rest/proxy_factory.rb', line 10 def initialize(,client,={}) proxy_class = [:proxy_class] || Proxy @proxies = {} .each do || @proxies[.name] = proxy_class.new(,client) end end |
Instance Method Details
#build(object_description) ⇒ Object
Build new object-proxy from the hash-like object_description
.
19 20 21 22 |
# File 'lib/rod/rest/proxy_factory.rb', line 19 def build(object_description) check_type(object_description[:type]) @proxies[object_description[:type]].new(object_description) end |