Sha256: 895f0493c6c32c27f87aa981192b258c6a2426b0a915c56584b99c1559d05426

Contents?: true

Size: 812 Bytes

Versions: 9

Compression:

Stored size: 812 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

9 entries across 9 versions & 1 rubygems

Version Path
SimBot-0.1.13 lib/api_controller.rb
SimBot-0.1.12 lib/api_controller.rb
SimBot-0.1.11 lib/api_controller.rb
SimBot-0.1.10 lib/api_controller.rb
SimBot-0.1.8 lib/api_controller.rb
SimBot-0.1.7 lib/api_controller.rb
SimBot-0.1.6 lib/api_controller.rb
SimBot-0.1.5 lib/api_controller.rb
SimBot-0.1.4 lib/api_controller.rb