Class: Coinbase::Wallet::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/coinbase/wallet/data.rb

Overview

The data required to recreate a Wallet.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wallet_id:, seed:) ⇒ Data

Returns a new Data object.

Parameters:

  • wallet_id (String)

    The ID of the Wallet

  • seed (String)

    The seed of the Wallet



12
13
14
15
# File 'lib/coinbase/wallet/data.rb', line 12

def initialize(wallet_id:, seed:)
  @wallet_id = wallet_id
  @seed = seed
end

Instance Attribute Details

#seedObject (readonly)

Returns the value of attribute seed.



7
8
9
# File 'lib/coinbase/wallet/data.rb', line 7

def seed
  @seed
end

#wallet_idObject (readonly)

Returns the value of attribute wallet_id.



7
8
9
# File 'lib/coinbase/wallet/data.rb', line 7

def wallet_id
  @wallet_id
end

Class Method Details

.from_hash(data) ⇒ Data

Creates a Data object from the given Hash.

Parameters:

  • data (Hash)

    The Hash to create the Data object from

Returns:

  • (Data)

    The new Data object



26
27
28
# File 'lib/coinbase/wallet/data.rb', line 26

def self.from_hash(data)
  Data.new(wallet_id: data['wallet_id'], seed: data['seed'])
end

Instance Method Details

#to_hashHash

Converts the Data object to a Hash.

Returns:

  • (Hash)

    The Hash representation of the Data object



19
20
21
# File 'lib/coinbase/wallet/data.rb', line 19

def to_hash
  { wallet_id: wallet_id, seed: seed }
end