Class: Isomorfeus::Puppetmaster::Response
- Inherits:
-
Object
- Object
- Isomorfeus::Puppetmaster::Response
- Defined in:
- lib/isomorfeus/puppetmaster/response.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(response_hash = {}) ⇒ Response
constructor
A new instance of Response.
- #method_missing(name, *args) ⇒ Object
- #ok? ⇒ Boolean
Constructor Details
#initialize(response_hash = {}) ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/isomorfeus/puppetmaster/response.rb', line 6 def initialize(response_hash = {}) @response_hash = response_hash ? response_hash : {} @request = Isomorfeus::Puppetmaster::Request.new(@response_hash['request']) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/isomorfeus/puppetmaster/response.rb', line 11 def method_missing(name, *args) if %i[headers ok remote_address security_details status status_text text url].include?(name) @response_hash[name.to_s] elsif :ok? == name @response_hash['ok'] else super(name, *args) end end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
4 5 6 |
# File 'lib/isomorfeus/puppetmaster/response.rb', line 4 def request @request end |
Instance Method Details
#ok? ⇒ Boolean
21 22 23 |
# File 'lib/isomorfeus/puppetmaster/response.rb', line 21 def ok? @response_hash[:ok] end |