Sha256: 712e9ee1d1a7584e384592b84a811533bb9b54e173a3b02ffbfb5032437365ec
Contents?: true
Size: 731 Bytes
Versions: 1
Compression:
Stored size: 731 Bytes
Contents
require 'handcash/api/version' require 'net/http' require 'json' module Handcash # API is the main class for all Handcash gem functions. # For now this is limited to `receive`. class API attr_reader :network, :url TESTNET_URL = 'https://test-api.handcash.io/api/'.freeze def initialize(opts = {}) # Default to testnet since mainnet is not available. @network = opts[:network] || :testnet case @network when :testnet @url = TESTNET_URL else raise "Unsupported network - #{@network}" end end def receive(user) uri = URI("#{url}receivingAddress/#{user}") data = Net::HTTP.get(uri) data == '' ? {} : JSON.parse(data) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
handcash-0.1.0 | lib/handcash/api.rb |