Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Made order_id more consistant and made models store their original data
  • Loading branch information
sdobz committed Jan 6, 2014
commit c847601b59a63d318377113838fd8f4900d0ae2a
1 change: 1 addition & 0 deletions 1 coinbase/models/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class CoinbaseButton(object):

def __init__(self, button):
self.data = button
# Sometimes it's called code (create button) and sometimes id (sub item of create button)
# so we map them together
if 'id' in button:
Expand Down
4 changes: 3 additions & 1 deletion 4 coinbase/models/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

class CoinbaseOrder(object):
def __init__(self, order):
self.id = order['id']
self.data = order

self.order_id = order['id']
# TODO: Account for timezone properly
#self.created_at = datetime.strptime(order['created_at'], '%Y-%m-%dT%H:%M:%S-08:00')
self.created_at = order['created_at']
Expand Down
1 change: 1 addition & 0 deletions 1 coinbase/models/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class CoinbaseTransaction(object):

def __init__(self, transaction):
self.data = transaction

self.transaction_id = transaction['id']
self.created_at = transaction.get('created_at', None)
Expand Down
2 changes: 2 additions & 0 deletions 2 coinbase/models/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
class CoinbaseTransfer(object):

def __init__(self, transfer):
self.data = transfer

self.type = transfer['type']
self.code = transfer['code']
self.created_at = transfer['created_at']
Expand Down
6 changes: 3 additions & 3 deletions 6 coinbase/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def test_creating_order(self):

order = self.account.create_order("93865b9cae83706ae59220c013bc0afd")

this(order.id).should.equal("7RTTRDVP")
this(order.order_id).should.equal("7RTTRDVP")
this(order.total_btc).should.equal(CoinbaseAmount(1, 'BTC'))

this(order.button.button_id).should.equal("93865b9cae83706ae59220c013bc0afd")
Expand All @@ -239,7 +239,7 @@ def test_order_list(self):

orders = self.account.orders()
this(orders).should.be.an(list)
this(orders[0].id).should.equal("A7C52JQT")
this(orders[0].order_id).should.equal("A7C52JQT")

@httprettified
def test_getting_order(self):
Expand All @@ -250,7 +250,7 @@ def test_getting_order(self):

order = self.account.get_order("A7C52JQT")

this(order.id).should.equal("A7C52JQT")
this(order.order_id).should.equal("A7C52JQT")
this(order.status).should.equal("completed")
this(order.total_btc).should.equal(CoinbaseAmount(Decimal(".1"), "BTC"))
this(order.button.name).should.equal("test")
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.