stripe-cli 1.4.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5514138ee0b6af8b72c00f3f6fd36ac9ccef8367
4
- data.tar.gz: 2b3c14c341ca7e0c1ca2b4c408ac8fa892dff17e
3
+ metadata.gz: aab8d9e0ab67ead75e2e0621a82fc7958e0e7ccc
4
+ data.tar.gz: 251b927fe0b90104dc2d13ecf28538822bfe9984
5
5
  SHA512:
6
- metadata.gz: 6b428704103133418bb34ec718239cd0b8029f11a45a2fda29e37ce60831cbb608c4893258653b34fea62fca8d9cfa952eae7fc669274523a2c16627f52d8365
7
- data.tar.gz: 591707dab238d6d62872792e65c2eab5e260cde162f2f7e267cfa483d29cba842b4fff295a5543e0b8414c7fac6eea48e910c19316abc43ddcab680a764ee976
6
+ metadata.gz: 50e2e74d702a9fd8aba3d30412dddafe2cbd7347a43180be919990e948f40328ff832b53a3447856e003ec342bb744d03d6372e99d7d655d50a158afc39e9088
7
+ data.tar.gz: 510236f8782bb51c4e0dc36867faad52217149c4dfc2f843a6cd7f7a1cd42488e7b7cf3914925a42b4b181d2fb9e9fbf8fb68dceaae77a9d2a65c07356e39a63
data/README.md CHANGED
@@ -83,7 +83,7 @@ If you choose to go this route, make sure to add `.stripecli` to your `.gitignor
83
83
  stripe invoices # find, list, pay, and close invoices
84
84
  stripe plans # find, list, create, & delete plans
85
85
  stripe recipients # find, list, create & delete recipients
86
- stripe subscriptions # find, list, create & cancel multiple subscriptions per customer
86
+ stripe subscriptions # find, list, create, cancel & reactivate multiple subscriptions per customer
87
87
  stripe tokens # find & create tokens for bank accounts & credit cards
88
88
  stripe transactions # find & list balance transactions
89
89
  stripe transfers # find, list, & create transfers
@@ -174,11 +174,12 @@ Api errors are rescued and their messages displayed for you to read. No more ``
174
174
  ### Subscriptions
175
175
 
176
176
  Commands:
177
- stripe subscriptions cancel ID --customer=CUSTOMER # Cancel ID subscription for CUSTOMER customer
178
- stripe subscriptions create --customer=CUSTOMER # Create a subscription for CUSTOMER customer
179
- stripe subscriptions find ID --customer=CUSTOMER # Find ID subscription for CUSTOMER customer
180
- stripe subscriptions help [COMMAND] # Describe subcommands or one specific subcommand
181
- stripe subscriptions list --customer=CUSTOMER # List subscriptions for CUSTOMER customer
177
+ stripe subscriptions cancel ID --customer=CUSTOMER # cancel ID subscription for CUSTOMER customer
178
+ stripe subscriptions create --customer=CUSTOMER # create a subscription for CUSTOMER customer
179
+ stripe subscriptions find ID --customer=CUSTOMER # find ID subscription for CUSTOMER customer
180
+ stripe subscriptions help [COMMAND] # Describe subcommands or one specific subcommand
181
+ stripe subscriptions list --customer=CUSTOMER # List subscriptions for CUSTOMER customer
182
+ stripe subscriptions reactivate ID --customer=CUSTOMER # reactivate auto-renewal if `cancel-at-period-end` was set to true
182
183
 
183
184
  ### Invoices
184
185
 
@@ -4,7 +4,7 @@ module Stripe
4
4
  class Charges < Command
5
5
  include Stripe::Utils
6
6
 
7
- desc "list", "List charges"
7
+ desc "list", "List charges (optionally by customer_id)"
8
8
  option :starting_after, :desc => "The ID of the last object in the previous paged result set. For cursor-based pagination."
9
9
  option :ending_before, :desc => "The ID of the first object in the previous paged result set, when paging backwards through the list."
10
10
  option :limit, :desc => "a limit on the number of resources returned, between 1 and 100"
@@ -21,10 +21,14 @@ module Stripe
21
21
  end
22
22
 
23
23
  desc "refund ID", "Refund a charge"
24
- option :amount, :type => :numeric
24
+ option :amount, :type => :numeric, :desc => "Refund amount in dollars"
25
+ option :metadata, :type => :hash
26
+ option :refund_application_fee, :type => :boolean, :default => false, :desc => "Whether or not to refund the application fee"
25
27
  def refund charge_id
26
28
  options[:amount] = (Float(options[:amount]) * 100).to_i if options[:amount]
27
- request Stripe::Charge.new(charge_id, api_key), :refund, options
29
+ if charge = retrieve_charge(charge_id)
30
+ request charge.refunds, :create, options
31
+ end
28
32
  end
29
33
 
30
34
  desc "capture ID", "Capture a charge"
@@ -40,13 +44,13 @@ module Stripe
40
44
  option :card_exp_year
41
45
  option :card_cvc
42
46
  option :card_name
43
- option :amount, :type => :numeric
47
+ option :amount, :type => :numeric, :desc => "Charge amount in dollars"
44
48
  option :currency, :default => 'usd'
45
49
  option :description
46
50
  option :capture, :type => :boolean, :default => true
47
51
  option :metadata, :type => :hash
48
- option :statement_description, :desc => "a string to be displayed alongside your company name on your customer's credit card statementup. Maybe up to 15 characters in length."
49
- option :receipt_email, :desc => "The email address to send this charge's receipt to. Overrides all default email settings."
52
+ option :statement_description, :desc => "Displayed alongside your company name on your customer's card statement (15 character max)"
53
+ option :receipt_email, :desc => "Email address to send receipt to. Overrides default email settings."
50
54
  def create
51
55
  options[:amount] ||= ask('Amount in dollars:')
52
56
  options[:amount] = (Float(options[:amount]) * 100).to_i
@@ -55,6 +59,18 @@ module Stripe
55
59
 
56
60
  super Stripe::Charge, options
57
61
  end
62
+
63
+ private
64
+
65
+ def retrieve_charge id
66
+ begin
67
+ Stripe::Charge.retrieve(id, api_key)
68
+ rescue Exception => e
69
+ ap e.message
70
+ false
71
+ end
72
+ end
73
+
58
74
  end
59
75
  end
60
76
  end
@@ -33,7 +33,7 @@ module Stripe
33
33
  option :max_redemptions, :type => :numeric
34
34
  option :duration_in_months
35
35
  option :currency, :default => 'usd'
36
-
36
+ option :metadata, :type => :hash
37
37
  def create
38
38
  unless options[:percent_off] || options[:amount_off]
39
39
  discount = ask('(e.g. 25% or $10) specify discount:')
@@ -31,7 +31,7 @@ module Stripe
31
31
  option :interval_count, :type => :numeric, :default => 1
32
32
  option :currency, :default => 'usd'
33
33
  option :trial_period_days, :type => :numeric, :default => 0
34
-
34
+ option :metadata, :type => :hash
35
35
  def create
36
36
  options[:amount] ||= ask('Amount in dollars:')
37
37
  options[:amount] = (Float(options[:amount]) * 100).to_i
@@ -10,7 +10,7 @@ module Stripe
10
10
  option :limit, :desc => "a limit on the number of resources returned, between 1 and 100"
11
11
  option :offset, :desc => "the starting index to be used, relative to the entire list"
12
12
  option :count, :desc => "depricated: use limit"
13
- option :customer, :required => true, :desc => "id of customer to search within"
13
+ option :customer, :aliases => :c, :required => true, :desc => "id of customer to search within"
14
14
  def list
15
15
  if cust = retrieve_customer(options.delete :customer)
16
16
  super cust.subscriptions, options
@@ -18,7 +18,7 @@ module Stripe
18
18
  end
19
19
 
20
20
  desc "find ID", "find ID subscription for CUSTOMER customer"
21
- option :customer, :required => true, :desc => "id of customer to search within"
21
+ option :customer, :aliases => :c, :required => true, :desc => "id of customer to search within"
22
22
  def find subscription_id
23
23
  if cust = retrieve_customer(options.delete :customer)
24
24
  super cust.subscriptions, subscription_id
@@ -36,7 +36,7 @@ module Stripe
36
36
  option :card_cvc
37
37
  option :card_name
38
38
  option :metadata, :type => :hash
39
- option :customer, :required => true, :desc => "id of customer receiving the new subscription"
39
+ option :customer, :aliases => :c, :required => true, :desc => "id of customer receiving the new subscription"
40
40
  def create
41
41
  options[:plan] ||= ask('Assign a plan:')
42
42
  options[:coupon] ||= ask('Apply a coupon:')
@@ -50,11 +50,21 @@ module Stripe
50
50
 
51
51
 
52
52
  desc "cancel ID", "cancel ID subscription for CUSTOMER customer"
53
- option :customer, :required => true, :desc => "id of customer to search within"
53
+ option :at_period_end, :type => :boolean, :default => false, :desc => "delay cancellation until end of current period"
54
+ option :customer, :aliases => :c, :required => true, :desc => "id of customer to search within"
54
55
  def cancel subscription_id
55
56
  if cust = retrieve_customer(options.delete :customer) and
56
57
  subscription = retrieve_subscription(cust, subscription_id)
57
- request subscription, :delete
58
+ request subscription, :delete, options
59
+ end
60
+ end
61
+
62
+ desc "reactivate ID", "reactivate auto-renewal if `cancel-at-period-end` was set to true"
63
+ option :customer, :aliases => :c, :required => true, :desc => "id of customer to search within"
64
+ def reactivate subscription_id
65
+ if cust = retrieve_customer(options.delete :customer) and
66
+ subscription = retrieve_subscription(cust, subscription_id)
67
+ request subscription, :save
58
68
  end
59
69
  end
60
70
 
@@ -14,7 +14,7 @@ module Stripe
14
14
  register Commands::Transactions, 'transactions', 'transactions', 'find & list balance transactions'
15
15
  register Commands::Balance, 'balance', 'balance', 'show currently available and pending balance amounts'
16
16
  register Commands::Recipients, 'recipients', 'recipients', 'find, list, create & delete recipients'
17
- register Commands::Subscriptions, 'subscriptions', 'subscriptions', 'find, list, create & cancel multiple subscriptions per customer'
17
+ register Commands::Subscriptions, 'subscriptions', 'subscriptions', 'find, list, create, cancel & reactivate multiple subscriptions per customer'
18
18
  register Commands::Transfers, 'transfers', 'transfers', 'find, list, & create transfers'
19
19
  register Commands::Version, 'version', 'version', 'display current gem version', hide: true
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module Stripe
2
2
  module CLI
3
- VERSION = "1.4.4"
3
+ VERSION = "1.4.6"
4
4
  end
5
5
  end
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.4.4
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-30 00:00:00.000000000 Z
12
+ date: 2014-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler