Class: MarketingCloudSDK::ET_Constructor

Inherits:
Object
  • Object
show all
Defined in:
lib/new.rb

Overview

parse response

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#codeObject

Returns the value of attribute code.



90
91
92
# File 'lib/new.rb', line 90

def code
  @code
end

#messageObject

Returns the value of attribute message.



90
91
92
# File 'lib/new.rb', line 90

def message
  @message
end

#moreResultsObject

Returns the value of attribute moreResults.



90
91
92
# File 'lib/new.rb', line 90

def moreResults
  @moreResults
end

#request_idObject

Returns the value of attribute request_id.



90
91
92
# File 'lib/new.rb', line 90

def request_id
  @request_id
end

#resultsObject

Returns the value of attribute results.



90
91
92
# File 'lib/new.rb', line 90

def results
  @results
end

#statusObject

Returns the value of attribute status.



90
91
92
# File 'lib/new.rb', line 90

def status
  @status
end