Sha256: ab0300e837600055194e281918b35e001f708c848743055384a5e18264f9d5c5

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

class ApiController
  require 'json'
  require 'rest-client'

  @endpoint = ''
  @auth_token = ''

  def initialize(endpoint, token)
    @endpoint = endpoint
    @auth_token = token
  end

  def post_order(market, price, volume, type)
    response = RestClient.post("#{@endpoint}/orders",
                               {
                                   'market': market,
                                   'side': type.to_s,
                                   'volume': volume.to_s,
                                   'price': price.to_s,
                                   'ord_type': 'limit'
                               },
                               {'Authorization': "Bearer #{@auth_token}",
                                'content_type': 'application/x-www-form-urlencoded'})
    #puts response
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
SimBot-0.1.14 lib/api_controller.rb