stripe-cli 1.3.0 → 1.4.0

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: 542bd7dcfa28ee42f23292d05d756c403af1ff47
4
- data.tar.gz: a2ec85e9b793942e1c17075496b4443799d48bf2
3
+ metadata.gz: ce767839a7055d850af7737d68608c90a5948deb
4
+ data.tar.gz: db0c0b27124b551fce0715361d90bcb1f18d41ae
5
5
  SHA512:
6
- metadata.gz: a09c8ed2b6eb9d5eb32be9b91cacbcd404b10048d560c46ae5edff58d474f69e0e4f7d065bee4d7544d8dd7940173d80d4c4283b79426be709ed480959183e73
7
- data.tar.gz: 3636cc9505ef6c4c1bb5c0b6d5f54ac4378eddce824586fc7ee54fa6d97e26b55d19db8ca2f400e7fdde63f03a07d61cb884b456b0b33f18ed4ca0f32599bc60
6
+ metadata.gz: 0a5c4e468a034da34f107870d7d5550b9839b56bb71833aa488018eabdacce23b5f3aee108fdfc7a42c1126f7d453669b22858aa3a4b68d8ef8f2eb40d20da18
7
+ data.tar.gz: 455b48943df0eb5f2399f091f72eef7db739d875bf10c7841350eb2271eb6dced3d27446df44cf9a8e25bf0ce82cd6e7dd99ef1805d39f1beb43390b0d4b00a8
data/README.md CHANGED
@@ -53,10 +53,12 @@ You may also overide the default environment setting in your config file by pass
53
53
 
54
54
  Commands:
55
55
  stripe balance # show currently available and pending balance amounts
56
+ stripe cards # find, list, create, & delete cards for both customers & recipients
56
57
  stripe charges # find, list, create, capture, & refund charges
57
58
  stripe coupons # find, list, create, & delete coupons
58
59
  stripe customers # find, list, create, & delete customers
59
60
  stripe events # find & list events
61
+ stripe help [COMMAND] # Describe available commands or one specific command
60
62
  stripe invoices # find, list, pay, and close invoices
61
63
  stripe plans # find, list, create, & delete plans
62
64
  stripe recipients # find, list, create & delete recipients
@@ -126,10 +128,19 @@ Api errors are rescued and their messages displayed for you to read. No more ``
126
128
  ### Tokens
127
129
 
128
130
  Commands:
129
- stripe tokens create TYPE # create a new token of type TYPE(card or account)
131
+ stripe tokens create TYPE # Create a new token of type TYPE(card or account)
130
132
  stripe tokens find ID # Find a Token
131
133
  stripe tokens help [COMMAND] # Describe subcommands or one specific subcommand
132
134
 
135
+ ### Cards
136
+
137
+ Commands:
138
+ stripe cards create --owner=OWNER # Create a new card for OWNER (customer or recipient)
139
+ stripe cards delete ID --owner=OWNER # Delete ID card for OWNER (customer or recipient)
140
+ stripe cards find ID --owner=OWNER # Find ID card for OWNER (customer or recipient)
141
+ stripe cards help [COMMAND] # Describe subcommands or one specific subcommand
142
+ stripe cards list --owner=OWNER # List cards for OWNER (customer or recipient)
143
+
133
144
  ### Customers
134
145
 
135
146
  Commands:
@@ -142,16 +153,16 @@ Api errors are rescued and their messages displayed for you to read. No more ``
142
153
  ### Subscriptions
143
154
 
144
155
  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
156
+ stripe subscriptions cancel ID --customer=CUSTOMER # Cancel ID subscription for CUSTOMER customer
157
+ stripe subscriptions create --customer=CUSTOMER # Create a subscription for CUSTOMER customer
158
+ stripe subscriptions find ID --customer=CUSTOMER # Find ID subscription for CUSTOMER customer
148
159
  stripe subscriptions help [COMMAND] # Describe subcommands or one specific subcommand
149
160
  stripe subscriptions list --customer=CUSTOMER # List subscriptions for CUSTOMER customer
150
161
 
151
162
  ### Invoices
152
163
 
153
164
  Commands:
154
- stripe invoices close ID # close an unpaid invoice
165
+ stripe invoices close ID # Close an unpaid invoice
155
166
  stripe invoices find ID # Find an invoice
156
167
  stripe invoices help [COMMAND] # Describe subcommands or one specific subcommand
157
168
  stripe invoices list # List invoices (optionally by customer_id)
@@ -193,8 +204,8 @@ Api errors are rescued and their messages displayed for you to read. No more ``
193
204
  ### Recipients
194
205
 
195
206
  Commands:
196
- stripe recipients create # create a new recipient
197
- stripe recipients delete ID # delete a recipient
207
+ stripe recipients create # Create a new recipient
208
+ stripe recipients delete ID # Delete a recipient
198
209
  stripe recipients find ID # Find a recipient
199
210
  stripe recipients help [COMMAND] # Describe subcommands or one specific subcommand
200
211
  stripe recipients list # List recipients
@@ -202,7 +213,7 @@ Api errors are rescued and their messages displayed for you to read. No more ``
202
213
  ### Transfers
203
214
 
204
215
  Commands:
205
- stripe transfers create # create a new outgoing money transfer
216
+ stripe transfers create # Create a new outgoing money transfer
206
217
  stripe transfers find ID # Find a transfer
207
218
  stripe transfers help [COMMAND] # Describe subcommands or one specific subcommand
208
219
  stripe transfers list # List transfers, optionaly filter by recipient or transfer status: ( pending paid failed )
@@ -1,6 +1,7 @@
1
1
  module Stripe
2
2
  module CLI
3
3
  module Commands
4
+ autoload :Cards, 'stripe/cli/commands/cards'
4
5
  autoload :Charges, 'stripe/cli/commands/charges'
5
6
  autoload :Customers, 'stripe/cli/commands/customers'
6
7
  autoload :Tokens, 'stripe/cli/commands/tokens'
@@ -0,0 +1,80 @@
1
+ module Stripe
2
+ module CLI
3
+ module Commands
4
+ class Cards < Command
5
+ include Stripe::Utils
6
+
7
+ desc "list", "List cards for OWNER (customer or recipient)"
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 :owner, :required => true, :desc => "id of owner to search within"
14
+ def list
15
+ if owner = retrieve_owner(options.delete :owner)
16
+ super owner.cards, options
17
+ end
18
+ end
19
+
20
+ desc "find ID", "find ID card for OWNER (customer or recipient)"
21
+ option :owner, :required => true, :desc => "id of card owner to search within"
22
+ def find card_id
23
+ if owner = retrieve_owner(options.delete :owner)
24
+ super owner.cards, card_id
25
+ end
26
+ end
27
+
28
+
29
+ desc "create", "create a new card for OWNER (customer or recipient)"
30
+ option :token
31
+ option :card_number
32
+ option :card_exp_month
33
+ option :card_exp_year
34
+ option :card_cvc
35
+ option :card_name
36
+ option :owner, :required => true, :desc => "id of customer or recipient receiving new card"
37
+ def create
38
+ options[:card] = options.delete(:token)
39
+ options[:card] ||= credit_card( options )
40
+ if owner = retrieve_owner(options.delete :owner)
41
+ super owner.cards, options
42
+ end
43
+ end
44
+
45
+ desc "delete ID", "delete ID card for OWNER (customer or recipient)"
46
+ option :owner, :required => true, :desc => "id of owner to search within"
47
+ def delete card_id
48
+ if owner = retrieve_owner(options.delete :owner) and
49
+ card = retrieve_card(owner, card_id)
50
+ request card, :delete
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ def retrieve_owner id
57
+ begin
58
+ if id.start_with? "r"
59
+ Stripe::Recipient.retrieve(id, api_key)
60
+ else
61
+ Stripe::Customer.retrieve(id, api_key)
62
+ end
63
+ rescue Exception => e
64
+ ap e.message
65
+ false
66
+ end
67
+ end
68
+
69
+ def retrieve_card owner, id
70
+ begin
71
+ owner.cards.retrieve(id)
72
+ rescue Exception => e
73
+ ap e.message
74
+ false
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -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 reciving the new subscription"
39
+ option :customer, :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:')
@@ -1,6 +1,7 @@
1
1
  module Stripe
2
2
  module CLI
3
3
  class Runner < Thor
4
+ register Commands::Cards, 'cards', 'cards', 'find, list, create, & delete cards for both customers & recipients'
4
5
  register Commands::Charges, 'charges', 'charges', 'find, list, create, capture, & refund charges'
5
6
  register Commands::Customers, 'customers', 'customers', 'find, list, create, & delete customers'
6
7
  register Commands::Tokens, 'tokens', 'tokens', 'find & create tokens for bank accounts & credit cards'
@@ -1,5 +1,5 @@
1
1
  module Stripe
2
2
  module CLI
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
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.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw
@@ -167,6 +167,7 @@ files:
167
167
  - lib/stripe/cli/command.rb
168
168
  - lib/stripe/cli/commands.rb
169
169
  - lib/stripe/cli/commands/balance.rb
170
+ - lib/stripe/cli/commands/cards.rb
170
171
  - lib/stripe/cli/commands/charges.rb
171
172
  - lib/stripe/cli/commands/coupons.rb
172
173
  - lib/stripe/cli/commands/customers.rb