Sha256: 9771a133105ce33ac5089ebc65bffebd3df087e6f2efdd8997eff67414b450bc

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require 'cryptoprocessing/models/tracker'

module Cryptoprocessing
  class Client
    module Trackers
      # Tracking address list
      #
      # @param [String] account_id
      # @see https://api.cryptoprocessing.io/#bb7723d0-761b-46cd-f6ed-9ca2699f47df
      def trackers(account_id, options = {})
        out = nil
        currency = if options[:currency] then options[:currency] else blockchain_type end
        get("/v1/#{currency}/accounts/#{account_id}/tracing/address", options) do |resp|
          out = resp.data['addresses'].map { |item| Cryptoprocessing::Tracker.new(self, item) }
          yield(out, resp) if block_given?
        end
        out
      end

      # Add address for tracking
      #
      # @param [String] account_id
      # @param [String] address
      # @see https://api.cryptoprocessing.io/#bb7723d0-761b-46cd-f6ed-9ca2699f47df
      def create_tracker(account_id, address, options = {})
        out = nil
        currency = if options[:currency] then options[:currency] else blockchain_type end
        options[:address] = address
        post("/v1/#{currency}/accounts/#{account_id}/tracing/address", options) do |resp|
          out = Cryptoprocessing::Tracker.new(self, resp.data.merge(options))
          yield(out, resp) if block_given?
        end
        out
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cryptoprocessing-0.6.1 lib/cryptoprocessing/client/trackers.rb