Sha256: d3ff33b96f1da726f0eb22312e113dc0cd5f8239630ef9d6e82bc95ae31f0c83

Contents?: true

Size: 1021 Bytes

Versions: 5

Compression:

Stored size: 1021 Bytes

Contents

require "faraday"

module Tangany
  module Custody
    class Client
      attr_reader :adapter, :client_id, :client_secret, :environment, :subscription, :vault_url

      def initialize(adapter: Faraday.default_adapter, stubs: nil)
        @adapter = adapter
        @client_id = Tangany.client_id
        @client_secret = Tangany.client_secret
        @environment = Tangany.environment
        @subscription = Tangany.subscription
        @vault_url = Tangany.vault_url

        @stubs = stubs
      end

      def connection
        @connection ||= Faraday.new do |faraday|
          faraday.adapter(adapter, @stubs)
          faraday.request(:json)
          faraday.response(:json, content_type: /\bjson$/, parser_options: {symbolize_names: true})
          faraday.url_prefix = Tangany.custody_base_url
        end
      end

      def wallets
        WalletsResource.new(self)
      end

      def wallet_statuses(asset_id:)
        WalletStatusesResource.new(self, asset_id: asset_id)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tangany-0.0.5 lib/tangany/custody/client.rb
tangany-0.0.4 lib/tangany/custody/client.rb
tangany-0.0.3 lib/tangany/custody/client.rb
tangany-0.0.2 lib/tangany/custody/client.rb
tangany-0.0.1 lib/tangany/custody/client.rb