uptime_reports_spreadsheet 0.1.0.pre.beta

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f31dcfb2c834856ce4b5d7b79dc7819484979bf1
4
+ data.tar.gz: 9d68f06a64a8d400e0e5d9e112d5ff51784b0c98
5
+ SHA512:
6
+ metadata.gz: 82f03f4a3dd0d114896641697d927e09c7f66ec484a49b96a0870f2acd12c376d7d08f4b947ee7ec33da42f9b271eab88550d5caa52d8fc37d2979b761716149
7
+ data.tar.gz: daebba01f21f16056dcbec9ca06f487eb725f734d4224a6d45e0fb1c4fa8440c6ee03f7b815d4696385fe43a606b14c796f1a84446b9e57c631bbabd49ece5d1
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.swp
13
+ *.swo
14
+ /client_secret.json
15
+ /.env
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.16.0.pre.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at dlagos@bookingbug.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in uptime_reports_spreadsheet.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ uptime_reports_spreadsheet (0.1.0)
5
+ byebug (~> 9.1)
6
+ dotenv (~> 2.2)
7
+ google-api-client (~> 0.16)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.5.2)
13
+ public_suffix (>= 2.0.2, < 4.0)
14
+ byebug (9.1.0)
15
+ declarative (0.0.10)
16
+ declarative-option (0.1.0)
17
+ diff-lcs (1.3)
18
+ dotenv (2.2.1)
19
+ faraday (0.13.1)
20
+ multipart-post (>= 1.2, < 3)
21
+ google-api-client (0.16.0)
22
+ addressable (~> 2.5, >= 2.5.1)
23
+ googleauth (>= 0.5, < 0.7.0)
24
+ httpclient (>= 2.8.1, < 3.0)
25
+ mime-types (~> 3.0)
26
+ representable (~> 3.0)
27
+ retriable (>= 2.0, < 4.0)
28
+ googleauth (0.6.1)
29
+ faraday (~> 0.12)
30
+ jwt (>= 1.4, < 3.0)
31
+ logging (~> 2.0)
32
+ memoist (~> 0.12)
33
+ multi_json (~> 1.11)
34
+ os (~> 0.9)
35
+ signet (~> 0.7)
36
+ httpclient (2.8.3)
37
+ jwt (2.1.0)
38
+ little-plugger (1.1.4)
39
+ logging (2.2.2)
40
+ little-plugger (~> 1.1)
41
+ multi_json (~> 1.10)
42
+ memoist (0.16.0)
43
+ mime-types (3.1)
44
+ mime-types-data (~> 3.2015)
45
+ mime-types-data (3.2016.0521)
46
+ multi_json (1.12.2)
47
+ multipart-post (2.0.0)
48
+ os (0.9.6)
49
+ public_suffix (3.0.0)
50
+ rake (10.5.0)
51
+ representable (3.0.4)
52
+ declarative (< 0.1.0)
53
+ declarative-option (< 0.2.0)
54
+ uber (< 0.2.0)
55
+ retriable (3.1.1)
56
+ rspec (3.7.0)
57
+ rspec-core (~> 3.7.0)
58
+ rspec-expectations (~> 3.7.0)
59
+ rspec-mocks (~> 3.7.0)
60
+ rspec-core (3.7.0)
61
+ rspec-support (~> 3.7.0)
62
+ rspec-expectations (3.7.0)
63
+ diff-lcs (>= 1.2.0, < 2.0)
64
+ rspec-support (~> 3.7.0)
65
+ rspec-mocks (3.7.0)
66
+ diff-lcs (>= 1.2.0, < 2.0)
67
+ rspec-support (~> 3.7.0)
68
+ rspec-support (3.7.0)
69
+ signet (0.8.1)
70
+ addressable (~> 2.3)
71
+ faraday (~> 0.9)
72
+ jwt (>= 1.5, < 3.0)
73
+ multi_json (~> 1.10)
74
+ uber (0.1.0)
75
+
76
+ PLATFORMS
77
+ ruby
78
+
79
+ DEPENDENCIES
80
+ bundler (~> 1.16.a)
81
+ rake (~> 10.0)
82
+ rspec (~> 3.0)
83
+ uptime_reports_spreadsheet!
84
+
85
+ BUNDLED WITH
86
+ 1.16.0.pre.3
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # UptimeReportsSpreadsheet
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/uptime_reports_spreadsheet`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'uptime_reports_spreadsheet'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install uptime_reports_spreadsheet
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/uptime_reports_spreadsheet. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the UptimeReportsSpreadsheet project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/uptime_reports_spreadsheet/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "uptime_reports_spreadsheet"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,55 @@
1
+ require 'google/apis/sheets_v4'
2
+ require 'googleauth'
3
+ require 'googleauth/stores/file_token_store'
4
+
5
+ require 'fileutils'
6
+ module UptimeReportsSpreadsheet
7
+
8
+ class Auth
9
+
10
+ OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'
11
+ APPLICATION_NAME = 'Google Sheets API Ruby Quickstart'
12
+ CLIENT_SECRETS_PATH = 'client_secret.json'
13
+ CREDENTIALS_PATH = File.join(Dir.home, '.credentials',
14
+ "sheets.googleapis.com-ruby-quickstart.yaml")
15
+ SCOPE = Google::Apis::SheetsV4::AUTH_SPREADSHEETS_READONLY
16
+
17
+ ##
18
+ # Ensure valid credentials, either by restoring from the saved credentials
19
+ # files or intitiating an OAuth2 authorization. If authorization is required,
20
+ # the user's default browser will be launched to approve the request.
21
+ #
22
+ # @return [Google::Auth::UserRefreshCredentials] OAuth2 credentials
23
+ def authorize
24
+ FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))
25
+
26
+ client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)
27
+ token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)
28
+ authorizer = Google::Auth::UserAuthorizer.new(
29
+ client_id, SCOPE, token_store)
30
+ user_id = 'default'
31
+ credentials = authorizer.get_credentials(user_id)
32
+ if credentials.nil?
33
+ #url = authorizer.get_authorization_url(base_url: OOB_URI)
34
+ code = ENV['GOOGLE_API_AUTH_CODE']
35
+ credentials = authorizer.get_and_store_credentials_from_code(
36
+ user_id: user_id, code: code, base_url: OOB_URI)
37
+ end
38
+ credentials
39
+ end
40
+
41
+ def sample
42
+ # Initialize the API
43
+ service = Google::Apis::SheetsV4::SheetsService.new
44
+ service.client_options.application_name = APPLICATION_NAME
45
+ service.authorization = authorize
46
+
47
+ # Prints the names and majors of students in a sample spreadsheet:
48
+ # https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
49
+ spreadsheet_id = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms'
50
+ range = 'Class Data!A2:E'
51
+ response = service.get_spreadsheet_values(spreadsheet_id, range)
52
+ response.values
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,3 @@
1
+ module UptimeReportsSpreadsheet
2
+ VERSION = "0.1.0-beta"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "uptime_reports_spreadsheet/version"
2
+ require "uptime_reports_spreadsheet/auth"
3
+ require 'dotenv/load'
4
+
5
+ module UptimeReportsSpreadsheet
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,40 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "uptime_reports_spreadsheet/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+
8
+ url="https://rubygems.org"
9
+ spec.name = "uptime_reports_spreadsheet"
10
+ spec.version = UptimeReportsSpreadsheet::VERSION
11
+ spec.authors = ["Diego H Piccinini Lagos"]
12
+ spec.email = ["dlagos@bookingbug.com"]
13
+
14
+ spec.summary = %q{ Write spreadsheet in Google. }
15
+ spec.description = %q{ Get a report and write it in a google sheet. }
16
+ spec.homepage = "#{url}/docs/bbeng/index.html"
17
+
18
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
20
+ if spec.respond_to?(:metadata)
21
+ spec.metadata["allowed_push_host"] = url
22
+ else
23
+ raise "RubyGems 2.0 or newer is required to protect against " \
24
+ "public gem pushes."
25
+ end
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features)/})
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency "bundler", "~> 1.16.a"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_dependency "google-api-client", "~> 0.16"
38
+ spec.add_dependency "byebug", "~> 9.1"
39
+ spec.add_dependency "dotenv", "~> 2.2"
40
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: uptime_reports_spreadsheet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre.beta
5
+ platform: ruby
6
+ authors:
7
+ - Diego H Piccinini Lagos
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-11-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.16.a
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.16.a
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: google-api-client
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.16'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.16'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '9.1'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '9.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: dotenv
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.2'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.2'
97
+ description: " Get a report and write it in a google sheet. "
98
+ email:
99
+ - dlagos@bookingbug.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - Gemfile.lock
110
+ - README.md
111
+ - Rakefile
112
+ - bin/console
113
+ - bin/setup
114
+ - lib/uptime_reports_spreadsheet.rb
115
+ - lib/uptime_reports_spreadsheet/auth.rb
116
+ - lib/uptime_reports_spreadsheet/version.rb
117
+ - uptime_reports_spreadsheet.gemspec
118
+ homepage: https://rubygems.org/docs/bbeng/index.html
119
+ licenses: []
120
+ metadata:
121
+ allowed_push_host: https://rubygems.org
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">"
134
+ - !ruby/object:Gem::Version
135
+ version: 1.3.1
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.4.6
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: Write spreadsheet in Google.
142
+ test_files: []
143
+ has_rdoc: