Class: Cartos::Google::Spreadsheet
- Inherits:
-
Object
- Object
- Cartos::Google::Spreadsheet
- Defined in:
- lib/cartos/google/spreadsheet.rb
Instance Method Summary collapse
-
#initialize(key) ⇒ Spreadsheet
constructor
A new instance of Spreadsheet.
- #new_sheet(name) ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(key) ⇒ Spreadsheet
Returns a new instance of Spreadsheet.
6 7 8 9 |
# File 'lib/cartos/google/spreadsheet.rb', line 6 def initialize(key) @session = GoogleDrive.login Cartos.config.google_spreadsheet.username, Cartos.config.google_spreadsheet.password @spreadsheet = @session.spreadsheet_by_key key end |
Instance Method Details
#new_sheet(name) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cartos/google/spreadsheet.rb', line 11 def new_sheet(name) worksheet = @spreadsheet.worksheet_by_title name.to_s worksheet.delete unless worksheet.nil? worksheet = @spreadsheet.add_worksheet name Cartos::Google::Sheet.new worksheet end |
#url ⇒ Object
19 20 21 |
# File 'lib/cartos/google/spreadsheet.rb', line 19 def url @spreadsheet.human_url end |