Class: Sdp::Wallet

Inherits:
Struct
  • Object
show all
Defined in:
lib/sdp/resources/wallets.rb

Overview

Custody wallet. #id is SDP’s walletId — the identifier the payments API expects — not the database row id. balances is only populated when the list was fetched with include_balances: true.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#balancesObject

Returns the value of attribute balances

Returns:

  • (Object)

    the current value of balances



27
28
29
# File 'lib/sdp/resources/wallets.rb', line 27

def balances
  @balances
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



27
28
29
# File 'lib/sdp/resources/wallets.rb', line 27

def created_at
  @created_at
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



27
28
29
# File 'lib/sdp/resources/wallets.rb', line 27

def id
  @id
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



27
28
29
# File 'lib/sdp/resources/wallets.rb', line 27

def label
  @label
end

#providerObject

Returns the value of attribute provider

Returns:

  • (Object)

    the current value of provider



27
28
29
# File 'lib/sdp/resources/wallets.rb', line 27

def provider
  @provider
end

#public_keyObject

Returns the value of attribute public_key

Returns:

  • (Object)

    the current value of public_key



27
28
29
# File 'lib/sdp/resources/wallets.rb', line 27

def public_key
  @public_key
end

#purposeObject

Returns the value of attribute purpose

Returns:

  • (Object)

    the current value of purpose



27
28
29
# File 'lib/sdp/resources/wallets.rb', line 27

def purpose
  @purpose
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



27
28
29
# File 'lib/sdp/resources/wallets.rb', line 27

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/sdp/resources/wallets.rb', line 29

def self.from_hash(hash)
  hash ||= {}
  new(
    id: hash[:wallet_id] || hash[:id],
    public_key: hash[:public_key],
    label: hash[:label],
    status: hash[:status],
    provider: hash[:provider],
    purpose: hash[:purpose],
    created_at: hash[:created_at],
    balances: hash[:balances]&.map { |balance| Balance.from_hash(balance) }
  )
end