Sha256: 3eb924d74c34225198f5db6a3910038b63b5cfdd3a28d56039f75c198af25407

Contents?: true

Size: 927 Bytes

Versions: 5

Compression:

Stored size: 927 Bytes

Contents

module Bitso
  class UserTransactions < Bitso::Collection
    def all(options = {})
      # Default time delta to an hour
      options[:timedelta] = "3600" unless options[:timedelta]

      Bitso::Helper.parse_objects! Bitso::Net::post("/user_transactions", options).to_str, self.model
    end

    def find(order_id)
      all = self.all
      index = all.index {|order| order.id.to_i == order_id}

      return all[index] if index
    end

    def create(options = {})
    end

    def update(options={})
    end
  end

  class UserTransaction < Bitso::Model
    attr_accessor :datetime, :id, :type, :mxn, :btc, :fee, :order_id, :btc_mxn, :nonce, :rate
  end

  # adding in methods to pull the last public trades list
  class Transactions < Bitso::Model
    attr_accessor :date, :price, :tid, :amount

    def self.from_api
      Bitso::Helper.parse_objects! Bitso::Net::get("/transactions").to_str, self
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bitso-0.1.5 lib/bitso/transactions.rb
bitso-0.1.4 lib/bitso/transactions.rb
bitso-0.1.3 lib/bitso/transactions.rb
bitso-0.1.2 lib/bitso/transactions.rb
bitso-0.1.1 lib/bitso/transactions.rb