Class: Locabulary::JsonCreator::GoogleSpreadsheet
- Inherits:
-
Object
- Object
- Locabulary::JsonCreator::GoogleSpreadsheet
- Defined in:
- lib/locabulary/json_creator.rb
Overview
Responsible for interacting with Google Sheets and retrieiving relevant information
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#document_key ⇒ Object
readonly
Returns the value of attribute document_key.
Instance Method Summary collapse
- #all_rows ⇒ Object
-
#initialize(document_key, access_token_fetcher = GoogleAccessTokenFetcher) ⇒ GoogleSpreadsheet
constructor
A new instance of GoogleSpreadsheet.
Constructor Details
#initialize(document_key, access_token_fetcher = GoogleAccessTokenFetcher) ⇒ GoogleSpreadsheet
Returns a new instance of GoogleSpreadsheet.
98 99 100 101 102 |
# File 'lib/locabulary/json_creator.rb', line 98 def initialize(document_key, access_token_fetcher = GoogleAccessTokenFetcher) @document_key = document_key @access_token = access_token_fetcher.call @session = GoogleDrive.login_with_oauth(access_token) end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
94 95 96 |
# File 'lib/locabulary/json_creator.rb', line 94 def access_token @access_token end |
#document_key ⇒ Object (readonly)
Returns the value of attribute document_key.
94 95 96 |
# File 'lib/locabulary/json_creator.rb', line 94 def document_key @document_key end |
Instance Method Details
#all_rows ⇒ Object
104 105 106 |
# File 'lib/locabulary/json_creator.rb', line 104 def all_rows session.spreadsheet_by_key(document_key).worksheets[0].rows end |