Module: Shapeshift::MarketClient
- Included in:
- Client
- Defined in:
- lib/shapeshift/market.rb
Overview
Network Layer for API Rest client
Instance Method Summary collapse
-
#get_coins ⇒ Object
url: shapeshift.io/getcoins method: GET.
-
#limit(pair) ⇒ Object
url: shapeshift.io/limit/ method: GET [pair] is any valid coin pair such as btc_ltc or ltc_btc.
-
#market_info(pair = nil) ⇒ Object
url: shapeshift.io/marketinfo/ method: GET [pair] (OPTIONAL) is any valid coin pair such as btc_ltc or ltc_btc.
-
#rate(pair) ⇒ Object
url: shapeshift.io/rate/ method: GET [pair] is any valid coin pair such as btc_ltc or ltc_btc.
-
#recent_tx(max = 5) ⇒ Object
url: shapeshift.io/recenttx/ method: GET [max] is an optional maximum number of transactions to return.
-
#time_remaining(address) ⇒ Object
url: shapeshift.io/timeremaining/ method: GET [address] is the deposit address to look up.
-
#tx_by_address(address, api_key) ⇒ Object
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.
-
#tx_by_apikey(api_key) ⇒ Object
url: shapeshift.io/txbyapikey/ method: GET [apiKey] is the affiliate’s PRIVATE api key.
-
#tx_stat(address) ⇒ Object
url: shapeshift.io/txStat/ method: GET [address] is the deposit address to look up.
-
#validate_address(address, symbol) ⇒ Object
url: shapeshift.io/validateAddress//[coinSymbol] method: GET [address] the address that the user wishes to validate [coinSymbol] the currency symbol of the coin.
Instance Method Details
#get_coins ⇒ Object
url: shapeshift.io/getcoins method: GET
54 55 56 |
# File 'lib/shapeshift/market.rb', line 54 def get_coins get("/getcoins") end |
#limit(pair) ⇒ Object
url: shapeshift.io/limit/ method: GET
- pair
-
is any valid coin pair such as btc_ltc or ltc_btc
14 15 16 |
# File 'lib/shapeshift/market.rb', line 14 def limit( pair ) get("/limit/#{pair}") end |
#market_info(pair = nil) ⇒ Object
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.
22 23 24 |
# File 'lib/shapeshift/market.rb', line 22 def market_info( pair = nil ) get("/marketinfo/#{pair}") end |
#rate(pair) ⇒ Object
url: shapeshift.io/rate/ method: GET
- pair
-
is any valid coin pair such as btc_ltc or ltc_btc
7 8 9 |
# File 'lib/shapeshift/market.rb', line 7 def rate( pair ) get("/rate/#{pair}") end |
#recent_tx(max = 5) ⇒ Object
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).
31 32 33 34 35 |
# 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 |
#time_remaining(address) ⇒ Object
url: shapeshift.io/timeremaining/ method: GET
- address
-
is the deposit address to look up.
47 48 49 50 |
# File 'lib/shapeshift/market.rb', line 47 def time_remaining( address ) address = encode( address ) get("/timeremaining/#{address}") end |
#tx_by_address(address, api_key) ⇒ Object
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.
69 70 71 72 |
# File 'lib/shapeshift/market.rb', line 69 def tx_by_address( address, api_key ) address = encode( address ) get("/txbyaddress/#{address}/#{api_key}") end |
#tx_by_apikey(api_key) ⇒ Object
url: shapeshift.io/txbyapikey/ method: GET
- apiKey
-
is the affiliate’s PRIVATE api key.
61 62 63 |
# File 'lib/shapeshift/market.rb', line 61 def tx_by_apikey( api_key ) get("/txbyapikey/#{api_key}") end |
#tx_stat(address) ⇒ Object
url: shapeshift.io/txStat/ method: GET
- address
-
is the deposit address to look up.
40 41 42 |
# File 'lib/shapeshift/market.rb', line 40 def tx_stat( address ) get("/txStat/#{address}") end |
#validate_address(address, symbol) ⇒ Object
url: shapeshift.io/validateAddress//[coinSymbol] method: GET
- address
-
the address that the user wishes to validate
- coinSymbol
-
the currency symbol of the coin
78 79 80 |
# File 'lib/shapeshift/market.rb', line 78 def validate_address( address, symbol ) get("/validateAddress/#{address}/#{symbol}") end |