Sha256: ebec6a6dc83cf7a5f5822fd87dd484836f100a7c5251bc62d20ca6e3d3be0747

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

module NubankSdk
  class Credit
    #
    # Returns the credit statement
    #
    # @param [NubankSdk::Client::HTTPS] connection
    # @param [NubankSdk::ApiRoutes] api_routes
    def initialize(connection:, api_routes:)
      @connection = connection
      @api_routes = api_routes
    end

    #
    # Returns the credit balances
    #
    # @return [Hash<Symbol, Float>] the credit balances
    def balances
      account_url = @api_routes.entrypoint(path: :ssl, entrypoint: :account)

      response = @connection.get(account_url)
      response_hash = Client.get_body(response)

      response_hash[:account][:balances]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nubank_sdk-0.6.1 lib/nubank_sdk/credit.rb