Class: FuelSDK::ET_Constructor
- Inherits:
-
Object
- Object
- FuelSDK::ET_Constructor
- Defined in:
- lib/new.rb
Overview
parse response
Direct Known Subclasses
ET_Continue, ET_ContinueRest, ET_Delete, ET_DeleteRest, ET_Describe, ET_Get, ET_GetRest, ET_Patch, ET_PatchRest, ET_Post, ET_PostRest
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#message ⇒ Object
Returns the value of attribute message.
-
#moreResults ⇒ Object
Returns the value of attribute moreResults.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#results ⇒ Object
Returns the value of attribute results.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(response = nil, rest = false) ⇒ ET_Constructor
constructor
A new instance of ET_Constructor.
Constructor Details
#initialize(response = nil, rest = false) ⇒ ET_Constructor
Returns a new instance of ET_Constructor.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/new.rb', line 92 def initialize(response = nil, rest = false) @results = [] if !response.nil? && !rest then envelope = response.hash[:envelope] @@body = envelope[:body] if ((!response.soap_fault?) or (!response.http_error?)) then @code = response.http.code @status = true elsif (response.soap_fault?) then @code = response.http.code @message = @@body[:fault][:faultstring] @status = false elsif (response.http_error?) then @code = response.http.code @status = false end elsif @code = response.code @status = true if @code != "200" then @status = false end begin @results = JSON.parse(response.body) rescue @message = response.body end end end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
90 91 92 |
# File 'lib/new.rb', line 90 def code @code end |
#message ⇒ Object
Returns the value of attribute message.
90 91 92 |
# File 'lib/new.rb', line 90 def @message end |
#moreResults ⇒ Object
Returns the value of attribute moreResults.
90 91 92 |
# File 'lib/new.rb', line 90 def moreResults @moreResults end |
#request_id ⇒ Object
Returns the value of attribute request_id.
90 91 92 |
# File 'lib/new.rb', line 90 def request_id @request_id end |
#results ⇒ Object
Returns the value of attribute results.
90 91 92 |
# File 'lib/new.rb', line 90 def results @results end |
#status ⇒ Object
Returns the value of attribute status.
90 91 92 |
# File 'lib/new.rb', line 90 def status @status end |