weather-forecasts 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/LICENSE +1 -1
- data/README.md +10 -5
- data/lib/weather_forecasts.rb +0 -1
- data/lib/weather_forecasts/client.rb +4 -0
- data/lib/weather_forecasts/client/help_console.rb +1 -1
- data/lib/weather_forecasts/client/query.rb +1 -0
- data/lib/weather_forecasts/client/query/select_by_days_query.rb +2 -0
- data/lib/weather_forecasts/client/query/select_hourly_query.rb +33 -0
- data/lib/weather_forecasts/client/query/select_query.rb +3 -1
- data/lib/weather_forecasts/client/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/select_hourly_query.yml +342 -0
- data/spec/lib/ndfd/client/query/select_hourly_query_spec.rb +25 -0
- data/weather-forecasts.gemspec +3 -1
- metadata +51 -12
- data/lib/weather_forecasts/dwml.rb +0 -38
- data/lib/weather_forecasts/dwml/data_extractor.rb +0 -55
- data/lib/weather_forecasts/dwml/head_extractor.rb +0 -49
- data/lib/weather_forecasts/dwml/location.rb +0 -33
- data/lib/weather_forecasts/dwml/parameter_extractor.rb +0 -281
- data/lib/weather_forecasts/dwml/time_layout.rb +0 -55
@@ -1,55 +0,0 @@
|
|
1
|
-
module WeatherForecasts
|
2
|
-
class DWML
|
3
|
-
class TimeLayout
|
4
|
-
class << self
|
5
|
-
def extract(elements)
|
6
|
-
elements.map { |element| new(element) }
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
attr_reader :element, :time_coordinate, :summarization, :layout_key, :valid_times
|
11
|
-
|
12
|
-
def initialize(element)
|
13
|
-
@element = element
|
14
|
-
@valid_times = []
|
15
|
-
|
16
|
-
extract_time_coordinate
|
17
|
-
extract_summarization
|
18
|
-
extract_layout_key
|
19
|
-
extract_valid_times
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
def extract_time_coordinate
|
25
|
-
@time_coordinate = element.attributes["time-coordinate"].text
|
26
|
-
end
|
27
|
-
|
28
|
-
def extract_summarization
|
29
|
-
@summarization = element.attributes["summarization"].text
|
30
|
-
end
|
31
|
-
|
32
|
-
def extract_layout_key
|
33
|
-
@layout_key = element.xpath("layout-key").first.text
|
34
|
-
end
|
35
|
-
|
36
|
-
def extract_valid_times
|
37
|
-
start_times = element.xpath("start-valid-time")
|
38
|
-
stop_times = element.xpath("end-valid-time")
|
39
|
-
|
40
|
-
start_times.each_with_index do |start_time, index|
|
41
|
-
@valid_times << ValidTime.new(start_time.text, stop_times[index].try(:text))
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
class ValidTime
|
46
|
-
attr_reader :start, :stop
|
47
|
-
|
48
|
-
def initialize(start, stop)
|
49
|
-
@start = Time.zone.parse(start.to_s)
|
50
|
-
@stop = Time.zone.parse(stop.to_s)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|