class MercadoBitcoin::Trade

Attributes

from[RW]
tid[RW]
to[RW]

Public Class Methods

new(coin, opts = {}) click to toggle source
Calls superclass method MercadoBitcoin::BaseApiCall::new
# File lib/mercado_bitcoin/trade.rb, line 4
def initialize(coin, opts = {})
  @tid  = opts[:tid] || opts[:since]
  @from = opts[:from].to_i.to_s if opts[:from].is_a?(Time)
  @to   = opts[:to].to_i.to_s   if opts[:to].is_a?(Time)
  super(coin, opts)
end

Public Instance Methods

action() click to toggle source
# File lib/mercado_bitcoin/trade.rb, line 20
def action
  return @action if @action
  @action = bitcoin? ? 'trades' : 'trades_litecoin'
  if(from_to)
    @action = File.join(@action, from_to).freeze
  end
  @action
end
from_to() click to toggle source
# File lib/mercado_bitcoin/trade.rb, line 11
def from_to
  return @from_to if @from_to
  if @from && @to
    @from_to = "#{from}/#{to}"
  else
    @from_to = @from || @to
  end
end
model() click to toggle source
# File lib/mercado_bitcoin/trade.rb, line 34
def model
  Array
end
params() click to toggle source
# File lib/mercado_bitcoin/trade.rb, line 29
def params
  return {} unless tid 
  { tid: tid }
end