Class: SheetsDB::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/sheets_db/session.rb

Defined Under Namespace

Classes: IllegalDefaultError, NoDefaultSetError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(google_drive_session) ⇒ Session

Returns a new instance of Session.


26
27
28
# File 'lib/sheets_db/session.rb', line 26

def initialize(google_drive_session)
  @google_drive_session = google_drive_session
end

Class Method Details

.defaultObject


15
16
17
18
19
20
# File 'lib/sheets_db/session.rb', line 15

def self.default
  unless @default
    raise NoDefaultSetError.new("No default Session defined yet")
  end
  @default
end

.default=(default) ⇒ Object


8
9
10
11
12
13
# File 'lib/sheets_db/session.rb', line 8

def self.default=(default)
  unless default.is_a?(self)
    raise IllegalDefaultError.new("Default must be a SheetsDB::Session")
  end
  @default = default
end

.from_service_account_key(*args) ⇒ Object


22
23
24
# File 'lib/sheets_db/session.rb', line 22

def self.(*args)
  new(GoogleDrive::Session.(*args))
end

Instance Method Details

#raw_file_by_id(id) ⇒ Object


30
31
32
# File 'lib/sheets_db/session.rb', line 30

def raw_file_by_id(id)
  @google_drive_session.file_by_id(id)
end