module Shapeshift::MarketClient
Network Layer for API Rest client
Public Instance Methods
url: shapeshift.io/getcoins method: GET
# File lib/shapeshift/market.rb, line 54 def get_coins get("/getcoins") end
url: shapeshift.io/limit/ method: GET
- pair
-
is any valid coin pair such as btc_ltc or ltc_btc
# File lib/shapeshift/market.rb, line 14 def limit( pair ) get("/limit/#{pair}") end
url: shapeshift.io/marketinfo/ method: GET
- pair
-
(OPTIONAL) is any valid coin pair such as btc_ltc or ltc_btc.
The pair is not required and if not specified will return an array of all market infos.
# File lib/shapeshift/market.rb, line 22 def market_info( pair = nil ) get("/marketinfo/#{pair}") end
url: shapeshift.io/rate/ method: GET
- pair
-
is any valid coin pair such as btc_ltc or ltc_btc
# File lib/shapeshift/market.rb, line 7 def rate( pair ) get("/rate/#{pair}") end
url: shapeshift.io/recenttx/ method: GET
- max
-
is an optional maximum number of transactions to return.
If [max] is not specified this will return 5 transactions. Also, [max] must be a number between 1 and 50 (inclusive).
# File lib/shapeshift/market.rb, line 31 def recent_tx( max = 5 ) # max = max.clamp( 1, 50 ) # Clamp only available in Ruby 2.4+ max = [ 1, max, 50 ].sort[1] get("/recenttx/#{max}") end
url: shapeshift.io/timeremaining/ method: GET
- address
-
is the deposit address to look up.
# File lib/shapeshift/market.rb, line 47 def time_remaining( address ) address = encode( address ) get("/timeremaining/#{address}") end
url: shapeshift.io/txbyaddress//[apiKey] method: GET
- address
-
the address that output coin was sent to for the shift
- apiKey
-
is the affiliate's PRIVATE api key.
# File lib/shapeshift/market.rb, line 69 def tx_by_address( address, api_key ) address = encode( address ) get("/txbyaddress/#{address}/#{api_key}") end
url: shapeshift.io/txbyapikey/ method: GET
- apiKey
-
is the affiliate's PRIVATE api key.
# File lib/shapeshift/market.rb, line 61 def tx_by_apikey( api_key ) get("/txbyapikey/#{api_key}") end
url: shapeshift.io/txStat/ method: GET
- address
-
is the deposit address to look up.
# File lib/shapeshift/market.rb, line 40 def tx_stat( address ) get("/txStat/#{address}") end
url: shapeshift.io/validateAddress//[coinSymbol] method: GET
- address
-
the address that the user wishes to validate
- coinSymbol
-
the currency symbol of the coin
# File lib/shapeshift/market.rb, line 78 def validate_address( address, symbol ) get("/validateAddress/#{address}/#{symbol}") end
Private Instance Methods
Please note that if the address is a ripple address, it will include the “?dt=destTagNUM” appended on the end, and you will need to use the URIEncodeComponent() function on the address before sending it in as a param, to get a successful response.
# File lib/shapeshift/market.rb, line 89 def encode( address ) address = URI.encode_www_form_component( address ) if address =~ /\?dt\=/i return address end