googlesheets 0.6.1 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/shat +32 -0
  3. data/lib/googlesheets.rb +8 -1
  4. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6a26194973635e4ea51c7926c8cd03f900855b5c1776f517b0bbec78ac2b375
4
- data.tar.gz: 801e67399e5c075742fe11913e6c9d996eb32f6fca24d7617fd4dfc17c2984e5
3
+ metadata.gz: 337343bcb13d2a791f5aee8a239ce9f6fb176d9844da5d2d672efd98d21974d5
4
+ data.tar.gz: 68006ba26a382e5599a95822731e55261b7bb10b871c3536ecf4a2f0671d4755
5
5
  SHA512:
6
- metadata.gz: fd5432ce50b9d6528b444db90beda6d4b561b3b430fc8cac3a07dd3b4b3d8417f1fbdd84ff58ec18b19d8b3c520644febace35b3610b32e6c9a661abe615ec53
7
- data.tar.gz: c2019272c6b2a079a33d1d6a831f2692ae6da0a195a46728a04524df742053e2691b3587ce01f3c01ef334fb44fe4314814950525c3f2bcdd3697f4b1dade097
6
+ metadata.gz: 250b28e880607001b70f71a1f417325cd73c301fe4cad19af54e390f17e08630dd9e7a44a2aaa537646d64c2bc8e0571aeadda02e3929561b88232f581700e04
7
+ data.tar.gz: 3e302a8611cd632225afac79f038ef000d3ea286e872de931640d43786b3de2acd7c325e9540a932be9b02dc6fc456f03b7dfb2e29092c0fa65703499990e9ff
data/bin/shat ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ version="0.0.1"
4
+
5
+ STDOUT.sync = true
6
+
7
+ begin
8
+ require "censive"
9
+ rescue LoadError
10
+ abort "#{File.basename($0)} needs another gem, run 'gem install censive'"
11
+ end
12
+
13
+ require "googlesheets"
14
+ require "optparse"
15
+
16
+ trap("INT" ) { abort "\n" }
17
+
18
+ OptionParser.new.instance_eval do
19
+ @banner = "usage: #{program_name} [options] <url>"
20
+
21
+ on "-h", "--help" , "Show help and command usage" do Kernel.abort to_s; end
22
+ on "-v", "--version" , "Show version number" do Kernel.abort "#{program_name} #{version}"; end
23
+
24
+ self
25
+ end.parse!(into: opts={}) rescue abort($!.message)
26
+
27
+ link = ARGV.shift or abort("no url provided")
28
+
29
+ goog = GoogleSheets.new(link)
30
+ rows = goog.sheet_read
31
+
32
+ Censive.writer {|csv| rows.each {|row| csv << row }}
data/lib/googlesheets.rb CHANGED
@@ -11,8 +11,15 @@ require "google/apis/sheets_v4"
11
11
  require "googleauth"
12
12
  require "googleauth/stores/file_token_store"
13
13
 
14
+ class Object
15
+ def blank?
16
+ respond_to?(:empty?) or return !self
17
+ empty? or respond_to?(:strip) && strip.empty?
18
+ end unless defined? blank?
19
+ end
20
+
14
21
  class GoogleSheets
15
- VERSION = "0.6.1"
22
+ VERSION = "0.6.3"
16
23
 
17
24
  attr_accessor :api
18
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: googlesheets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve
@@ -26,13 +26,15 @@ dependencies:
26
26
  version: 0.53.0
27
27
  description: This gem allows easy access to Google Sheets API V4.
28
28
  email: steve.shreeve@gmail.com
29
- executables: []
29
+ executables:
30
+ - shat
30
31
  extensions: []
31
32
  extra_rdoc_files: []
32
33
  files:
33
34
  - Gemfile
34
35
  - LICENSE
35
36
  - README.md
37
+ - bin/shat
36
38
  - googlesheets.gemspec
37
39
  - lib/googlesheets.rb
38
40
  homepage: https://github.com/shreeve/googlesheets