Skip to content

Commit

Permalink
Implemented user transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
stygeo committed Jun 25, 2013
1 parent 6ff70ac commit 50993bd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/bitstamp/transactions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module Bitstamp
class UserTransactions < Bitstamp::Collection
def all(options = {})
# Default time delta to an hour
options[:timedelta] = "3600" unless options[:timedelta]

Bitstamp::Helper.parse_objects! Bitstamp::Net::post("/user_transactions", options).body_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 < Bitstamp::Model
attr_accessor :datetime, :id, :type, :usd, :btc, :fee, :order_id
end
end
11 changes: 11 additions & 0 deletions spec/transactions_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe Bitstamp::UserTransactions do
before :each do
read_bitstamp_yaml
end

it "should return an array when querying for all user transactions" do
Bitstamp.user_transactions.all.should be_kind_of Array
end
end

0 comments on commit 50993bd

Please sign in to comment.