diff --git a/lib/bitstamp/transactions.rb b/lib/bitstamp/transactions.rb new file mode 100644 index 0000000..3d07a4b --- /dev/null +++ b/lib/bitstamp/transactions.rb @@ -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 diff --git a/spec/transactions_spec.rb b/spec/transactions_spec.rb new file mode 100644 index 0000000..6d07897 --- /dev/null +++ b/spec/transactions_spec.rb @@ -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