Class: UptimeReportsSpreadsheet::Spreadsheet
- Inherits:
-
Object
- Object
- UptimeReportsSpreadsheet::Spreadsheet
- Defined in:
- lib/uptime_reports_spreadsheet/spreadsheet.rb
Instance Attribute Summary collapse
-
#auth ⇒ Object
Returns the value of attribute auth.
-
#response ⇒ Object
Returns the value of attribute response.
-
#service ⇒ Object
Returns the value of attribute service.
-
#spreadsheet ⇒ Object
Returns the value of attribute spreadsheet.
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
-
#initialize(scopes = [1,4]) ⇒ Spreadsheet
constructor
A new instance of Spreadsheet.
- #sample ⇒ Object
- #set_title(title) ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(scopes = [1,4]) ⇒ Spreadsheet
Returns a new instance of Spreadsheet.
10 11 12 13 14 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 10 def initialize scopes=[1,4] @auth=UptimeReportsSpreadsheet::Auth.new scopes @service=auth.service end |
Instance Attribute Details
#auth ⇒ Object
Returns the value of attribute auth.
8 9 10 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 8 def auth @auth end |
#response ⇒ Object
Returns the value of attribute response.
8 9 10 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 8 def response @response end |
#service ⇒ Object
Returns the value of attribute service.
8 9 10 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 8 def service @service end |
#spreadsheet ⇒ Object
Returns the value of attribute spreadsheet.
8 9 10 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 8 def spreadsheet @spreadsheet end |
Instance Method Details
#create ⇒ Object
25 26 27 28 29 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 25 def create service. = auth. request_body = Google::Apis::SheetsV4::Spreadsheet.new @spreadsheet = service.create_spreadsheet(request_body) end |
#delete ⇒ Object
39 40 41 42 43 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 39 def delete service = Google::Apis::DriveV3::DriveService.new service. = auth. service.delete_file spreadsheet.spreadsheet_id end |
#sample ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 16 def sample service. = auth. spreadsheet_id = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms' range = 'Class Data!A2:E' response = service.get_spreadsheet_values(spreadsheet_id, range) response.values end |
#set_title(title) ⇒ Object
31 32 33 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 31 def set_title title spreadsheet.properties.update!(title: title) end |
#title ⇒ Object
35 36 37 |
# File 'lib/uptime_reports_spreadsheet/spreadsheet.rb', line 35 def title spreadsheet.properties.title end |