Class: Jenkins2::ResourceProxy
- Inherits:
- BasicObject
- Defined in:
- lib/jenkins2/resource_proxy.rb
Direct Known Subclasses
API::Computer::Proxy, API::Credentials::Proxy, API::Credentials::Store::Domain::Credential::Proxy, API::Credentials::Store::Domain::Proxy, API::Credentials::Store::Proxy, API::Job::Proxy, API::Plugins::Plugin::Proxy, API::Plugins::Proxy, API::RoleStrategy::Proxy, API::Root::Proxy, API::User::Me::Proxy, API::User::People::Proxy, API::User::Proxy, API::View::Proxy
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(connection, path, params = {}, &block) ⇒ ResourceProxy
constructor
A new instance of ResourceProxy.
- #method_missing(message, *args, &block) ⇒ Object
- #raw ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #subject ⇒ Object
Constructor Details
#initialize(connection, path, params = {}, &block) ⇒ ResourceProxy
Returns a new instance of ResourceProxy.
11 12 13 14 15 16 |
# File 'lib/jenkins2/resource_proxy.rb', line 11 def initialize(connection, path, params={}, &block) @path = path @id = nil @connection, @params = connection, params subject if block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
9 10 11 |
# File 'lib/jenkins2/resource_proxy.rb', line 9 def connection @connection end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/jenkins2/resource_proxy.rb', line 9 def path @path end |
Instance Method Details
#raw ⇒ Object
31 32 33 |
# File 'lib/jenkins2/resource_proxy.rb', line 31 def raw @raw ||= connection.get_json(build_path, @params) end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
27 28 29 |
# File 'lib/jenkins2/resource_proxy.rb', line 27 def respond_to_missing?(method_name, include_private=false) subject.respond_to? method_name, include_private end |
#subject ⇒ Object
35 36 37 |
# File 'lib/jenkins2/resource_proxy.rb', line 35 def subject @subject ||= ::JSON.parse(raw.body, object_class: ::OpenStruct) end |