google_drive_maintained 3.0.8 → 3.0.10
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/README.md +33 -8
- data/lib/google_drive/file.rb +1 -1
- data/lib/google_drive/session.rb +15 -0
- data/lib/google_drive/spreadsheet.rb +1 -0
- data/lib/google_drive/worksheet.rb +1 -1
- data/lib/google_drive/worksheet_formatting.rb +52 -52
- metadata +19 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1add8da8c82f5e2d07e01c3acf1d6371cdb9a2b76f682e9e23ba97078f0a427d
|
4
|
+
data.tar.gz: 14067a068791b64bb7df18e0f1572868614d21b48c5ad801cd57e67dc0b0c442
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83cefab91ae4aec94b17fd6134895690cd0b15814e018f92742b2b91ca60d45788696c56f980b9e53495a0fcf259fcbebaedd95f6fac1a6102754ea8aeb9db9c
|
7
|
+
data.tar.gz: 6ecdf4804668bcbde411bbd14e68b06bf08843260a71db86350ac8f994b10234097303203efd3db4714f3e3058f720f41a99c1402c02cd7cdacd4cbf82fc9275
|
data/README.md
CHANGED
@@ -1,9 +1,34 @@
|
|
1
|
-
# google-drive-ruby
|
1
|
+
# google-drive-ruby
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/google_drive_maintained)
|
4
|
+
[](https://github.com/y-bonfire/google-drive-ruby-maintained/actions/workflows/test.yml)
|
2
5
|
|
3
6
|
This is a Ruby library to read/write files/spreadsheets in Google Drive/Docs.
|
4
7
|
|
5
8
|
NOTE: This is NOT a library to create Google Drive App.
|
6
|
-
|
9
|
+
|
10
|
+
## Introduction
|
11
|
+
⚠️This is an unofficial maintained fork of [gimite/google-drive-ruby](https://github.com/gimite/google-drive-ruby), originally created by Hiroshi Ichikawa.
|
12
|
+
|
13
|
+
We focus on preserving compatibility and fixing bugs, with minimal disruptive changes.
|
14
|
+
New features may be added carefully when justified, but the core behavior will remain stable.
|
15
|
+
|
16
|
+
See [this issue](https://github.com/y-bonfire/google-drive-ruby-maintained/issues/7) for background and intent.
|
17
|
+
|
18
|
+
## Contributing
|
19
|
+
|
20
|
+
We are actively working on improving the library, updating dependencies, and refining the development workflow.
|
21
|
+
If you'd like to contribute, please check [CONTRIBUTING.md](./CONTRIBUTING.md) for up-to-date contribution guidelines and technical notes (CI, testing, gem build, etc.).
|
22
|
+
|
23
|
+
|
24
|
+
✅ GitHub Actions Integration
|
25
|
+
We've started testing this library with GitHub Actions:
|
26
|
+
👉 [CI Workflow Link](https://github.com/y-bonfire/google-drive-ruby-maintained/actions)
|
27
|
+
|
28
|
+
This enables automated testing on every push and pull request, helping ensure long-term reliability.
|
29
|
+
We welcome feedback and contributions to improve the CI process or test coverage. 🤗
|
30
|
+
|
31
|
+
## table of contents
|
7
32
|
|
8
33
|
* [Migration from ver. 2.x.x or before](#migration)
|
9
34
|
* [How to install](#install)
|
@@ -19,7 +44,7 @@ NOTE: This is an unofficial maintained fork of google-drive-ruby, originally cre
|
|
19
44
|
## <a name="migration">Migration from ver. 2.x.x or before</a>
|
20
45
|
|
21
46
|
There are some incompatible API changes. See
|
22
|
-
[MIGRATING.md](
|
47
|
+
[MIGRATING.md](MIGRATING.md).
|
23
48
|
|
24
49
|
|
25
50
|
## <a name="install">How to install</a>
|
@@ -27,7 +52,7 @@ There are some incompatible API changes. See
|
|
27
52
|
Add this line to your application's Gemfile:
|
28
53
|
|
29
54
|
```ruby
|
30
|
-
gem '
|
55
|
+
gem 'google_drive_maintained'
|
31
56
|
```
|
32
57
|
|
33
58
|
And then execute:
|
@@ -39,20 +64,20 @@ $ bundle
|
|
39
64
|
Or install it yourself as:
|
40
65
|
|
41
66
|
```
|
42
|
-
$ gem install
|
67
|
+
$ gem install google_drive_maintained
|
43
68
|
```
|
44
69
|
|
45
70
|
If you need system wide installation, execute below:
|
46
71
|
|
47
72
|
```
|
48
|
-
$ sudo gem install
|
73
|
+
$ sudo gem install google_drive_maintained
|
49
74
|
```
|
50
75
|
|
51
76
|
## <a name="use">How to use</a>
|
52
77
|
|
53
78
|
### Authorization
|
54
79
|
|
55
|
-
Follow one of the options in [Authorization](
|
80
|
+
Follow one of the options in [Authorization](doc/authorization.md) to construct a session object. The example code below assumes "On behalf of you" option.
|
56
81
|
|
57
82
|
### Example to read/write files in Google Drive
|
58
83
|
|
@@ -128,7 +153,7 @@ New BSD Licence.
|
|
128
153
|
|
129
154
|
## <a name="environments">Supported environments</a>
|
130
155
|
|
131
|
-
Ruby 3.
|
156
|
+
Ruby 3.2.0 or later. Checked with Ruby 3.3.0.
|
132
157
|
|
133
158
|
|
134
159
|
## <a name="author">Author</a>
|
data/lib/google_drive/file.rb
CHANGED
@@ -96,7 +96,7 @@ module GoogleDrive
|
|
96
96
|
def download_to_file(path, params = {})
|
97
97
|
@session.drive_service.get_file(
|
98
98
|
id,
|
99
|
-
{ download_dest: path, supports_all_drives: true }.merge(params)
|
99
|
+
**{ download_dest: path, supports_all_drives: true }.merge(params)
|
100
100
|
)
|
101
101
|
end
|
102
102
|
|
data/lib/google_drive/session.rb
CHANGED
@@ -77,6 +77,7 @@ module GoogleDrive
|
|
77
77
|
# As with from_config, you can configure Google API client behavior with
|
78
78
|
# +client_options+ and +request_options+. Unlike in from_config, these
|
79
79
|
# are passed as positional arguments.
|
80
|
+
# @return [GoogleDrive::Session]
|
80
81
|
def self.from_service_account_key(
|
81
82
|
json_key_path_or_io, scope = DEFAULT_SCOPE, client_options = nil,
|
82
83
|
request_options = nil
|
@@ -270,6 +271,19 @@ module GoogleDrive
|
|
270
271
|
# If given an Array, traverses folders by title. e.g.:
|
271
272
|
# session.file_by_title(
|
272
273
|
# ["myfolder", "mysubfolder/even/w/slash", "myfile"])
|
274
|
+
# root
|
275
|
+
# └── myfolder
|
276
|
+
# └── mysubfolder/even/w/slash
|
277
|
+
# └── myfile
|
278
|
+
# In Google Drive,
|
279
|
+
#
|
280
|
+
# "mysubfolder/even/w/slash"
|
281
|
+
#
|
282
|
+
# is a folder with a single name that includes a slash.
|
283
|
+
# For example, you can create a folder named mysubfolder/even/w/slash directly
|
284
|
+
# This is not a UNIX-style "path."
|
285
|
+
#
|
286
|
+
# @return [GoogleDrive::File]
|
273
287
|
def file_by_title(title)
|
274
288
|
if title.is_a?(Array)
|
275
289
|
root_collection.file_by_title(title)
|
@@ -329,6 +343,7 @@ module GoogleDrive
|
|
329
343
|
# # https://docs.google.com/spreadsheets/d/1L3-kvwJblyW_TvjYD-7pE-AXxw5_bkb6S_MljuIPVL0/edit
|
330
344
|
# session.spreadsheet_by_key(
|
331
345
|
# "1L3-kvwJblyW_TvjYD-7pE-AXxw5_bkb6S_MljuIPVL0")
|
346
|
+
# @return [GoogleDrive::Spreadsheet]
|
332
347
|
def spreadsheet_by_key(key)
|
333
348
|
file = file_by_id(key)
|
334
349
|
unless file.is_a?(Spreadsheet)
|
@@ -48,6 +48,7 @@ module GoogleDrive
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# Returns worksheets of the spreadsheet as array of GoogleDrive::Worksheet.
|
51
|
+
# @return [Array<GoogleDrive::Worksheet>]
|
51
52
|
def worksheets
|
52
53
|
api_spreadsheet = @session.sheets_service.get_spreadsheet(id, fields: 'sheets.properties')
|
53
54
|
api_spreadsheet.sheets.map{ |s| Worksheet.new(@session, self, s.properties) }
|
@@ -635,7 +635,7 @@ module GoogleDrive
|
|
635
635
|
# {bottom: Google::Apis::SheetsV4::Border.new(
|
636
636
|
# style: "DOUBLE", color: GoogleDrive::Worksheet::Colors::BLACK)})
|
637
637
|
def update_borders(top_row, left_col, num_rows, num_cols, borders)
|
638
|
-
request = Google::Apis::SheetsV4::UpdateBordersRequest.new(borders)
|
638
|
+
request = Google::Apis::SheetsV4::UpdateBordersRequest.new(**borders)
|
639
639
|
request.range = v4_range_object(top_row, left_col, num_rows, num_cols)
|
640
640
|
add_request({update_borders: request})
|
641
641
|
end
|
@@ -1,53 +1,53 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
module GoogleDrive
|
4
|
-
|
5
|
-
class Cell
|
6
|
-
attr_reader :row, :col, :value
|
7
|
-
|
8
|
-
def initialize(worksheet, row, col, value)
|
9
|
-
@worksheet = worksheet
|
10
|
-
@row = row
|
11
|
-
@col = col
|
12
|
-
@value = value
|
13
|
-
end
|
14
|
-
|
15
|
-
#
|
16
|
-
# === 等価性
|
17
|
-
#
|
18
|
-
def ==(other)
|
19
|
-
case other
|
20
|
-
when GoogleDrive::Cell
|
21
|
-
@value == other.value
|
22
|
-
else
|
23
|
-
@value == other
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_s
|
28
|
-
value.to_s
|
29
|
-
end
|
30
|
-
|
31
|
-
def encoding
|
32
|
-
value.respond_to?(:encoding) ? value.encoding : nil
|
33
|
-
end
|
34
|
-
|
35
|
-
def background_color=(color)
|
36
|
-
@worksheet.set_background_color(@row, @col, 1, 1, color)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
module WorksheetFormatting
|
42
|
-
|
43
|
-
def set_background_color_at(row, col, color)
|
44
|
-
set_background_color(row, col, 1, 1, color)
|
45
|
-
end
|
46
|
-
|
47
|
-
def set_bold(row, col, enable = true)
|
48
|
-
# 太字設定
|
49
|
-
end
|
50
|
-
|
51
|
-
# ... 他にも text_color, font_size など拡張しやすい
|
52
|
-
end
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
module GoogleDrive
|
4
|
+
|
5
|
+
class Cell
|
6
|
+
attr_reader :row, :col, :value
|
7
|
+
|
8
|
+
def initialize(worksheet, row, col, value)
|
9
|
+
@worksheet = worksheet
|
10
|
+
@row = row
|
11
|
+
@col = col
|
12
|
+
@value = value
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# === 等価性
|
17
|
+
#
|
18
|
+
def ==(other)
|
19
|
+
case other
|
20
|
+
when GoogleDrive::Cell
|
21
|
+
@value == other.value
|
22
|
+
else
|
23
|
+
@value == other
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_s
|
28
|
+
@value.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
def encoding
|
32
|
+
@value.respond_to?(:encoding) ? value.encoding : nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def background_color=(color)
|
36
|
+
@worksheet.set_background_color(@row, @col, 1, 1, color)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
module WorksheetFormatting
|
42
|
+
|
43
|
+
def set_background_color_at(row, col, color)
|
44
|
+
set_background_color(row, col, 1, 1, color)
|
45
|
+
end
|
46
|
+
|
47
|
+
def set_bold(row, col, enable = true)
|
48
|
+
# 太字設定
|
49
|
+
end
|
50
|
+
|
51
|
+
# ... 他にも text_color, font_size など拡張しやすい
|
52
|
+
end
|
53
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_drive_maintained
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Ichikawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.18'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 2.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
29
|
+
version: '1.18'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.0.0
|
@@ -34,62 +34,44 @@ dependencies:
|
|
34
34
|
name: google-apis-drive_v3
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0.5'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
39
|
+
version: 0.63.0
|
43
40
|
type: :runtime
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0.5'
|
50
44
|
- - ">="
|
51
45
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.
|
46
|
+
version: 0.63.0
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
48
|
name: google-apis-sheets_v4
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|
56
50
|
requirements:
|
57
|
-
- - "~>"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '0.4'
|
60
51
|
- - ">="
|
61
52
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
53
|
+
version: 0.42.0
|
63
54
|
type: :runtime
|
64
55
|
prerelease: false
|
65
56
|
version_requirements: !ruby/object:Gem::Requirement
|
66
57
|
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0.4'
|
70
58
|
- - ">="
|
71
59
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.
|
60
|
+
version: 0.42.0
|
73
61
|
- !ruby/object:Gem::Dependency
|
74
62
|
name: googleauth
|
75
63
|
requirement: !ruby/object:Gem::Requirement
|
76
64
|
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: '0.5'
|
80
65
|
- - ">="
|
81
66
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
67
|
+
version: '1.14'
|
83
68
|
type: :runtime
|
84
69
|
prerelease: false
|
85
70
|
version_requirements: !ruby/object:Gem::Requirement
|
86
71
|
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.5'
|
90
72
|
- - ">="
|
91
73
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
74
|
+
version: '1.14'
|
93
75
|
- !ruby/object:Gem::Dependency
|
94
76
|
name: test-unit
|
95
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,22 +96,16 @@ dependencies:
|
|
114
96
|
name: rake
|
115
97
|
requirement: !ruby/object:Gem::Requirement
|
116
98
|
requirements:
|
117
|
-
- - "~>"
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0.8'
|
120
99
|
- - ">="
|
121
100
|
- !ruby/object:Gem::Version
|
122
|
-
version: 0.
|
101
|
+
version: 13.0.3
|
123
102
|
type: :development
|
124
103
|
prerelease: false
|
125
104
|
version_requirements: !ruby/object:Gem::Requirement
|
126
105
|
requirements:
|
127
|
-
- - "~>"
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: '0.8'
|
130
106
|
- - ">="
|
131
107
|
- !ruby/object:Gem::Version
|
132
|
-
version: 0.
|
108
|
+
version: 13.0.3
|
133
109
|
- !ruby/object:Gem::Dependency
|
134
110
|
name: rspec-mocks
|
135
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,7 +158,12 @@ files:
|
|
182
158
|
homepage: https://github.com/y-bonfire/google-drive-ruby-maintained
|
183
159
|
licenses:
|
184
160
|
- BSD-3-Clause
|
185
|
-
metadata:
|
161
|
+
metadata:
|
162
|
+
homepage_uri: https://github.com/y-bonfire/google-drive-ruby-maintained
|
163
|
+
source_code_uri: https://github.com/y-bonfire/google-drive-ruby-maintained
|
164
|
+
changelog_uri: https://github.com/y-bonfire/google-drive-ruby-maintained/blob/main/CHANGELOG.md
|
165
|
+
bug_tracker_uri: https://github.com/y-bonfire/google-drive-ruby-maintained/issues
|
166
|
+
documentation_uri: https://rubydoc.info/gems/google_drive_ruby_maintained
|
186
167
|
post_install_message:
|
187
168
|
rdoc_options: []
|
188
169
|
require_paths:
|
@@ -191,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
172
|
requirements:
|
192
173
|
- - ">="
|
193
174
|
- !ruby/object:Gem::Version
|
194
|
-
version: 3.
|
175
|
+
version: '3.1'
|
195
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
177
|
requirements:
|
197
178
|
- - ">="
|