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 0e9c3da commit 6ff70ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/bitstamp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
require 'bitstamp/model'

require 'bitstamp/orders'
require 'bitstamp/transactions'
require 'bitstamp/ticker'

String.send(:include, ActiveSupport::Inflector)
Expand All @@ -30,6 +31,12 @@ def self.orders
@@orders ||= Bitstamp::Orders.new
end

def self.user_transactions
self.sanity_check!

@@transactions ||= Bitstamp::UserTransactions.new
end

def self.balance
self.sanity_check!

Expand Down
3 changes: 3 additions & 0 deletions lib/bitstamp/helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module Bitstamp
module Helper
def self.parse_objects!(string, klass)
# If Bitstamp returned nothing (which it does if the results yield empty) 'cast' it to an array
string = "[]" if string == ""

objects = JSON.parse(string)
objects.collect do |t_json|
parse_object!(t_json, klass)
Expand Down
2 changes: 2 additions & 0 deletions lib/bitstamp/model.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Bitstamp
class Model
attr_accessor :error, :message

if ActiveModel::VERSION::MAJOR <= 3
include ActiveModel::Validations
include ActiveModel::Conversion
Expand Down

0 comments on commit 6ff70ac

Please sign in to comment.