TagoStripe 0.1.0.15 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 646e72f1a03e85c2556a72b2b5ed4b6a3300326b084faca1a750b8c2906e0635
4
- data.tar.gz: 1f4c12a9547d0b5172abab14df64ac43e74dbadc5ac8237ee5e4e78b8ff4adc6
3
+ metadata.gz: b88b43b1a139ec39d729d355a4b7405155b04d1303ead723374c2b40952bd505
4
+ data.tar.gz: 2644a21464f75fa4a104cfc80cff1ba8e95c56cad675e3497e655deb698048b7
5
5
  SHA512:
6
- metadata.gz: 7de5988ef3d89db13f82a8b9ff7df9a0d91a576f23d0262ae332698b33926e4f218fe8c3b7edc38fde58f359700f61bc4f7e3faa0776ee56cc113bd5ffad6a33
7
- data.tar.gz: 98889aa67abc668d77845e7ebc51b6dc278c25f735aecbdf2f113518ace22a6ce00dafdc3b059c0d6ff8948e4a4a6775d60b09acff00d6382f79883d12e1b8e0
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
- # TagoStripe
1
+ # このgemの基本理念
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/TagoStripe`. To experiment with that code, run `bin/console` for an interactive prompt.
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
+ - 製品や価格は管理画面が用意されてるわけだからそっち使おうぜ。
@@ -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, email, name, metaData={})
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({
@@ -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, {
@@ -42,7 +42,7 @@ module TagoStripe
42
42
 
43
43
  def self.cancel(subscription_id)
44
44
  set_api_key
45
- subscription = Stripe::Subscription.delete(subscription_id)
45
+ subscription = Stripe::Subscription.cancel(subscription_id)
46
46
  return subscription
47
47
  end
48
48
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TagoStripe
4
- VERSION = "0.1.0.15"
4
+ VERSION = "0.1.0.16"
5
5
  end
data/lib/TagoStripe.rb CHANGED
@@ -11,5 +11,16 @@ require_relative "TagoStripe/PaymentLink"
11
11
 
12
12
  module TagoStripe
13
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
14
25
  # Your code goes here...
15
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.15
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-07-23 00:00:00.000000000 Z
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