Sha256: b3f59e4cd299f816355951d142d374f137d945fe97c6ea3a912880cd62a44f74

Contents?: true

Size: 892 Bytes

Versions: 1

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

module Tikkie
  module Api
    module V1
      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::V1::Types::UserStatus::ACTIVE
          end

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

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

              bank_accounts
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tikkie-api-2.0.0 lib/tikkie/api/v1/responses/user.rb