Method: Ayadn::Settings.create_api_file

Defined in:
lib/ayadn/settings.rb

.create_api_fileObject



126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/ayadn/settings.rb', line 126

def self.create_api_file
  api_file = @config.paths.config + "/api.json"
  if File.exist?(api_file)
    # should be 48h in secs (172800)
    # but since ADN's API won't change any time soon...
    if ( File.ctime(api_file) < (Time.now - 604800) )
      self.new_api_file(api_file)
    end
  else
    self.new_api_file(api_file)
  end
  self.read_api(api_file)
end