gslide 0.1.2 → 0.1.3
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/CHANGELOG.md +4 -0
- data/lib/gslide/concerns/requests.rb +2 -0
- data/lib/gslide/models/presentation.rb +9 -2
- data/lib/gslide/models/spreadsheet.rb +19 -1
- data/lib/gslide/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8fe444ca4bdef588c1e0aadf54db33d2024612b4d3450c4da243bd7ea3538055
|
|
4
|
+
data.tar.gz: 5416cb52420d81d5c5f8e4f99a13d2745e405a372c780314debb67c64e4c1b61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5477601ab8d237e62853bf974c1e3961fbd60e5197822754cdfe1d903a2bc37983395c412b674b27c8405fa3883d6b48291b384c49a619c7c4334f7bab719256
|
|
7
|
+
data.tar.gz: 518e86e5a3ececa73d696c737f3d0672f21fae300f5e57b2aa53c1de8fde8a9d925e1cadbbfd3c2048d9af90d41a3cd0765cd61f445bd9a78bc39c1183aafccd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [0.1.3] - 2026-08-19
|
|
2
|
+
|
|
3
|
+
- Add `Gslide::Presentation::PRESENTATION_ID_PATTERN` and `Gslide::Presentation.file_id_in`, so callers can validate a presentation id without repeating the pattern
|
|
4
|
+
|
|
1
5
|
## [0.1.2] - 2025-05-09
|
|
2
6
|
|
|
3
7
|
- Add `Gslide::HTTPError`, `Gslide::UnauthorizedError` and `Gslide::QuotaExceededError` #10
|
|
@@ -7,10 +7,17 @@ module Gslide
|
|
|
7
7
|
|
|
8
8
|
attr_reader :id
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
PRESENTATION_ID_PATTERN = /[a-zA-Z0-9\-_]+/
|
|
11
|
+
PRESENTATION_PATTERN = %r[/presentation/d/(#{PRESENTATION_ID_PATTERN})?]
|
|
12
|
+
|
|
13
|
+
# @param [String] id_or_url a presentation id, or a sharing url holding one.
|
|
14
|
+
# @return [String] the presentation id, or the argument when it is not a url.
|
|
15
|
+
def self.file_id_in(id_or_url)
|
|
16
|
+
(url_id = id_or_url.match(PRESENTATION_PATTERN)) ? url_id[1] : id_or_url
|
|
17
|
+
end
|
|
11
18
|
|
|
12
19
|
def initialize(id_or_url, auth: nil)
|
|
13
|
-
@id = (
|
|
20
|
+
@id = self.class.file_id_in(id_or_url)
|
|
14
21
|
@auth = auth
|
|
15
22
|
end
|
|
16
23
|
|
|
@@ -40,6 +40,23 @@ module Gslide
|
|
|
40
40
|
parsed_body = get
|
|
41
41
|
parsed_body[:sheets].collect { |h| Sheet.new(h) }
|
|
42
42
|
end
|
|
43
|
+
|
|
44
|
+
# @param [Hash] options the request body.
|
|
45
|
+
# @see https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/append
|
|
46
|
+
def values_append(notation, options = {})
|
|
47
|
+
uri = url_escape_uri(GOOGLE_SHEETS + "/#{@id}/values/'#{notation}':append?valueInputOption=USER_ENTERED")
|
|
48
|
+
request_body = options.convert_keys { |k| k.to_s.lower_camel_case }.to_json
|
|
49
|
+
|
|
50
|
+
response_body = post_request(uri, auth_token: @auth.token, body: request_body)
|
|
51
|
+
response_body
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def url_escape_uri(uri_string)
|
|
57
|
+
parser = URI::Parser.new
|
|
58
|
+
URI parser.escape(uri_string)
|
|
59
|
+
end
|
|
43
60
|
end
|
|
44
61
|
|
|
45
62
|
class SpreadsheetDraft
|
|
@@ -61,10 +78,11 @@ module Gslide
|
|
|
61
78
|
end
|
|
62
79
|
|
|
63
80
|
class Sheet
|
|
64
|
-
attr_reader :id, :charts
|
|
81
|
+
attr_reader :id, :title, :charts
|
|
65
82
|
|
|
66
83
|
def initialize(options = {})
|
|
67
84
|
@id = options[:properties][:sheet_id]
|
|
85
|
+
@title = options[:properties][:title]
|
|
68
86
|
@charts = options[:charts].collect { |h| Chart.new(h) } if options[:charts]
|
|
69
87
|
end
|
|
70
88
|
end
|
data/lib/gslide/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gslide
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kang-Kyu Lee
|
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '0'
|
|
54
54
|
requirements: []
|
|
55
|
-
rubygems_version:
|
|
55
|
+
rubygems_version: 4.0.6
|
|
56
56
|
specification_version: 4
|
|
57
57
|
summary: Google Slides API client.
|
|
58
58
|
test_files: []
|