Class: InsalesApi::ActiveResourceProxy
- Inherits:
-
Object
- Object
- InsalesApi::ActiveResourceProxy
show all
- Defined in:
- lib/insales_api/active_resource_proxy.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ActiveResourceProxy.
12
13
14
15
|
# File 'lib/insales_api/active_resource_proxy.rb', line 12
def initialize(configurer, subject)
@configurer = configurer
@subject = subject
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args, &block) ⇒ Object
21
22
23
|
# File 'lib/insales_api/active_resource_proxy.rb', line 21
def method_missing(method_id, *args, &block)
@configurer.init_api { proxy_for @subject.send(method_id, *args, &block) }
end
|
Class Method Details
.need_proxy?(value) ⇒ Boolean
4
5
6
7
8
9
|
# File 'lib/insales_api/active_resource_proxy.rb', line 4
def need_proxy?(value)
klass = value.is_a?(Class) ? value : value.class
return true if klass < Base || klass <= ActiveResource::Collection
false
end
|
Instance Method Details
#respond_to_missing?(method_name, include_private) ⇒ Boolean
17
18
19
|
# File 'lib/insales_api/active_resource_proxy.rb', line 17
def respond_to_missing?(method_name, include_private)
@subject.respond_to?(method_name, include_private) || super
end
|