forked from kojnapp/bitstamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |