Class: ModelToGooglesheet::Configuration

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

Constant Summary collapse

OPTIONS =
[ 
	:client_id, :client_secret, :refresh_token,
	:spreadsheet, :worksheet, 
	:convert_with, 
	:update, :find_by
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

defaults



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/model_to_googlesheet.rb', line 47

def initialize
	@client_id     = nil
	@client_secret = nil
	@refresh_token = nil
	@spreadsheet   = nil
	@worksheet     = nil
	@convert_with  = nil   #optional
	@update        = false #optional, will only be applied to separate records. 
		#if set to true, finds a record in a sheet by :id and updates it. 
		#if set to :symbol, finds a record in a sheet by :symbol and updates it
	@find_by       = :id
end

Class Method Details

.merge_configs(permethod_options, permodel_configuration) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/model_to_googlesheet.rb', line 60

def self.merge_configs permethod_options, permodel_configuration
	options = ActiveSupport::HashWithIndifferentAccess.new permethod_options
	ModelToGooglesheet::Configuration::OPTIONS.each do |option_name|
		options[option_name] ||= permodel_configuration.send(option_name)
	end
	options
end