module Coinswitch::Dynamic

Public Instance Methods

bulk_rate(input) click to toggle source
# File lib/coinswitch.rb, line 74
def bulk_rate(input)
  ##
  # https://developer.coinswitch.co/reference#post-v2bulk-rate
  @@response = self.class.post('/rate',
                               headers:{'x-api-key':@api_key,'x-user-ip':@ip_address},
                               body:JSON.unparse(input)
  )
  return JSON.parse @@response.body
end
coins_list() click to toggle source
# File lib/coinswitch.rb, line 36
def coins_list
  ##
  # Gets ONLY a list of symbols available for trade.
  @@coins_list = []
  @@coins = self.coins
  @@tomap = @@coins['data']
  @@tomap.map{|x| @@coins_list << x["symbol"] }
  return @@coins_list
end
order(depositCoin,destinationCoin,depositCoinAmount,destinationAddress,refundAddress,callbackUrl='') click to toggle source
# File lib/coinswitch.rb, line 63
def order(depositCoin,destinationCoin,depositCoinAmount,destinationAddress,refundAddress,callbackUrl='')
  @@response = self.class.post('/rate',
                               headers:{'x-api-key':@api_key,'x-user-ip':@ip_address},
                               body:JSON.unparse({'depositCoin'=> depositCoin,'destinationCoin' => destinationCoin, 'depositCoinAmount' => depositCoinAmount,'destinationAddress' => destinationAddress,'refundAddress' => refundAddress,'callbackUrl' => callbackUrl})
  )
  return JSON.parse @@response.body
end
orderid(orderid) click to toggle source
# File lib/coinswitch.rb, line 70
def orderid(orderid)
  @@response = self.class.get('/order/'+ orderid.to_s,headers:{'x-api-key':@api_key,'x-user-ip':@ip_address},query:{'orderid'=> orderid})
  return JSON.parse @@response.body
end
orders(start,count) click to toggle source
# File lib/coinswitch.rb, line 83
def orders(start,count)
  @@response = self.class.get('/coins',headers:{'x-api-key':@api_key,'x-user-ip':@ip_address},query:{'start'=> start,'count' => count})
  return JSON.parse @@response.body
end
pairs(depositCoin,destinationCoin) click to toggle source
# File lib/coinswitch.rb, line 46
def pairs(depositCoin,destinationCoin)
  ##
  # determines if pairs are valid if the response is ok
  @@response = self.class.post('/pairs',
                               headers:{'x-api-key':@api_key,'x-user-ip':@ip_address},
                               body:JSON.unparse({'depositCoin'=> depositCoin,
                                                  'destinationCoin' => destinationCoin}))
  return  JSON.parse @@response.body
end
rate(depositCoin,destinationCoin) click to toggle source
# File lib/coinswitch.rb, line 55
def rate(depositCoin,destinationCoin)
  @@response = self.class.post('/rate',
                               headers:{'x-api-key':@api_key,'x-user-ip':@ip_address},
                               body:JSON.unparse({'depositCoin'=> depositCoin,'destinationCoin' => destinationCoin})
                              )
  return JSON.parse @@response.body
end