Sha256: 8c937583832d7cbc2be950b9487d5de0c98054e5c178f0b5fee2e67b64839db2

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

# frozen_string_literal: true

module Tikkie
  module Api
    module Responses
      # Response when requesting an user.
      class User < Base
        def user_token
          data[:userToken]
        end

        def name
          data[:name]
        end

        # see UserStatus
        def status
          data[:status]
        end

        def active?
          status == Tikkie::Api::Types::UserStatus::ACTIVE
        end

        def bank_accounts
          @bank_accounts ||= begin
            bank_accounts = []

            if data[:bankAccounts]
              data[:bankAccounts].each do |data|
                bank_accounts << Tikkie::Api::Responses::BankAccount.new(data)
              end
            end

            bank_accounts
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tikkie-api-0.2.2 lib/tikkie/api/responses/user.rb