class Blockchain::WalletCreator
Attributes
client[R]
Public Class Methods
new(base_url = DEFAULT_WALLET_URL, api_code)
click to toggle source
# File lib/blockchain/createwallet.rb, line 12 def initialize(base_url = DEFAULT_WALLET_URL, api_code) @client = Client.new(base_url, api_code) end
Public Instance Methods
create_wallet(password, priv: nil, label: nil, email: nil)
click to toggle source
# File lib/blockchain/createwallet.rb, line 16 def create_wallet(password, priv: nil, label: nil, email: nil) params = { 'password' => password } if !priv.nil? params['priv'] = priv end if !label.nil? params['label'] = label end if !email.nil? params['email'] = email end response = @client.call_api('api/v2/create', method: 'post', data: params) json_response = JSON.parse(response) return CreateWalletResponse.new(json_response['guid'], json_response['address'], json_response['label']) end