Sha256: 7f5486da5b68dd207fdffb7e5032f3fbde6a1bfa790d73c944cbc9dc0e414c21

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

require 'money_s3/parsers/base_parser'
require 'money_s3/parsers/reference_type'
require 'money_s3/parsers/error_info_type'

module MoneyS3
  module Parsers
    class MessageType
      include BaseParser

      def status
        at 'Status'
      end

      def reference
        submodel_at(ReferenceType, 'Reference')
      end

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

      def to_h
        hash = WithAttributes.new({})
        hash.attributes = attributes

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

        hash
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
money_s3-0.6.0 lib/money_s3/parsers/message_type.rb