pairing_shuffler 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pairing_shuffler.rb +13 -1
- data/lib/pairing_shuffler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e227ced227d2340266cfd34527e956b67b138c6c
|
4
|
+
data.tar.gz: e7686af00f3c54517105810d1fc2a80d0bb40de3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b3c0a3deb5cdca33ed9cc47fb07b72f0d4c5767537d8e9a899ddc03a3cb92a9fa4b8760c33ef2491d8150be298ef1fd582b2b09740163e95af8a6c95ee1eb2d
|
7
|
+
data.tar.gz: 8c6792860a4d527c31c288f67b8cf0404c502417a5b34133925f570a819565480547473c9886194ddc05f2cde88edcd24e6c1ffa1642a72a0dcc24b2d88eb3fc
|
data/lib/pairing_shuffler.rb
CHANGED
@@ -26,7 +26,7 @@ module PairingShuffler
|
|
26
26
|
|
27
27
|
def content
|
28
28
|
@content ||= begin
|
29
|
-
session = GoogleDrive.login_with_oauth(
|
29
|
+
session = GoogleDrive.login_with_oauth(access_token)
|
30
30
|
cells = session.spreadsheet_by_key(@config[:doc]).worksheets[0].cells
|
31
31
|
data = []
|
32
32
|
cells.each do |(row, column), value|
|
@@ -37,6 +37,18 @@ module PairingShuffler
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
def access_token
|
41
|
+
params = {
|
42
|
+
:client_id => @config.fetch(:client_id),
|
43
|
+
:client_secret => @config.fetch(:client_secret),
|
44
|
+
:refresh_token => @config.fetch(:refresh_token),
|
45
|
+
:grant_type => "refresh_token"
|
46
|
+
}.map { |k, v| "-d '#{k}=#{v}'" }.join(" ")
|
47
|
+
response = `curl https://accounts.google.com/o/oauth2/token --silent -X POST #{params}`
|
48
|
+
raise "FAILED: #{response}" unless $?.success?
|
49
|
+
JSON.load(response).fetch("access_token")
|
50
|
+
end
|
51
|
+
|
40
52
|
def list
|
41
53
|
emails = content.compact.select { |row| row.first.include?("@") && present?(row) }.map(&:first)
|
42
54
|
emails.sort_by{ rand }.each_slice(2).to_a.reject { |group| group.size == 1 }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pairing_shuffler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google_drive
|