Class: CorePro::Models::Envelope

Inherits:
ModelBase show all
Defined in:
lib/corepro/models/envelope.rb

Instance Attribute Summary collapse

Attributes inherited from ModelBase

#requestId

Instance Method Summary collapse

Methods inherited from ModelBase

escape, #to_s

Methods inherited from JsonBase

#is_hash?, #to_hash, #to_json

Instance Attribute Details

#dataObject

Returns the value of attribute data.



7
8
9
# File 'lib/corepro/models/envelope.rb', line 7

def data
  @data
end

#errorsObject

Returns the value of attribute errors.



8
9
10
# File 'lib/corepro/models/envelope.rb', line 8

def errors
  @errors
end

#rawRequestBodyObject

Returns the value of attribute rawRequestBody.



10
11
12
# File 'lib/corepro/models/envelope.rb', line 10

def rawRequestBody
  @rawRequestBody
end

#rawResponseBodyObject

Returns the value of attribute rawResponseBody.



11
12
13
# File 'lib/corepro/models/envelope.rb', line 11

def rawResponseBody
  @rawResponseBody
end

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/corepro/models/envelope.rb', line 9

def status
  @status
end

Instance Method Details

#from_json!(json, classDefs = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/corepro/models/envelope.rb', line 13

def from_json! json, classDefs = {}
  classDefs = classDefs || {}
  classDefs['errors'] = ApiError
  super json, classDefs

  if classDefs.has_key?('data')
    if @data.kind_of?(Array)
      @data.each {|item|
        if item.instance_variable_defined?('@requestId')
          item.requestId = @requestId
        end
      }
    else
      if @data.instance_variable_defined?('@requestId')
        @data.requestId = @requestId
      end
    end
  end

  self

end