class Stripe::CLI::Commands::Recipients

Public Instance Methods

create() click to toggle source
Calls superclass method Stripe::CLI::Command#create
# File lib/stripe/cli/commands/recipients.rb, line 47
def create
  options[:type] ||= recipient_type(options)

  case options[:type]
  when 'individual'
    options[:name]    ||= ask('Recipient\'s full, legal name:')
    options[:tax_id]  ||= ask('Tax ID (SSN):')
  when 'corporation'
    options[:name]    ||= ask('Full Incorporated Name:')
    options[:tax_id]  ||= ask('Tax ID (EIN):')
  end unless options[:name] && options[:tax_id]

  options[:tax_id].gsub!(/[^\d]/,"")

  options[:email]  ||= ask('Email Address:')

  unless options[:card] || no?('add a Debit Card? [yN]',:yellow)
    options[:card_name] ||= options[:name] if yes?('Name on card same as recipient name? [yN]')
    options[:card] = credit_card( options )
  end

  unless options[:bank_account] || no?('add a Bank Account? [yN]',:yellow)
    options[:bank_account] = bank_account( options )
  end

  options.delete_if {|option,_| strip_list.include? option }

  super Stripe::Recipient, options
end
delete(recipient_id) click to toggle source
Calls superclass method Stripe::CLI::Command#delete
# File lib/stripe/cli/commands/recipients.rb, line 24
def delete recipient_id
  super Stripe::Recipient, recipient_id
end
find(recipient_id) click to toggle source
Calls superclass method Stripe::CLI::Command#find
# File lib/stripe/cli/commands/recipients.rb, line 19
def find recipient_id
  super Stripe::Recipient, recipient_id
end
list() click to toggle source
Calls superclass method Stripe::CLI::Command#list
# File lib/stripe/cli/commands/recipients.rb, line 14
def list
  super Stripe::Recipient, options
end

Private Instance Methods

recipient_type(opt) click to toggle source
# File lib/stripe/cli/commands/recipients.rb, line 79
def recipient_type opt
  opt.delete(:individual) ? 'individual' :
  opt.delete(:corporation) ? 'corporation' :
  yes?('Corporation? [yN]') ? 'corporation' : 'individual'
end
strip_list() click to toggle source
# File lib/stripe/cli/commands/recipients.rb, line 85
def strip_list
  %i( card_number card_exp_month card_exp_year card_cvc card_name country routing_number account_number )
end