Class: AdLocalize::Requests::GSpreadsheetOptions
- Inherits:
-
Object
- Object
- AdLocalize::Requests::GSpreadsheetOptions
- Defined in:
- lib/ad_localize/requests/g_spreadsheet_options.rb
Instance Attribute Summary collapse
-
#export_all ⇒ Object
Returns the value of attribute export_all.
-
#service_account_config ⇒ Object
Returns the value of attribute service_account_config.
-
#sheet_ids ⇒ Object
Returns the value of attribute sheet_ids.
-
#spreadsheet_id ⇒ Object
Returns the value of attribute spreadsheet_id.
Instance Method Summary collapse
- #has_multiple_sheets? ⇒ Boolean
-
#initialize(**args) ⇒ GSpreadsheetOptions
constructor
A new instance of GSpreadsheetOptions.
- #public_download_urls ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(**args) ⇒ GSpreadsheetOptions
Returns a new instance of GSpreadsheetOptions.
11 12 13 14 15 16 |
# File 'lib/ad_localize/requests/g_spreadsheet_options.rb', line 11 def initialize(**args) @spreadsheet_id = args[:spreadsheet_id] @sheet_ids = Array(args[:sheet_ids]) @export_all = args[:export_all] || false @service_account_config = args[:service_account_config].presence end |
Instance Attribute Details
#export_all ⇒ Object
Returns the value of attribute export_all.
4 5 6 |
# File 'lib/ad_localize/requests/g_spreadsheet_options.rb', line 4 def export_all @export_all end |
#service_account_config ⇒ Object
Returns the value of attribute service_account_config.
4 5 6 |
# File 'lib/ad_localize/requests/g_spreadsheet_options.rb', line 4 def service_account_config @service_account_config end |
#sheet_ids ⇒ Object
Returns the value of attribute sheet_ids.
4 5 6 |
# File 'lib/ad_localize/requests/g_spreadsheet_options.rb', line 4 def sheet_ids @sheet_ids end |
#spreadsheet_id ⇒ Object
Returns the value of attribute spreadsheet_id.
4 5 6 |
# File 'lib/ad_localize/requests/g_spreadsheet_options.rb', line 4 def spreadsheet_id @spreadsheet_id end |
Instance Method Details
#has_multiple_sheets? ⇒ Boolean
31 32 33 |
# File 'lib/ad_localize/requests/g_spreadsheet_options.rb', line 31 def has_multiple_sheets? export_all || @sheet_ids.size > 1 end |
#public_download_urls ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/ad_localize/requests/g_spreadsheet_options.rb', line 22 def public_download_urls return [] if @service_account_config if @sheet_ids.size.zero? [public_download_url(sheet_id: nil)] else @sheet_ids.map { |sheet_id| public_download_url(sheet_id: sheet_id) } end end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/ad_localize/requests/g_spreadsheet_options.rb', line 18 def valid? (spreadsheet_id && !export_all) || (spreadsheet_id && service_account_config.present?) end |