Module: Trello::TrelloConfig

Included in:
Api::Integration, Api::Trello, Main
Defined in:
lib/trello/trello_config.rb

Instance Method Summary collapse

Instance Method Details

#__config_dir__Object



19
20
21
# File 'lib/trello/trello_config.rb', line 19

def __config_dir__
  @config_dir
end

#configObject



3
4
5
# File 'lib/trello/trello_config.rb', line 3

def config
  @config ||= load_config
end

#param_check(field, message) ⇒ Object



13
14
15
16
17
# File 'lib/trello/trello_config.rb', line 13

def param_check(field, message)
  unless config[field]
    abort message
  end
end

#save_configObject



7
8
9
10
11
# File 'lib/trello/trello_config.rb', line 7

def save_config
  # need to fetch the config first to make sure its directory is properly defined
  current_config = config
  File.open("#{@config_dir}/#{CONFIG_FILE_NAME}" || CONFIG_FILE_NAME, 'w') {|f| f.write current_config.to_hash.to_yaml }
end