BtcPendingDeposit.from_auth_key()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
from .model import *
2
from . import account
3
from . import item
4
5
class BtcPendingDeposit(Base):
6
    __tablename__ = 'btcpending'
7
8
    id        = Column(Integer, primary_key=True, nullable=False)
9
    user_id   = Column(Integer, ForeignKey("users.id"), nullable=False) # user the address "belongs" to
10
    auth_key  = Column(String(64), nullable=False)  # authentication string needed in the callback, otherwise it probably didn't come from coinbase
11
    address   = Column(String(64), nullable=False)  # bitcoin address
12
13
    def __init__(self, user, auth_key, address):
14
        self.user_id = user.id
15
        self.auth_key = auth_key
16
        self.address = address
17
18
    @classmethod
19
    def from_id(cls, id):
20
        e = DBSession.query(cls).filter(cls.id == id).one()
21
        return e
22
23
    @classmethod
24
    def from_auth_key(cls, auth_key):
25
        e = DBSession.query(cls).filter(cls.auth_key == auth_key).one()
26
        return e
27