Module: Meteoservice::TownsData

Extended by:
Constants, NestedHashValue, ParserXml
Defined in:
lib/meteoservice/towns_data.rb

Constant Summary

Constants included from Constants

Constants::BASE_URL, Constants::CLOUDINESS, Constants::DAYS_OF_WEEK, Constants::KEYS_DATA, Constants::KEYS_LIMIT, Constants::KEYS_PHENOMENA, Constants::PRECIPITATION, Constants::RPOWER, Constants::SPOWER, Constants::WIND_DIRECTION

Class Method Summary collapse

Methods included from NestedHashValue

nested_hash_value

Methods included from ParserXml

connection

Class Method Details

.auto_process(city_index) ⇒ Object



33
34
35
36
37
# File 'lib/meteoservice/towns_data.rb', line 33

def auto_process(city_index)
  path = "/export/gismeteo/point/#{city_index}.xml"

  data_taking(path, city_index)
end

.processObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/meteoservice/towns_data.rb', line 10

def process
  catalogue = load

  puts "    \\n\u041F\u043E\u0433\u043E\u0434\u0443 \u0434\u043B\u044F \u043A\u0430\u043A\u043E\u0433\u043E \u0433\u043E\u0440\u043E\u0434\u0430 \u0412\u044B \u0445\u043E\u0442\u0438\u0442\u0435 \u0443\u0437\u043D\u0430\u0442\u044C?\n    \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0443\u043D\u0438\u043A\u0430\u043B\u044C\u043D\u044B\u0439 \u0438\u043D\u0434\u0435\u043A\u0441 \u0433\u043E\u0440\u043E\u0434\u0430 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \"enter\". \u0415\u0441\u043B\u0438 \u0432\u0430\u0448\u0435\u0433\u043E \u0433\u043E\u0440\u043E\u0434\u0430\#{' '}\n    \u043D\u0435\u0442 \u0432 \u0441\u043F\u0438\u0441\u043A\u0435, \u043F\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043F\u043E \u0441\u0441\u044B\u043B\u043A\u0435 https://www.meteoservice.ru/content/export.html,\n    \u043D\u0430\u0439\u0434\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u043C\u044B\u0439 \u0438\u043D\u0434\u0435\u043A\u0441 \u0438 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0435\u0433\u043E \u043D\u0438\u0436\u0435. \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u0433\u043E\u0440\u043E\u0434\u0430 \u0441 \u0438\u043D\u0434\u0435\u043A\u0441\u043E\u043C \u0434\u043E\u0431\u0430\u0432\u044F\u0442\u0441\u044F\n    \u0432 \u0441\u043F\u0438\u0441\u043E\u043A \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438:\\n\n  TOWNS\n\n  catalogue.sort_by { |_key, value| value }\n           .to_h.each_with_index { |name, index| puts \"\#{index + 1}: \#{name}\" }\n\n  city_index = gets.to_i\n  path = \"/export/gismeteo/point/\#{city_index}.xml\"\n  if catalogue.key?('city_index')\n    data_taking(path, city_index)\n  else\n    data_taking(path, city_index, catalogue, conservation: true)\n  end\nend\n"