Sha256: 51f45c370d072ae5ffbcf43b45fbec78fad28cdd838c80215a6fe0eb2b4e2142

Contents?: true

Size: 739 Bytes

Versions: 4

Compression:

Stored size: 739 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_with_attrs
        hash = HashWithAttributes.new({}, attributes)

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

        hash
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
money_s3-0.10.0 lib/money_s3/parsers/message_type.rb
money_s3-0.9.0 lib/money_s3/parsers/message_type.rb
money_s3-0.8.0 lib/money_s3/parsers/message_type.rb
money_s3-0.7.0 lib/money_s3/parsers/message_type.rb