Sha256: 966d161d03e25b9bafd00a6e93db424f14844aaf7a4fa2dafe36cab8046a6a07

Contents?: true

Size: 948 Bytes

Versions: 6

Compression:

Stored size: 948 Bytes

Contents

module MoneyS3
  module Parsers
    class MessageType
      include ParserCore::BaseParser

      def status
        at 'Status'
      end

      def status_attributes
        attributes_at 'Status'
      end

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

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

      def data
        at 'Data'
      end

      def data_attributes
        attributes_at 'Data'
      end

      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
money_s3-2.4.1 lib/money_s3/parsers/message_type.rb
money_s3-2.4.0 lib/money_s3/parsers/message_type.rb
money_s3-2.3.0 lib/money_s3/parsers/message_type.rb
money_s3-2.2.0 lib/money_s3/parsers/message_type.rb
money_s3-2.1.0 lib/money_s3/parsers/message_type.rb
money_s3-2.0.0 lib/money_s3/parsers/message_type.rb