stripe-cli 1.2.2 → 1.3.0
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 +4 -4
- data/README.md +10 -0
- data/lib/stripe/cli/command.rb +0 -5
- data/lib/stripe/cli/commands.rb +1 -0
- data/lib/stripe/cli/commands/subscriptions.rb +83 -0
- data/lib/stripe/cli/runner.rb +1 -0
- data/lib/stripe/cli/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 542bd7dcfa28ee42f23292d05d756c403af1ff47
|
4
|
+
data.tar.gz: a2ec85e9b793942e1c17075496b4443799d48bf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a09c8ed2b6eb9d5eb32be9b91cacbcd404b10048d560c46ae5edff58d474f69e0e4f7d065bee4d7544d8dd7940173d80d4c4283b79426be709ed480959183e73
|
7
|
+
data.tar.gz: 3636cc9505ef6c4c1bb5c0b6d5f54ac4378eddce824586fc7ee54fa6d97e26b55d19db8ca2f400e7fdde63f03a07d61cb884b456b0b33f18ed4ca0f32599bc60
|
data/README.md
CHANGED
@@ -60,6 +60,7 @@ You may also overide the default environment setting in your config file by pass
|
|
60
60
|
stripe invoices # find, list, pay, and close invoices
|
61
61
|
stripe plans # find, list, create, & delete plans
|
62
62
|
stripe recipients # find, list, create & delete recipients
|
63
|
+
stripe subscriptions # find, list, create & cancel multiple subscriptions per customer
|
63
64
|
stripe tokens # find & create tokens for bank accounts & credit cards
|
64
65
|
stripe transactions # find & list balance transactions
|
65
66
|
stripe transfers # find, list, & create transfers
|
@@ -138,6 +139,15 @@ Api errors are rescued and their messages displayed for you to read. No more ``
|
|
138
139
|
stripe customers help [COMMAND] # Describe subcommands or one specific subcommand
|
139
140
|
stripe customers list # List customers
|
140
141
|
|
142
|
+
### Subscriptions
|
143
|
+
|
144
|
+
Commands:
|
145
|
+
stripe subscriptions cancel ID --customer=CUSTOMER # cancel ID subscription for CUSTOMER customer
|
146
|
+
stripe subscriptions create --customer=CUSTOMER # create a subscription for CUSTOMER customer
|
147
|
+
stripe subscriptions find ID --customer=CUSTOMER # find ID subscription for CUSTOMER customer
|
148
|
+
stripe subscriptions help [COMMAND] # Describe subcommands or one specific subcommand
|
149
|
+
stripe subscriptions list --customer=CUSTOMER # List subscriptions for CUSTOMER customer
|
150
|
+
|
141
151
|
### Invoices
|
142
152
|
|
143
153
|
Commands:
|
data/lib/stripe/cli/command.rb
CHANGED
@@ -41,11 +41,6 @@ module Stripe
|
|
41
41
|
@@config
|
42
42
|
end
|
43
43
|
|
44
|
-
method_option :starting_after, :desc => "The ID of the last object in the previous paged result set. For cursor-based pagination."
|
45
|
-
method_option :ending_before, :desc => "The ID of the first object in the previous paged result set, when paging backwards through the list."
|
46
|
-
method_option :limit, :desc => "a limit on the number of resources returned, between 1 and 100"
|
47
|
-
method_option :offset, :desc => "the starting index to be used, relative to the entire list"
|
48
|
-
method_option :count, :desc => "depricated: use limit"
|
49
44
|
def list klass, options
|
50
45
|
request klass, :all, options, api_key
|
51
46
|
end
|
data/lib/stripe/cli/commands.rb
CHANGED
@@ -11,6 +11,7 @@ module Stripe
|
|
11
11
|
autoload :Transactions, 'stripe/cli/commands/transactions'
|
12
12
|
autoload :Balance, 'stripe/cli/commands/balance'
|
13
13
|
autoload :Recipients, 'stripe/cli/commands/recipients'
|
14
|
+
autoload :Subscriptions, 'stripe/cli/commands/subscriptions'
|
14
15
|
autoload :Transfers, 'stripe/cli/commands/transfers'
|
15
16
|
end
|
16
17
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Stripe
|
2
|
+
module CLI
|
3
|
+
module Commands
|
4
|
+
class Subscriptions < Command
|
5
|
+
include Stripe::Utils
|
6
|
+
|
7
|
+
desc "list", "List subscriptions for CUSTOMER customer"
|
8
|
+
option :starting_after, :desc => "The ID of the last object in the previous paged result set. For cursor-based pagination."
|
9
|
+
option :ending_before, :desc => "The ID of the first object in the previous paged result set, when paging backwards through the list."
|
10
|
+
option :limit, :desc => "a limit on the number of resources returned, between 1 and 100"
|
11
|
+
option :offset, :desc => "the starting index to be used, relative to the entire list"
|
12
|
+
option :count, :desc => "depricated: use limit"
|
13
|
+
option :customer, :required => true, :desc => "id of customer to search within"
|
14
|
+
def list
|
15
|
+
if cust = retrieve_customer(options.delete :customer)
|
16
|
+
super cust.subscriptions, options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "find ID", "find ID subscription for CUSTOMER customer"
|
21
|
+
option :customer, :required => true, :desc => "id of customer to search within"
|
22
|
+
def find subscription_id
|
23
|
+
if cust = retrieve_customer(options.delete :customer)
|
24
|
+
super cust.subscriptions, subscription_id
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "create", "create a subscription for CUSTOMER customer"
|
29
|
+
option :plan, :desc => "the plan to assign to CUSTOMER customer"
|
30
|
+
option :coupon, :desc => "id of a coupon to apply"
|
31
|
+
option :trial_end, :desc => "apply a trial period until this date"
|
32
|
+
option :card
|
33
|
+
option :card_number
|
34
|
+
option :card_exp_month
|
35
|
+
option :card_exp_year
|
36
|
+
option :card_cvc
|
37
|
+
option :card_name
|
38
|
+
option :metadata, :type => :hash
|
39
|
+
option :customer, :required => true, :desc => "id of customer reciving the new subscription"
|
40
|
+
def create
|
41
|
+
options[:plan] ||= ask('Assign a plan:')
|
42
|
+
options[:coupon] ||= ask('Apply a coupon:')
|
43
|
+
options.delete( :coupon ) if options[:coupon] == ""
|
44
|
+
options[:card] ||= credit_card( options ) if yes?("add a new credit card? [yN]",:yellow)
|
45
|
+
options[:trial_end] = options[:trial_end].to_i if options[:trial_end]
|
46
|
+
if cust = retrieve_customer(options.delete :customer)
|
47
|
+
super cust.subscriptions, options
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
desc "cancel ID", "cancel ID subscription for CUSTOMER customer"
|
53
|
+
option :customer, :required => true, :desc => "id of customer to search within"
|
54
|
+
def cancel subscription_id
|
55
|
+
if cust = retrieve_customer(options.delete :customer) and
|
56
|
+
subscription = retrieve_subscription(cust, subscription_id)
|
57
|
+
request subscription, :delete
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def retrieve_customer id
|
64
|
+
begin
|
65
|
+
Stripe::Customer.retrieve(id, api_key)
|
66
|
+
rescue Exception => e
|
67
|
+
ap e.message
|
68
|
+
false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def retrieve_subscription cust, id
|
73
|
+
begin
|
74
|
+
cust.subscriptions.retrieve(id)
|
75
|
+
rescue Exception => e
|
76
|
+
ap e.message
|
77
|
+
false
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/stripe/cli/runner.rb
CHANGED
@@ -11,6 +11,7 @@ module Stripe
|
|
11
11
|
register Commands::Transactions, 'transactions', 'transactions', 'find & list balance transactions'
|
12
12
|
register Commands::Balance, 'balance', 'balance', 'show currently available and pending balance amounts'
|
13
13
|
register Commands::Recipients, 'recipients', 'recipients', 'find, list, create & delete recipients'
|
14
|
+
register Commands::Subscriptions, 'subscriptions', 'subscriptions', 'find, list, create & cancel multiple subscriptions per customer'
|
14
15
|
register Commands::Transfers, 'transfers', 'transfers', 'find, list, & create transfers'
|
15
16
|
end
|
16
17
|
end
|
data/lib/stripe/cli/version.rb
CHANGED
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
|
+
version: 1.3.0
|
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-
|
12
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/stripe/cli/commands/invoices.rb
|
175
175
|
- lib/stripe/cli/commands/plans.rb
|
176
176
|
- lib/stripe/cli/commands/recipients.rb
|
177
|
+
- lib/stripe/cli/commands/subscriptions.rb
|
177
178
|
- lib/stripe/cli/commands/tokens.rb
|
178
179
|
- lib/stripe/cli/commands/transactions.rb
|
179
180
|
- lib/stripe/cli/commands/transfers.rb
|