Class: Round::UserCollection
- Inherits:
-
Collection
- Object
- Base
- Collection
- Round::UserCollection
- Defined in:
- lib/round/user.rb
Instance Attribute Summary
Attributes inherited from Collection
Attributes inherited from Base
Instance Method Summary collapse
- #content_type ⇒ Object
- #create(first_name:, last_name:, email:, passphrase:, device_name:, redirect_uri: nil) ⇒ Object
Methods inherited from Collection
#[], #add, #initialize, #method_missing, #populate_data, #refresh
Methods inherited from Base
association, hash_identifier, #hash_identifier, #initialize, #method_missing, #refresh
Constructor Details
This class inherits a constructor from Round::Collection
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Round::Collection
Instance Method Details
#content_type ⇒ Object
26 27 28 |
# File 'lib/round/user.rb', line 26 def content_type Round::User end |
#create(first_name:, last_name:, email:, passphrase:, device_name:, redirect_uri: nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/round/user.rb', line 30 def create(first_name:, last_name:, email:, passphrase:, device_name:, redirect_uri: nil) multiwallet = CoinOp::Bit::MultiWallet.generate([:primary]) primary_seed = CoinOp::Encodings.hex(multiwallet.trees[:primary].seed) encrypted_seed = CoinOp::Crypto::PassphraseBox.encrypt(passphrase, primary_seed) wallet = { name: 'default', primary_public_seed: multiwallet.trees[:primary].to_bip32, primary_private_seed: encrypted_seed } params = { email: email, first_name: first_name, last_name: last_name, default_wallet: wallet, device_name: device_name, } params[:redirect_uri] = redirect_uri if redirect_uri user_resource = resource.create(params) user = Round::User.new(resource: user_resource, client: @client) user..device_token end |