google_spreadsheet_fetcher 1.8.0 → 1.9.1
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/.github/workflows/main.yml +40 -0
- data/.github/workflows/release.yml +33 -0
- data/.rspec +1 -0
- data/LICENSE +21 -0
- data/google_spreadsheet_fetcher.gemspec +1 -0
- data/lib/google_spreadsheet_fetcher/error.rb +1 -0
- data/lib/google_spreadsheet_fetcher/sheet_url.rb +58 -0
- data/lib/google_spreadsheet_fetcher/sheets_service_builder.rb +1 -1
- data/lib/google_spreadsheet_fetcher/version.rb +1 -1
- data/lib/google_spreadsheet_fetcher.rb +2 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3660f6d65df012ef4f8dab6b94a6546c5fff27c188728228af19733f21d5114
|
4
|
+
data.tar.gz: ac69095de2b42ca87b8f4cc94a1789ef06a6daed653864fc731f4c258fcaa4b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e384e728280389bc97dde41209c092f4a7fc5260b90fcbdbb98791265845d1873bddb4ddb30bf8dae170de548a32812ba7635e802beb5fec1e10aa4c2ab5473
|
7
|
+
data.tar.gz: 3e924a4be7fbef426b1ec35102145c9cb19148794ee1452256b8ddbaadfcdecb2be6cdc815064b5664478622f72c2e380a1ee0586fa57716212b68edcdcf91ee
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: rspec
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
8
|
+
pull_request:
|
9
|
+
branches:
|
10
|
+
- main
|
11
|
+
|
12
|
+
env:
|
13
|
+
RAILS_ENV: test
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
test:
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
|
21
|
+
matrix:
|
22
|
+
ruby:
|
23
|
+
- 2.6
|
24
|
+
- 2.7
|
25
|
+
- 3.0
|
26
|
+
- 3.1
|
27
|
+
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v2
|
30
|
+
|
31
|
+
- name: Set up Ruby
|
32
|
+
uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
35
|
+
bundler-cache: true
|
36
|
+
|
37
|
+
- name: Run tests
|
38
|
+
run: |
|
39
|
+
bundle exec rspec
|
40
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Release gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
rubygems-otp-code:
|
7
|
+
description: RubyGems OTP code
|
8
|
+
required: true
|
9
|
+
|
10
|
+
permissions:
|
11
|
+
contents: write
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
release-gem:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
env:
|
17
|
+
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
18
|
+
GEM_HOST_OTP_CODE: ${{ github.event.inputs.rubygems-otp-code }}
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
with:
|
22
|
+
fetch-depth: 0 # bundle exec rake release で git tag を見るため、tagをfetchするようにしている
|
23
|
+
- uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: 3.1.1
|
26
|
+
- name: Bundle install
|
27
|
+
run: bundle install
|
28
|
+
- name: Setup git config # bundle exec rake release でgit tagが打たれていない場合、タグを打ってpushしてくれるため用意している
|
29
|
+
run: |
|
30
|
+
git config --global user.email "taka0125@gmail.com"
|
31
|
+
git config --global user.name "Takahiro Ooishi"
|
32
|
+
- name: Release gem
|
33
|
+
run: bundle exec rake release
|
data/.rspec
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Takahiro Ooishi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = %q{Google Spreadsheet fetcher}
|
13
13
|
spec.description = %q{Google Spreadsheet fetcher}
|
14
14
|
spec.homepage = "https://github.com/taka0125/google_spreadsheet_fetcher"
|
15
|
+
spec.licenses = ['MIT']
|
15
16
|
|
16
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
18
|
f.match(%r{^(test|spec|features)/})
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module GoogleSpreadsheetFetcher
|
4
|
+
class SheetUrl
|
5
|
+
HOST = 'docs.google.com'.freeze
|
6
|
+
PATH_PATTERN = %r{spreadsheets/d/(?<spreadsheet_id>[^/]+)/edit}.freeze
|
7
|
+
|
8
|
+
attr_reader :spreadsheet_id, :sheet_id
|
9
|
+
|
10
|
+
private_class_method :new
|
11
|
+
|
12
|
+
def initialize(spreadsheet_id, sheet_id)
|
13
|
+
@spreadsheet_id = spreadsheet_id
|
14
|
+
@sheet_id = sheet_id
|
15
|
+
freeze
|
16
|
+
end
|
17
|
+
|
18
|
+
def url
|
19
|
+
"https://#{self.class::HOST}/spreadsheets/d/#{spreadsheet_id}/edit#gid=#{sheet_id}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def ==(other)
|
23
|
+
return false unless other.class == self.class
|
24
|
+
|
25
|
+
other.hash == hash
|
26
|
+
end
|
27
|
+
|
28
|
+
alias eql? ==
|
29
|
+
|
30
|
+
def hash
|
31
|
+
[spreadsheet_id, sheet_id].join.hash
|
32
|
+
end
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def parse!(url)
|
36
|
+
uri = URI.parse(url)
|
37
|
+
raise InvalidSheetUrl unless uri.host == HOST
|
38
|
+
|
39
|
+
path_matched_result = uri.path.match(PATH_PATTERN)
|
40
|
+
raise InvalidSheetUrl unless path_matched_result
|
41
|
+
|
42
|
+
spreadsheet_id = path_matched_result[:spreadsheet_id]
|
43
|
+
sheet_id = extract_sheet_id(uri.fragment)
|
44
|
+
|
45
|
+
new(spreadsheet_id, sheet_id)
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def extract_sheet_id(fragment)
|
51
|
+
return 0 if fragment.blank?
|
52
|
+
|
53
|
+
results = Hash[*fragment.split('=')]
|
54
|
+
results.dig('gid')&.to_i || 0
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -14,7 +14,7 @@ module GoogleSpreadsheetFetcher
|
|
14
14
|
@user_id = user_id
|
15
15
|
@config = config || GoogleSpreadsheetFetcher.config
|
16
16
|
@application_name = application_name
|
17
|
-
@token_store = config.token_store || Google::Auth::Stores::FileTokenStore.new(file: @config.credential_store_file)
|
17
|
+
@token_store = @config.token_store || Google::Auth::Stores::FileTokenStore.new(file: @config.credential_store_file)
|
18
18
|
end
|
19
19
|
|
20
20
|
def build
|
@@ -1,9 +1,11 @@
|
|
1
|
+
require "active_support"
|
1
2
|
require "active_support/json"
|
2
3
|
require "active_support/core_ext"
|
3
4
|
require "google_spreadsheet_fetcher/version"
|
4
5
|
require "google_spreadsheet_fetcher/config"
|
5
6
|
require "google_spreadsheet_fetcher/error"
|
6
7
|
require "google_spreadsheet_fetcher/fetcher"
|
8
|
+
require "google_spreadsheet_fetcher/sheet_url"
|
7
9
|
require "google_spreadsheet_fetcher/bulk_fetcher"
|
8
10
|
require "google_spreadsheet_fetcher/sheets_service_builder"
|
9
11
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_spreadsheet_fetcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Ooishi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-api-client
|
@@ -89,10 +89,13 @@ executables: []
|
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
+
- ".github/workflows/main.yml"
|
93
|
+
- ".github/workflows/release.yml"
|
92
94
|
- ".gitignore"
|
93
95
|
- ".rspec"
|
94
96
|
- ".travis.yml"
|
95
97
|
- Gemfile
|
98
|
+
- LICENSE
|
96
99
|
- README.md
|
97
100
|
- Rakefile
|
98
101
|
- bin/console
|
@@ -103,10 +106,12 @@ files:
|
|
103
106
|
- lib/google_spreadsheet_fetcher/config.rb
|
104
107
|
- lib/google_spreadsheet_fetcher/error.rb
|
105
108
|
- lib/google_spreadsheet_fetcher/fetcher.rb
|
109
|
+
- lib/google_spreadsheet_fetcher/sheet_url.rb
|
106
110
|
- lib/google_spreadsheet_fetcher/sheets_service_builder.rb
|
107
111
|
- lib/google_spreadsheet_fetcher/version.rb
|
108
112
|
homepage: https://github.com/taka0125/google_spreadsheet_fetcher
|
109
|
-
licenses:
|
113
|
+
licenses:
|
114
|
+
- MIT
|
110
115
|
metadata: {}
|
111
116
|
post_install_message:
|
112
117
|
rdoc_options: []
|
@@ -123,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
128
|
- !ruby/object:Gem::Version
|
124
129
|
version: '0'
|
125
130
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
131
|
+
rubygems_version: 3.3.7
|
127
132
|
signing_key:
|
128
133
|
specification_version: 4
|
129
134
|
summary: Google Spreadsheet fetcher
|