Sha256: 1793e5c0b9cf8f057becc94f919d2c0a048d073cd7d44310e9e18fdb408e15f0

Contents?: true

Size: 955 Bytes

Versions: 11

Compression:

Stored size: 955 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module EML
  module UK
    module TNS
      class Response
        extend T::Sig

        sig { returns(T::Array[EML::UK::Models::TNS::Transaction]) }
        attr_reader :transactions

        sig { params(response: T::Hash[Symbol, T.untyped]).void }
        def initialize(response)
          @transactions = T.let(
            model_transactions(response),
            T::Array[EML::UK::Models::TNS::Transaction]
          )
        end

        private

        sig do
          params(response: T::Hash[Symbol, T.untyped]).
            returns(T::Array[EML::UK::Models::TNS::Transaction])
        end
        def model_transactions(response)
          response[:Transactions].
            each_with_object([]) do |raw_transaction, transactions|
              transactions << EML::UK::Models::TNS::Transaction.
                new(raw_transaction)
            end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eml-3.0.0 lib/eml/uk/tns/response.rb
eml-2.2.0 lib/eml/uk/tns/response.rb
eml-2.1.8 lib/eml/uk/tns/response.rb
eml-2.1.7 lib/eml/uk/tns/response.rb
eml-2.1.6 lib/eml/uk/tns/response.rb
eml-2.1.5 lib/eml/uk/tns/response.rb
eml-2.1.4 lib/eml/uk/tns/response.rb
eml-2.1.3 lib/eml/uk/tns/response.rb
eml-2.1.2 lib/eml/uk/tns/response.rb
eml-2.1.1 lib/eml/uk/tns/response.rb
eml-2.1.0 lib/eml/uk/tns/response.rb