stripe-cli 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7acf8c013d963492b3c5b5c5be0b6d491939d3f3
4
- data.tar.gz: aaca783bc677b2505e7e0239bda542135e951cf2
3
+ metadata.gz: fef5bc5cbf9b0b6f8eb7c97f0f3241c54d1ec13e
4
+ data.tar.gz: 6f876a9808d867a0b722a11742ba02fc5f2387d0
5
5
  SHA512:
6
- metadata.gz: 43c0d8e42b469f3317c53acf525195af22efcd534fd6c77ede122b9bf42381b7696060748dc75d214d59487215f3682cfc6a41f9b4cc75fd616d640a30b2b1d7
7
- data.tar.gz: c49672d4a38e69f465fc86aeb2b7a35b9c2e11e9da1cd381069baf823dbdfe07c3695d17304ce73fdba953d56e8fb363abcef4ac6d8b496625a05c4bfe6be787
6
+ metadata.gz: 240faef52c21585845df05f217aa5db285cd139a6f6795ceea363ae85ad7fa62f5f218d43087d0ae9fe9e4eb9516e533283f3907ad5a546b20ec86f25e6eae1b
7
+ data.tar.gz: 643c7e5db02ae8fd1bdd72112a50caf1992b5aaab17b6eb4a7cd008742deef4f28db23e331ce655f714e12397e37fd23fde44cb3aa02f2a9af2e9e0eaafce572
@@ -27,15 +27,16 @@ module Stripe
27
27
 
28
28
 
29
29
  desc "create", "create a new card for OWNER (customer or recipient)"
30
- option :card, :aliases => :token, :desc => "credit card Token or ID. May also be created interactively."
31
- option :card_number, :aliases => :number
32
- option :card_exp_month, :aliases => :exp_month, :desc => "Two digit expiration month of card"
33
- option :card_exp_year, :aliases => :exp_year, :desc => "Four digit expiration year of card"
34
- option :card_cvc, :aliases => :cvc, :desc => "Three or four digit security code located on the back of card"
35
- option :card_name, :aliases => :name, :desc => "Cardholder's full name as displayed on card"
36
- option :owner, :required => true, :desc => "id of customer or recipient receiving new card"
30
+ option :card, :aliases => "--token", :desc => "credit card Token or ID. May also be created interactively."
31
+ option :card_number, :aliases => "--number"
32
+ option :card_exp_month, :aliases => "--exp-month", :desc => "Two digit expiration month of card"
33
+ option :card_exp_year, :aliases => "--exp-year", :desc => "Four digit expiration year of card"
34
+ option :card_cvc, :aliases => "--cvc", :desc => "Three or four digit security code located on the back of card"
35
+ option :card_name, :aliases => "--name", :desc => "Cardholder's full name as displayed on card"
36
+ option :owner, :aliases => %w( --customer --recipient ), :required => true, :desc => "id of customer or recipient receiving new card"
37
37
  def create
38
- options[:card] ||= credit_card( options )
38
+ card = options.delete(:card)
39
+ options[:card] = card || credit_card( options )
39
40
  if owner = retrieve_owner(options.delete :owner)
40
41
  super owner.cards, options
41
42
  end
@@ -38,12 +38,12 @@ module Stripe
38
38
 
39
39
  desc "create", "Create a charge"
40
40
  option :customer, :desc => "The ID of an existing customer to charge"
41
- option :card, :aliases => :token, :desc => "credit card Token or ID. May also be created interactively."
42
- option :card_number, :aliases => :number
43
- option :card_exp_month, :aliases => :exp_month, :desc => "Two digit expiration month of card"
44
- option :card_exp_year, :aliases => :exp_year, :desc => "Four digit expiration year of card"
45
- option :card_cvc, :aliases => :cvc, :desc => "Three or four digit security code located on the back of card"
46
- option :card_name, :aliases => :name, :desc => "Cardholder's full name as displayed on card"
41
+ option :card, :aliases => "--token", :desc => "credit card Token or ID. May also be created interactively."
42
+ option :card_number, :aliases => "--number"
43
+ option :card_exp_month, :aliases => "--exp-month", :desc => "Two digit expiration month of card"
44
+ option :card_exp_year, :aliases => "--exp-year", :desc => "Four digit expiration year of card"
45
+ option :card_cvc, :aliases => "--cvc", :desc => "Three or four digit security code located on the back of card"
46
+ option :card_name, :aliases => "--name", :desc => "Cardholder's full name as displayed on card"
47
47
  option :amount, :type => :numeric, :desc => "Charge amount in dollars"
48
48
  option :currency, :default => "usd"
49
49
  option :description, :desc => "Arbitrary description of charge"
@@ -33,12 +33,12 @@ module Stripe
33
33
  option :quantity, :desc => "A multiplier for the plan option. defaults to `1'"
34
34
  option :trial_end, :desc => "apply a trial period until this date. Override plan's trial period."
35
35
  option :account_balance, :desc => "customer's starting account balance in cents. A positive amount will be added to the next invoice while a negitive amount will act as a credit."
36
- option :card, :aliases => :token, :desc => "credit card Token or ID. May also be created interactively."
37
- option :card_number, :aliases => :number
38
- option :card_exp_month, :aliases => :exp_month, :desc => "Two digit expiration month of card"
39
- option :card_exp_year, :aliases => :exp_year, :desc => "Four digit expiration year of card"
40
- option :card_cvc, :aliases => :cvc, :desc => "Three or four digit security code located on the back of card"
41
- option :card_name, :aliases => :name, :desc => "Cardholder's full name as displayed on card"
36
+ option :card, :aliases => "--token", :desc => "credit card Token or ID. May also be created interactively."
37
+ option :card_number, :aliases => "--number"
38
+ option :card_exp_month, :aliases => "--exp-month", :desc => "Two digit expiration month of card"
39
+ option :card_exp_year, :aliases => "--exp-year", :desc => "Four digit expiration year of card"
40
+ option :card_cvc, :aliases => "--cvc", :desc => "Three or four digit security code located on the back of card"
41
+ option :card_name, :aliases => "--name", :desc => "Cardholder's full name as displayed on card"
42
42
  option :metadata, :type => :hash, :desc => "a key/value store of additional user-defined data"
43
43
  def create
44
44
  options[:email] ||= ask('Customer\'s Email:')
@@ -27,21 +27,21 @@ module Stripe
27
27
 
28
28
  desc "create", "create a new recipient. Either an Individual or a Corporation."
29
29
  option :name, :desc => "Full legal name of Individual or Corporation"
30
- option :type, :enum => %w( individual corporation )
31
- option :individual, :type => :boolean, :aliases => :i
32
- option :corporation, :type => :boolean, :aliases => :c
30
+ option :type, :enum => %w( individual corporation ), :desc => "recipient type,"
31
+ option :individual, :type => :boolean, :aliases => :i, :desc => "flag specifying recipient should be of type Individual"
32
+ option :corporation, :type => :boolean, :aliases => :c, :desc => "flag specifying recipient should be of type Corporation"
33
33
  option :tax_id, :type => :numeric
34
34
  option :email
35
35
  option :description
36
- option :bank_account
36
+ option :bank_account, :aliases => "--account"
37
37
  option :country
38
38
  option :account_number
39
39
  option :routing_number
40
- option :card, :aliases => :token, :desc => "credit card Token or ID. May also be created interactively."
41
- option :card_number, :aliases => :number
42
- option :card_exp_month, :aliases => :exp_month, :desc => "Two digit expiration month of card"
43
- option :card_exp_year, :aliases => :exp_year, :desc => "Four digit expiration year of card"
44
- option :card_cvc, :aliases => :cvc, :desc => "Three or four digit security code located on the back of card"
40
+ option :card, :aliases => "--token", :desc => "credit card Token or ID. May also be created interactively."
41
+ option :card_number, :aliases => "--number"
42
+ option :card_exp_month, :aliases => "--exp-month", :desc => "Two digit expiration month of card"
43
+ option :card_exp_year, :aliases => "--exp-year", :desc => "Four digit expiration year of card"
44
+ option :card_cvc, :aliases => "--cvc", :desc => "Three or four digit security code located on the back of card"
45
45
  option :card_name, :desc => "Cardholder's full name as displayed on card"
46
46
  option :metadata, :type => :hash, :desc => "a key/value store of additional user-defined data"
47
47
  def create
@@ -30,12 +30,12 @@ module Stripe
30
30
  option :plan, :desc => "the plan to assign to CUSTOMER customer"
31
31
  option :coupon, :desc => "id of a coupon to apply"
32
32
  option :trial_end, :desc => "apply a trial period until this date. Override plan's trial period."
33
- option :card, :aliases => :token, :desc => "credit card Token or ID. May also be created interactively."
34
- option :card_number, :aliases => :number
35
- option :card_exp_month, :aliases => :exp_month, :desc => "Two digit expiration month of card"
36
- option :card_exp_year, :aliases => :exp_year, :desc => "Four digit expiration year of card"
37
- option :card_cvc, :aliases => :cvc, :desc => "Three or four digit security code located on the back of card"
38
- option :card_name, :aliases => :name, :desc => "Cardholder's full name as displayed on card"
33
+ option :card, :aliases => "--token", :desc => "credit card Token or ID. May also be created interactively."
34
+ option :card_number, :aliases => "--number"
35
+ option :card_exp_month, :aliases => "--exp-month", :desc => "Two digit expiration month of card"
36
+ option :card_exp_year, :aliases => "--exp-year", :desc => "Four digit expiration year of card"
37
+ option :card_cvc, :aliases => "--cvc", :desc => "Three or four digit security code located on the back of card"
38
+ option :card_name, :aliases => "--name", :desc => "Cardholder's full name as displayed on card"
39
39
  option :metadata, :type => :hash, :desc => "a key/value store of additional user-defined data"
40
40
  option :customer, :aliases => :c, :required => true, :desc => "ID of customer receiving the new subscription"
41
41
  def create
@@ -10,24 +10,24 @@ module Stripe
10
10
  end
11
11
 
12
12
  desc "create TYPE", "create a new token of type TYPE(card or account)"
13
- option :card, :type => :hash, :desc => "hash of card parameters which may also be provided individually or added interactively if not provided."
14
- option :card_number, :aliases => :number
15
- option :card_exp_month, :aliases => :exp_month, :desc => "Two digit expiration month of card"
16
- option :card_exp_year, :aliases => :exp_year, :desc => "Four digit expiration year of card"
17
- option :card_cvc, :aliases => :cvc, :desc => "Three or four digit security code located on the back of card"
18
- option :card_name, :aliases => :name, :desc => "Cardholder's full name as displayed on card"
19
- option :bank_account, :type => :hash
13
+ option :card, :type => :hash, :default => {}, :desc => "hash of card params. may also be provided individually or added interactively."
14
+ option :card_number, :aliases => "--number"
15
+ option :card_exp_month, :aliases => "--exp-month", :desc => "Two digit expiration month of card"
16
+ option :card_exp_year, :aliases => "--exp-year", :desc => "Four digit expiration year of card"
17
+ option :card_cvc, :aliases => "--cvc", :desc => "Three or four digit security code located on the back of card"
18
+ option :card_name, :aliases => "--name", :desc => "Cardholder's full name as displayed on card"
19
+ option :bank_account, :aliases => "--account", :type => :hash, :default => {}, :desc => "hash of account params. may also be provided individually or added interactively."
20
20
  option :country
21
21
  option :routing_number
22
22
  option :account_number
23
23
  def create type
24
24
  case type
25
25
  when 'card', 'credit_card', 'credit card'
26
- credit_card = options[:card] ||= credit_card( options )
26
+ credit_card = credit_card( options )
27
27
  options = {}
28
28
  options[:card] = credit_card
29
29
  when 'account', 'bank_account', 'bank account'
30
- bank_account = options[:bank_account] ||= bank_account( options )
30
+ bank_account = bank_account( options )
31
31
  options = {}
32
32
  options[:bank_account] = bank_account
33
33
  end
@@ -1,5 +1,5 @@
1
1
  module Stripe
2
2
  module CLI
3
- VERSION = "1.6.0"
3
+ VERSION = "1.6.1"
4
4
  end
5
5
  end
data/lib/stripe/utils.rb CHANGED
@@ -4,20 +4,22 @@ module Stripe
4
4
  private
5
5
 
6
6
  def credit_card options = {}
7
+ card = options.delete(:card) || {}
7
8
  {
8
- :name => options.delete(:card_name) || ask('Name on Card:'),
9
- :number => options.delete(:card_number) || ask('Card number:'),
10
- :cvc => options.delete(:card_cvc) || ask('CVC code:'),
11
- :exp_month => options.delete(:card_exp_month) || ask('expiration month:'),
12
- :exp_year => options.delete(:card_exp_year) || ask('expiration year:')
9
+ :name => card["name"] || options.delete(:card_name) || ask('Name on Card:'),
10
+ :number => card["number"] || options.delete(:card_number) || ask('Card number:'),
11
+ :cvc => card["cvc"] || options.delete(:card_cvc) || ask('CVC code:'),
12
+ :exp_month => card["exp-month"] || options.delete(:card_exp_month) || ask('expiration month:'),
13
+ :exp_year => card["exp-year"] || options.delete(:card_exp_year) || ask('expiration year:')
13
14
  }
14
15
  end
15
16
 
16
17
  def bank_account options = {}
18
+ account = options.delete(:bank_account) || {}
17
19
  {
18
- :account_number => options.delete(:account_number) || ask('Account Number:'),
19
- :routing_number => options.delete(:routing_number) || ask('Routing Number:'),
20
- :country => options.delete(:country) || 'US'
20
+ :account_number => account["account-number"] || options.delete(:account_number) || ask('Account Number:'),
21
+ :routing_number => account["routing-number"] || options.delete(:routing_number) || ask('Routing Number:'),
22
+ :country => account["country"] || options.delete(:country) || 'US'
21
23
  }
22
24
  end
23
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw