Class: Babl::ModuleResponse
- Inherits:
-
Object
- Object
- Babl::ModuleResponse
- Defined in:
- lib/babl/module_response.rb
Instance Attribute Summary collapse
-
#exitcode ⇒ Object
readonly
Returns the value of attribute exitcode.
-
#payload_url ⇒ Object
readonly
Returns the value of attribute payload_url.
Instance Method Summary collapse
- #fetch_payload ⇒ Object
-
#initialize(response) ⇒ ModuleResponse
constructor
A new instance of ModuleResponse.
- #stderr ⇒ Object
- #stdout(allow_fetch = true) ⇒ Object
Constructor Details
#initialize(response) ⇒ ModuleResponse
5 6 7 8 9 10 11 |
# File 'lib/babl/module_response.rb', line 5 def initialize response @stdout_raw = response["Stdout"] @stderr_raw = response["Stderr"] @exitcode = response["Exitcode"] @payload_url = response["PayloadUrl"] end |
Instance Attribute Details
#exitcode ⇒ Object (readonly)
Returns the value of attribute exitcode.
3 4 5 |
# File 'lib/babl/module_response.rb', line 3 def exitcode @exitcode end |
#payload_url ⇒ Object (readonly)
Returns the value of attribute payload_url.
3 4 5 |
# File 'lib/babl/module_response.rb', line 3 def payload_url @payload_url end |
Instance Method Details
#fetch_payload ⇒ Object
33 34 35 36 37 |
# File 'lib/babl/module_response.rb', line 33 def fetch_payload if payload_url.to_s != "" Net::HTTP.get URI(payload_url) end end |
#stderr ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/babl/module_response.rb', line 25 def stderr @stderr ||= begin o = Base64.decode64(@stderr_raw) @stderr_raw = nil o end end |
#stdout(allow_fetch = true) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/babl/module_response.rb', line 13 def stdout allow_fetch = true @stdout ||= begin if payload_url.to_s != "" fetch_payload if allow_fetch else o = Base64.decode64(@stdout_raw) @stdout_raw = nil o end end end |