googlesheets 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/googlesheets.gemspec +1 -1
- data/lib/googlesheets.rb +16 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf746361c54702e6e6045cc2f50709116f5f03605d7e7031501fc328211a158a
|
4
|
+
data.tar.gz: 7d619e57b7c3795c45db5f6105f9ba5ffd12840f329e4d53f740da98b3f7f7ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 439768572b8ee44f0effce13a375c03ece7a65e4df406dbb2ddcff705b1dcf5b9933ef0f1d7bc118bad548b0d3181816ee0d2f87698993099146fb1862bb1b0a
|
7
|
+
data.tar.gz: 8601bc53985319b1e087dd00ee3f32ca7a8c8022e30813ea6131bbe9dc3d4ffb89ea33ae52b4b995811ad6e7586cd3d7db674f75ffb62e3405c55d590c4ac4aa
|
data/README.md
CHANGED
data/googlesheets.gemspec
CHANGED
data/lib/googlesheets.rb
CHANGED
@@ -70,6 +70,19 @@ class GoogleSheets
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
def filter_criteria(hash)
|
74
|
+
hash.inject({}) do |h, (k,v)|
|
75
|
+
l = Array(v)
|
76
|
+
h[biject(k.to_s) - 1] = {
|
77
|
+
condition: {
|
78
|
+
type: "TEXT_EQ",
|
79
|
+
values: l.map {|e| { user_entered_value: e} },
|
80
|
+
}
|
81
|
+
}
|
82
|
+
h
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
73
86
|
def range(area)
|
74
87
|
sh, rc = area.split('!', 2); rc, sh = sh, nil if sh.nil?
|
75
88
|
as, ae = rc.split(':', 2); ae ||= as
|
@@ -132,11 +145,12 @@ class GoogleSheets
|
|
132
145
|
true
|
133
146
|
end
|
134
147
|
|
135
|
-
def sheet_filter(area)
|
148
|
+
def sheet_filter(area, want=nil)
|
136
149
|
range = range(area)
|
150
|
+
criteria = filter_criteria(want) if want
|
137
151
|
reqs = []
|
138
152
|
reqs.push(clear_basic_filter: { sheet_id: range[:sheet_id] })
|
139
|
-
reqs.push(set_basic_filter: { filter: { range: range } })
|
153
|
+
reqs.push(set_basic_filter: { filter: { range: range, criteria: criteria}.compact })
|
140
154
|
resp = api.batch_update_spreadsheet(@ssid, { requests: reqs }, {})
|
141
155
|
true
|
142
156
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googlesheets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem allows easy access to Google Sheets API V4.
|
14
14
|
email: steve.shreeve@gmail.com
|
@@ -26,7 +26,7 @@ homepage: https://github.com/shreeve/googlesheets
|
|
26
26
|
licenses:
|
27
27
|
- MIT
|
28
28
|
metadata: {}
|
29
|
-
post_install_message:
|
29
|
+
post_install_message:
|
30
30
|
rdoc_options: []
|
31
31
|
require_paths:
|
32
32
|
- lib
|
@@ -41,8 +41,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
requirements: []
|
44
|
-
rubygems_version: 3.1.
|
45
|
-
signing_key:
|
44
|
+
rubygems_version: 3.1.4
|
45
|
+
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Ruby gem for Google Sheets
|
48
48
|
test_files: []
|