Class: MeteofranceApi::Warning::Full
- Inherits:
-
Object
- Object
- MeteofranceApi::Warning::Full
- Defined in:
- lib/meteofrance_api/models/warning/full.rb
Overview
This class allows to access the results of a ‘warning/full` API command.
For a given domain we can access the maximum alert, a timelaps of the alert evolution for the next 24 hours, and a list of alerts.
For coastal department two bulletins are avalaible corresponding to two different domains.
Instance Attribute Summary collapse
-
#advices ⇒ Object
readonly
Returns the value of attribute advices.
-
#color_max ⇒ Object
readonly
color max of the domain.
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#consequences ⇒ Object
readonly
Returns the value of attribute consequences.
-
#domain_id ⇒ Object
readonly
domain ID of the the full bulletin.
-
#end_validity_time ⇒ Object
readonly
end of validty time of the full bulletin.
-
#max_count_items ⇒ Object
readonly
Returns the value of attribute max_count_items.
-
#phenomenons ⇒ Object
readonly
phenomenom list of the domain.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#text_avalanche ⇒ Object
readonly
Returns the value of attribute text_avalanche.
-
#timelaps ⇒ Object
readonly
timelaps of each phenomenom for the domain.
-
#update_time ⇒ Object
readonly
update time of the full bulletin.
Instance Method Summary collapse
-
#initialize(data) ⇒ Full
constructor
A new instance of Full.
-
#merge_with_coastal_phenomenons!(coastal_phenomenons) ⇒ Object
Args: coastal_phenomenoms: Full instance corresponding to the coastal weather alert bulletin.
Constructor Details
#initialize(data) ⇒ Full
Returns a new instance of Full.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 29 def initialize(data) @update_time = Time.at(data["update_time"]) @end_validity_time = Time.at(data["end_validity_time"]) @domain_id = data["domain_id"] @color_max = data["color_max"] @timelaps = data["timelaps"] @phenomenons = (data["phenomenons_items"] || []).map {|i| MeteofranceApi::Warning::Phenomenon.new(i)} @advices = data["advices"] @consequences = data["consequences"] @max_count_items = data["max_count_items"] @comments = data["comments"] @text = data["text"] @text["text_avalanche"] end |
Instance Attribute Details
#advices ⇒ Object (readonly)
Returns the value of attribute advices.
22 23 24 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 22 def advices @advices end |
#color_max ⇒ Object (readonly)
color max of the domain.
16 17 18 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 16 def color_max @color_max end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
25 26 27 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 25 def comments @comments end |
#consequences ⇒ Object (readonly)
Returns the value of attribute consequences.
23 24 25 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 23 def consequences @consequences end |
#domain_id ⇒ Object (readonly)
domain ID of the the full bulletin. Value is ‘France’ or a department number.
14 15 16 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 14 def domain_id @domain_id end |
#end_validity_time ⇒ Object (readonly)
end of validty time of the full bulletin.
12 13 14 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 12 def end_validity_time @end_validity_time end |
#max_count_items ⇒ Object (readonly)
Returns the value of attribute max_count_items.
24 25 26 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 24 def max_count_items @max_count_items end |
#phenomenons ⇒ Object (readonly)
phenomenom list of the domain.
20 21 22 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 20 def phenomenons @phenomenons end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
26 27 28 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 26 def text @text end |
#text_avalanche ⇒ Object (readonly)
Returns the value of attribute text_avalanche.
27 28 29 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 27 def text_avalanche @text_avalanche end |
#timelaps ⇒ Object (readonly)
timelaps of each phenomenom for the domain. A list of Hash corresponding to the schedule of each phenomenons in the next 24 hours
18 19 20 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 18 def timelaps @timelaps end |
#update_time ⇒ Object (readonly)
update time of the full bulletin.
10 11 12 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 10 def update_time @update_time end |
Instance Method Details
#merge_with_coastal_phenomenons!(coastal_phenomenons) ⇒ Object
Args:
coastal_phenomenoms: Full instance corresponding to the coastal weather
alert bulletin.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/meteofrance_api/models/warning/full.rb', line 53 def merge_with_coastal_phenomenons!(coastal_phenomenons) # TODO: Add consitency check # TODO: Check if other data need to be merged @color_max = [color_max, coastal_phenomenons.color_max].max # Merge timelaps @timelaps += coastal_phenomenons.timelaps # Merge phenomenons @phenomenons += coastal_phenomenons.phenomenons end |