Class: Coinbase::Wallet::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/coinbase/wallet.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



184
185
186
187
# File 'lib/coinbase/wallet.rb', line 184

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

Instance Attribute Details

#seedObject (readonly)

Returns the value of attribute seed.



179
180
181
# File 'lib/coinbase/wallet.rb', line 179

def seed
  @seed
end

#wallet_idObject (readonly)

Returns the value of attribute wallet_id.



179
180
181
# File 'lib/coinbase/wallet.rb', line 179

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



198
199
200
# File 'lib/coinbase/wallet.rb', line 198

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



191
192
193
# File 'lib/coinbase/wallet.rb', line 191

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