TagoStripe 0.1.0.14 → 0.1.0.16
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/.rspec +1 -0
- data/README.md +5 -30
- data/lib/TagoStripe/Customer.rb +15 -1
- data/lib/TagoStripe/PaymentLink.rb +16 -0
- data/lib/TagoStripe/Product.rb +21 -0
- data/lib/TagoStripe/Subscription.rb +1 -1
- data/lib/TagoStripe/version.rb +1 -1
- data/lib/TagoStripe.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b88b43b1a139ec39d729d355a4b7405155b04d1303ead723374c2b40952bd505
|
4
|
+
data.tar.gz: 2644a21464f75fa4a104cfc80cff1ba8e95c56cad675e3497e655deb698048b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a6945bbe5918bcdfd880792742aa66dcaf6a3b73581e824c6d600d4aa8752fda077b7a253e820fdc4c3cde1fc216df10674bf3419dea4b30cdd41facfce0549
|
7
|
+
data.tar.gz: b65a2b98d974d20938df0a861fd69f51de78b51ca2330ffcd6a27e391cc288240fea0173f77e649f7034c12adfd28c7c48c991ff47660d8a5f5de85fe534cb6a
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/README.md
CHANGED
@@ -1,31 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# このgemの基本理念
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
-
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
12
|
-
|
13
|
-
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
14
|
-
|
15
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
|
-
|
17
|
-
$ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
|
-
## Development
|
24
|
-
|
25
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
|
-
|
27
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
28
|
-
|
29
|
-
## Contributing
|
30
|
-
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/TagoStripe.
|
3
|
+
- とにかく難しいことはしない。
|
4
|
+
- 組み込みフォームなんてもってのほか。PaymentLinkに全てお任せするものとする。
|
5
|
+
- ユーザー視点で見た時に、簡単にキャンセルとかできることが大事。
|
6
|
+
- 製品や価格は管理画面が用意されてるわけだからそっち使おうぜ。
|
data/lib/TagoStripe/Customer.rb
CHANGED
@@ -17,6 +17,20 @@ module TagoStripe
|
|
17
17
|
return customer
|
18
18
|
end
|
19
19
|
|
20
|
+
#顧客名を部分一致で検索できる
|
21
|
+
def self.searchByName(name)
|
22
|
+
set_api_key
|
23
|
+
customers = Stripe::Customer.list
|
24
|
+
customers.select { |customer| customer.name.include?(name) }
|
25
|
+
end
|
26
|
+
|
27
|
+
#emailを部分一致で検索できる
|
28
|
+
def self.searchByEmail(email)
|
29
|
+
set_api_key
|
30
|
+
customers = Stripe::Customer.list
|
31
|
+
customers.select { |customer| customer.email.include?(email) }
|
32
|
+
end
|
33
|
+
|
20
34
|
def self.create(email, name , metaData={})
|
21
35
|
set_api_key
|
22
36
|
customer = Stripe::Customer.create({
|
@@ -27,7 +41,7 @@ module TagoStripe
|
|
27
41
|
return customer
|
28
42
|
end
|
29
43
|
|
30
|
-
def self.update(customer_id,
|
44
|
+
def self.update(customer_id, name, email, metaData={})
|
31
45
|
set_api_key
|
32
46
|
customer = Stripe::Customer.update(customer_id, {
|
33
47
|
email: email,
|
@@ -11,12 +11,28 @@ module TagoStripe
|
|
11
11
|
return payment_links.data
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.activeList
|
15
|
+
set_api_key
|
16
|
+
payment_links = Stripe::PaymentLink.list({active: true})
|
17
|
+
return payment_links.data
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
|
14
22
|
def self.getOne(payment_link_id)
|
15
23
|
set_api_key
|
16
24
|
payment_link = Stripe::PaymentLink.retrieve(payment_link_id)
|
17
25
|
return payment_link
|
18
26
|
end
|
19
27
|
|
28
|
+
def self.getOneWithPrice(payment_link_id)
|
29
|
+
set_api_key
|
30
|
+
payment_link = Stripe::PaymentLink.retrieve(payment_link_id)
|
31
|
+
payment_link_line_items = Stripe::PaymentLink.list_line_items(payment_link_id)
|
32
|
+
payment_link.price = payment_link_line_items.data[0].price
|
33
|
+
return payment_link
|
34
|
+
end
|
35
|
+
|
20
36
|
def self.create(price_id)
|
21
37
|
set_api_key
|
22
38
|
payment_link = Stripe::PaymentLink.create({
|
data/lib/TagoStripe/Product.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'stripe'
|
2
2
|
module TagoStripe
|
3
3
|
class Product
|
4
|
+
|
5
|
+
|
4
6
|
def self.set_api_key
|
5
7
|
Stripe.api_key = ENV['STRIPE_SECRET_KEY']
|
8
|
+
@isTest = true
|
6
9
|
end
|
7
10
|
|
8
11
|
def self.list
|
@@ -17,6 +20,23 @@ module TagoStripe
|
|
17
20
|
return products.data
|
18
21
|
end
|
19
22
|
|
23
|
+
def self.activeListWithPrice
|
24
|
+
set_api_key
|
25
|
+
products = Stripe::Product.list({active: true})
|
26
|
+
products.data.each do |product|
|
27
|
+
prices = Stripe::Price.list({product: product.id,active: true})
|
28
|
+
product.prices = prices.data
|
29
|
+
end
|
30
|
+
return products.data
|
31
|
+
end
|
32
|
+
|
33
|
+
#製品名で検索(部分一致)
|
34
|
+
def self.searchByName(name)
|
35
|
+
set_api_key
|
36
|
+
products = Stripe::Product.list
|
37
|
+
products.select { |product| product.name.include?(name) }
|
38
|
+
end
|
39
|
+
|
20
40
|
def self.getOne(product_id)
|
21
41
|
set_api_key
|
22
42
|
product = Stripe::Product.retrieve(product_id)
|
@@ -33,6 +53,7 @@ module TagoStripe
|
|
33
53
|
return product
|
34
54
|
end
|
35
55
|
|
56
|
+
|
36
57
|
def self.update(product_id, name, description, unit_label)
|
37
58
|
set_api_key
|
38
59
|
product = Stripe::Product.update(product_id, {
|
data/lib/TagoStripe/version.rb
CHANGED
data/lib/TagoStripe.rb
CHANGED
@@ -6,9 +6,21 @@ require_relative "TagoStripe/Price"
|
|
6
6
|
require_relative "TagoStripe/Customer"
|
7
7
|
require_relative "TagoStripe/Common"
|
8
8
|
require_relative "TagoStripe/Subscription"
|
9
|
+
require_relative "TagoStripe/PaymentLink"
|
9
10
|
|
10
11
|
|
11
12
|
module TagoStripe
|
12
13
|
class Error < StandardError; end
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def initialize
|
17
|
+
puts "hello"
|
18
|
+
Stripe.api_key = ENV['STRIPE_SECRET_KEY']
|
19
|
+
end
|
20
|
+
|
21
|
+
def list
|
22
|
+
puts "hello"
|
23
|
+
end
|
24
|
+
end
|
13
25
|
# Your code goes here...
|
14
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- manatago
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stripe
|
@@ -31,6 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".rspec"
|
34
35
|
- README.md
|
35
36
|
- Rakefile
|
36
37
|
- lib/TagoStripe.rb
|