Class: ET::Constructor
- Inherits:
-
Object
- Object
- ET::Constructor
- Defined in:
- lib/exact-target-api/constructor.rb
Direct Known Subclasses
Continue, ContinueRest, Delete, DeleteRest, Describe, Get, GetRest, Patch, PatchRest, Post, 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) ⇒ Constructor
constructor
A new instance of Constructor.
Constructor Details
#initialize(response = nil, rest = false) ⇒ Constructor
Returns a new instance of Constructor.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/exact-target-api/constructor.rb', line 5 def initialize(response = nil, rest = false) @results = [] if !response.nil? && !rest envelope = response.hash[:envelope] @body = envelope[:body] if !response.soap_fault? || !response.http_error? @code = response.http.code @status = true elsif response.soap_fault? @code = response.http.code @message = @body[:fault][:faultstring] @status = false elsif response.http_error? @code = response.http.code @status = false end elsif (@code = response.code) @status = @code == "200" begin @results = JSON.parse(response.body) rescue @message = response.body end end end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/exact-target-api/constructor.rb', line 3 def code @code end |
#message ⇒ Object
Returns the value of attribute message.
3 4 5 |
# File 'lib/exact-target-api/constructor.rb', line 3 def @message end |
#moreResults ⇒ Object
Returns the value of attribute moreResults.
3 4 5 |
# File 'lib/exact-target-api/constructor.rb', line 3 def moreResults @moreResults end |
#request_id ⇒ Object
Returns the value of attribute request_id.
3 4 5 |
# File 'lib/exact-target-api/constructor.rb', line 3 def request_id @request_id end |
#results ⇒ Object
Returns the value of attribute results.
3 4 5 |
# File 'lib/exact-target-api/constructor.rb', line 3 def results @results end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/exact-target-api/constructor.rb', line 3 def status @status end |