Class: MoneyS3::Parsers::MessageType

Inherits:
Object
  • Object
show all
Includes:
ParserCore::BaseParser
Defined in:
lib/money_s3/parsers/message_type.rb

Instance Method Summary collapse

Instance Method Details

#dataObject



22
23
24
# File 'lib/money_s3/parsers/message_type.rb', line 22

def data
  at 'Data'
end

#data_attributesObject



26
27
28
# File 'lib/money_s3/parsers/message_type.rb', line 26

def data_attributes
  attributes_at 'Data'
end

#error_infoObject



18
19
20
# File 'lib/money_s3/parsers/message_type.rb', line 18

def error_info
  array_of_at(ErrorInfoType, ['ErrorInfo'])
end

#referenceObject



14
15
16
# File 'lib/money_s3/parsers/message_type.rb', line 14

def reference
  array_of_at(String, ['Reference', 'ID'])
end

#statusObject



6
7
8
# File 'lib/money_s3/parsers/message_type.rb', line 6

def status
  at 'Status'
end

#status_attributesObject



10
11
12
# File 'lib/money_s3/parsers/message_type.rb', line 10

def status_attributes
  attributes_at 'Status'
end

#to_hObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/money_s3/parsers/message_type.rb', line 30

def to_h
  hash = {}
  hash[:attributes] = attributes

  hash[:status] = status if has? 'Status'
  hash[:status_attributes] = status_attributes if has? 'Status'
  hash[:reference] = reference if has? 'Reference'
  hash[:error_info] = error_info.map(&:to_h) if has? 'ErrorInfo'
  hash[:data] = data if has? 'Data'
  hash[:data_attributes] = data_attributes if has? 'Data'

  hash
end