stripe-cli 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -10
- data/lib/stripe/cli/command.rb +19 -19
- data/lib/stripe/cli/commands/balance.rb +1 -1
- data/lib/stripe/cli/commands/charges.rb +4 -2
- data/lib/stripe/cli/commands/customers.rb +7 -4
- data/lib/stripe/cli/commands/invoices.rb +3 -3
- data/lib/stripe/cli/commands/recipients.rb +1 -1
- data/lib/stripe/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34d59db8c8b1fabf38d842025e35b450d4ee01ac
|
4
|
+
data.tar.gz: 70af264df94f2733a40b2d18ea9b54a34d90cdd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ad46cf415dd29857dcd850411e86babe213146a4d130bb5c8ffd28015f277293eb0b478b459c849b2c2a212818eaa35936924e2107b8807e2bb618f18a8e068
|
7
|
+
data.tar.gz: f379088cb35aa572e378b0163fa1da2f4ad2d17050cf5c0a118e6a388e3316c11e0d1eb437cb83bef6eb8687893005374d1a1b71984cbcd4e4c2eef06e519677
|
data/README.md
CHANGED
@@ -12,9 +12,9 @@ Note that all JSON-style epoch timestamps have been converted to **real life** D
|
|
12
12
|
|
13
13
|
$ gem install stripe-cli
|
14
14
|
|
15
|
-
Actually, the gem version is extremely stale right now. I hope to be able to update it soon. Until then, there are a couple of <strike>hacks</strike> options available.
|
16
15
|
|
17
|
-
|
16
|
+
|
17
|
+
you may also clone the repo and build the gem locally yourself
|
18
18
|
|
19
19
|
$ git clone https://github.com/stripe-contrib/stripe-cli.git
|
20
20
|
$ cd ./stripe-cli
|
@@ -24,14 +24,6 @@ Actually, the gem version is extremely stale right now. I hope to be able to up
|
|
24
24
|
> because RubyGems looks **first** at the **current directory** before moving on to [rubygems.org](https://rubygems.org), that last step will install the local gem you just built.
|
25
25
|
|
26
26
|
|
27
|
-
or
|
28
|
-
|
29
|
-
2) bundler can be used to automate this same procedure
|
30
|
-
|
31
|
-
> in a Gemfile, write:
|
32
|
-
|
33
|
-
gem 'stripe-cli', :git => 'git@github.com:stripe-contrib/stripe-cli.git'
|
34
|
-
|
35
27
|
|
36
28
|
## Configuration
|
37
29
|
|
data/lib/stripe/cli/command.rb
CHANGED
@@ -39,28 +39,28 @@ module Stripe
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def list klass, options
|
42
|
-
|
43
|
-
output klass.all( options, api_key )
|
42
|
+
request klass, :all, options, api_key
|
44
43
|
end
|
45
44
|
|
46
45
|
def find klass, id
|
47
|
-
|
48
|
-
output klass.retrieve( id, api_key )
|
46
|
+
request klass, :retrieve, id, api_key
|
49
47
|
end
|
50
48
|
|
51
49
|
def delete klass, id
|
52
|
-
|
53
|
-
output klass.new( id, api_key ).delete
|
50
|
+
request klass.new( id, api_key ), :delete
|
54
51
|
end
|
55
52
|
|
56
53
|
def create klass, options
|
57
|
-
|
58
|
-
output klass.create( options, api_key )
|
54
|
+
request klass, :create, options, api_key
|
59
55
|
end
|
60
56
|
|
61
|
-
def
|
57
|
+
def request object, method, *arguments
|
62
58
|
Stripe.api_version = api_version unless api_version.nil?
|
63
|
-
|
59
|
+
begin
|
60
|
+
output object.send method, *arguments
|
61
|
+
rescue StripeError => e
|
62
|
+
output e.message
|
63
|
+
end
|
64
64
|
end
|
65
65
|
|
66
66
|
private
|
@@ -74,24 +74,24 @@ module Stripe
|
|
74
74
|
when Array
|
75
75
|
object.map {|o| inspect(o) }
|
76
76
|
when Hash
|
77
|
-
object
|
78
|
-
hash[key] = inspect( value )
|
79
|
-
hash
|
80
|
-
end
|
77
|
+
handle_hash object
|
81
78
|
when Stripe::ListObject
|
82
79
|
inspect object.data
|
83
80
|
when Stripe::StripeObject
|
84
81
|
inspect object.to_hash
|
85
82
|
when Numeric
|
86
|
-
|
87
|
-
Time.at object
|
88
|
-
else
|
89
|
-
object
|
90
|
-
end
|
83
|
+
object > 1000000000 ? Time.at( object ) : object
|
91
84
|
else
|
92
85
|
object
|
93
86
|
end
|
94
87
|
end
|
88
|
+
|
89
|
+
def handle_hash object
|
90
|
+
object.inject({}) do |hash, (key, value)|
|
91
|
+
hash[key] = inspect( value )
|
92
|
+
hash
|
93
|
+
end
|
94
|
+
end
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
@@ -16,13 +16,15 @@ module Stripe
|
|
16
16
|
end
|
17
17
|
|
18
18
|
desc "refund ID", "Refund a charge"
|
19
|
+
option :amount, :type => :numeric
|
19
20
|
def refund charge_id
|
20
|
-
|
21
|
+
options[:amount] = (Float(options[:amount]) * 100).to_i
|
22
|
+
request Stripe::Charge.new(charge_id, api_key), :refund, options
|
21
23
|
end
|
22
24
|
|
23
25
|
desc "capture ID", "Capture a charge"
|
24
26
|
def capture charge_id
|
25
|
-
|
27
|
+
request Stripe::Charge.new(charge_id, api_key), :capture
|
26
28
|
end
|
27
29
|
|
28
30
|
desc "create", "Create a charge"
|
@@ -36,11 +36,14 @@ module Stripe
|
|
36
36
|
option :card_name
|
37
37
|
|
38
38
|
def create
|
39
|
-
|
40
|
-
options[:email] ||= ask('Customer\'s Email:')
|
39
|
+
options[:email] ||= ask('Customer\'s Email:')
|
41
40
|
options[:description] ||= ask('Provide a description:')
|
42
|
-
options[:plan]
|
43
|
-
options[:
|
41
|
+
options[:plan] ||= ask('Assign a plan:')
|
42
|
+
if options[:plan] == ""
|
43
|
+
options.delete :plan
|
44
|
+
else
|
45
|
+
options[:coupon] ||= ask('Apply a coupon:')
|
46
|
+
end
|
44
47
|
|
45
48
|
if options[:plan]
|
46
49
|
options[:card_name] ||= ask('Name on Card:')
|
@@ -18,17 +18,17 @@ module Stripe
|
|
18
18
|
|
19
19
|
desc "close ID", "close an unpaid invoice"
|
20
20
|
def close invoice_id
|
21
|
-
|
21
|
+
request Stripe::Invoice.new(invoice_id, api_key), :close
|
22
22
|
end
|
23
23
|
|
24
24
|
desc "pay ID", "trigger an open invoice to be paid immediately"
|
25
25
|
def pay invoice_id
|
26
|
-
|
26
|
+
request Stripe::Invoice.new(invoice_id, api_key), :pay
|
27
27
|
end
|
28
28
|
|
29
29
|
desc "upcoming CUSTOMER", "find the upcoming invoice for CUSTOMER"
|
30
30
|
def upcoming customer_id
|
31
|
-
|
31
|
+
request Stripe::Invoice, :upcoming, {:customer => customer_id}, api_key
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -39,7 +39,7 @@ module Stripe
|
|
39
39
|
options[:email] ||= ask('Recipient\'s Email:')
|
40
40
|
options[:type] ||= if options.delete(:individual) then 'individual'
|
41
41
|
elsif options.delete(:corporation) then 'corporation'
|
42
|
-
else
|
42
|
+
else yes?('Corporation? (Y/n)') ? 'corporation' : 'individual'
|
43
43
|
end
|
44
44
|
options[:tax_id] ||= case options[:type]
|
45
45
|
when 'individual' then ask('Tax ID (SSN):')
|
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.0
|
4
|
+
version: 1.1.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: 2013-10-
|
12
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|