Sha256: 5c19d00266cc6e98075b093c6d0f36531030567e2d488842255548f80541af96

Contents?: true

Size: 819 Bytes

Versions: 3

Compression:

Stored size: 819 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}/api/v2/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

3 entries across 3 versions & 1 rubygems

Version Path
SimBot-0.1.3 lib/api_controller.rb
SimBot-0.1.2 lib/api_controller.rb
SimBot-0.1.1 lib/api_controller.rb