Class: Stripe::CLI::Commands::Recipients

Inherits:
Stripe::CLI::Command show all
Includes:
Utils
Defined in:
lib/stripe/cli/commands/recipients.rb

Instance Method Summary collapse

Methods inherited from Stripe::CLI::Command

#inspect

Instance Method Details

#createObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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] = ( options )
  end

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

  super Stripe::Recipient, options
end

#delete(recipient_id) ⇒ Object



24
25
26
# File 'lib/stripe/cli/commands/recipients.rb', line 24

def delete recipient_id
  super Stripe::Recipient, recipient_id
end

#find(recipient_id) ⇒ Object



19
20
21
# File 'lib/stripe/cli/commands/recipients.rb', line 19

def find recipient_id
  super Stripe::Recipient, recipient_id
end

#listObject



14
15
16
# File 'lib/stripe/cli/commands/recipients.rb', line 14

def list
  super Stripe::Recipient, options
end