TagoStripe 0.1.0.3 → 0.1.0.5
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/lib/TagoStripe/Price.rb +54 -0
- data/lib/TagoStripe/Product.rb +5 -12
- data/lib/TagoStripe/version.rb +1 -1
- data/lib/TagoStripe.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 938f0aafcf8e92bcbf241599507023f8fc93a7267d626d4a27e81b148170aadc
|
4
|
+
data.tar.gz: 76b7152265b16c030567fef20b0563b7562a92f4a778ec8fdf3c4208d960cfad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8540eca5fb3af68b80c8088097027579c034e1daa63642fe91d2c7a84a1ad3fedf5cd89bc4839e4b7dd8b72cde51cf04ec3db5f6197344cd2a00e4b817d3d942
|
7
|
+
data.tar.gz: 64e0110d375ceb60492dd0108b0afa1a6145d1e9ea21e4bc3f5e70de6e09c34de6bb8c9c71fb9908a77df0d859c2094fcaaef5cd0dee34dd639bd7873e2f519b
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'stripe'
|
2
|
+
module TagoStripe
|
3
|
+
class Price
|
4
|
+
def initialize
|
5
|
+
Stripe.api_key = ENV['STRIPE_SECRET_KEY']
|
6
|
+
end
|
7
|
+
|
8
|
+
def list
|
9
|
+
prices = Stripe::Price.list()
|
10
|
+
return prices.data
|
11
|
+
end
|
12
|
+
|
13
|
+
def activeList
|
14
|
+
prices = Stripe::Price.list({active: true})
|
15
|
+
return prices.data
|
16
|
+
end
|
17
|
+
|
18
|
+
def getOne(price_id)
|
19
|
+
price = Stripe::Price.retrieve(price_id)
|
20
|
+
return price
|
21
|
+
end
|
22
|
+
|
23
|
+
def create(product_id, unit_amount, currency, recurring_interval, recurring_interval_count)
|
24
|
+
price = Stripe::Price.create({
|
25
|
+
product: product_id,
|
26
|
+
unit_amount: unit_amount,
|
27
|
+
currency: currency,
|
28
|
+
recurring: {
|
29
|
+
interval: recurring_interval,
|
30
|
+
interval_count: recurring_interval_count
|
31
|
+
}
|
32
|
+
})
|
33
|
+
return price
|
34
|
+
end
|
35
|
+
|
36
|
+
def update(price_id, unit_amount, currency, recurring_interval, recurring_interval_count)
|
37
|
+
price = Stripe::Price.update(price_id, {
|
38
|
+
unit_amount: unit_amount,
|
39
|
+
currency: currency,
|
40
|
+
recurring: {
|
41
|
+
interval: recurring_interval,
|
42
|
+
interval_count: recurring_interval_count
|
43
|
+
}
|
44
|
+
})
|
45
|
+
return price
|
46
|
+
end
|
47
|
+
|
48
|
+
def delete(price_id)
|
49
|
+
price = Stripe::Price.delete(price_id)
|
50
|
+
return price
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
data/lib/TagoStripe/Product.rb
CHANGED
@@ -5,26 +5,22 @@ module TagoStripe
|
|
5
5
|
Stripe.api_key = ENV['STRIPE_SECRET_KEY']
|
6
6
|
end
|
7
7
|
|
8
|
-
def self.
|
9
|
-
|
8
|
+
def self.list
|
10
9
|
products = Stripe::Product.list()
|
11
10
|
return products.data
|
12
11
|
end
|
13
12
|
|
14
|
-
def self.
|
15
|
-
|
13
|
+
def self.activeList
|
16
14
|
products = Stripe::Product.list({active: true})
|
17
15
|
return products.data
|
18
16
|
end
|
19
17
|
|
20
18
|
def self.getOne(product_id)
|
21
|
-
|
22
19
|
product = Stripe::Product.retrieve(product_id)
|
23
20
|
return product
|
24
21
|
end
|
25
22
|
|
26
|
-
def self.
|
27
|
-
|
23
|
+
def self.create(name, description, unit_label)
|
28
24
|
product = Stripe::Product.create({
|
29
25
|
name: name,
|
30
26
|
description: description,
|
@@ -33,8 +29,7 @@ module TagoStripe
|
|
33
29
|
return product
|
34
30
|
end
|
35
31
|
|
36
|
-
def self.
|
37
|
-
|
32
|
+
def self.update(product_id, name, description, unit_label)
|
38
33
|
product = Stripe::Product.update(product_id, {
|
39
34
|
name: name,
|
40
35
|
description: description,
|
@@ -43,12 +38,10 @@ module TagoStripe
|
|
43
38
|
return product
|
44
39
|
end
|
45
40
|
|
46
|
-
def self.
|
47
|
-
|
41
|
+
def self.delete(product_id)
|
48
42
|
product = Stripe::Product.delete(product_id)
|
49
43
|
return product
|
50
44
|
end
|
51
|
-
|
52
45
|
end
|
53
46
|
|
54
47
|
end
|
data/lib/TagoStripe/version.rb
CHANGED
data/lib/TagoStripe.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: TagoStripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- manatago
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- README.md
|
35
35
|
- Rakefile
|
36
36
|
- lib/TagoStripe.rb
|
37
|
+
- lib/TagoStripe/Price.rb
|
37
38
|
- lib/TagoStripe/Product.rb
|
38
39
|
- lib/TagoStripe/version.rb
|
39
40
|
- sig/TagoStripe.rbs
|