Class: SemanticCrawler::Gdacs::EmergencyFeedItem
- Inherits:
-
Object
- Object
- SemanticCrawler::Gdacs::EmergencyFeedItem
- Defined in:
- lib/semantic_crawler/gdacs/emergency_feed_item.rb
Overview
One emergency crisis entity.
Constant Summary collapse
- @@NAMESPACES =
XML namespaces used for the parsing process
{ "gdacs" => "http://www.gdacs.org", "glide" => "http://glidenumber.net" }
Instance Method Summary collapse
-
#eventType ⇒ Object
Returns a human readable event type.
-
#glide ⇒ Object
Returns the glide number.
-
#initialize(new_root_node) ⇒ EmergencyFeedItem
constructor
A new instance of EmergencyFeedItem.
-
#lastUpdate ⇒ Object
Returns the last updated datetime.
-
#link ⇒ Object
Returns the crisis gdacs link.
-
#pubDate ⇒ Object
Returns the publication date.
-
#query_root_node(xpath_query, namespaces = {}) ⇒ Object
Query the root_node.
-
#title ⇒ Object
Returns the crisis title.
Constructor Details
#initialize(new_root_node) ⇒ EmergencyFeedItem
Returns a new instance of EmergencyFeedItem.
13 14 15 |
# File 'lib/semantic_crawler/gdacs/emergency_feed_item.rb', line 13 def initialize(new_root_node) @root_node = new_root_node end |
Instance Method Details
#eventType ⇒ Object
Returns a human readable event type
33 34 35 |
# File 'lib/semantic_crawler/gdacs/emergency_feed_item.rb', line 33 def eventType query_root_node("gdacs:eventType/text()", @@NAMESPACES) end |
#glide ⇒ Object
Returns the glide number
42 43 44 |
# File 'lib/semantic_crawler/gdacs/emergency_feed_item.rb', line 42 def glide query_root_node("glide:number/text()", @@NAMESPACES) end |
#lastUpdate ⇒ Object
Returns the last updated datetime
38 39 40 |
# File 'lib/semantic_crawler/gdacs/emergency_feed_item.rb', line 38 def lastUpdate query_root_node("gdacs:lastUpdate/text()", @@NAMESPACES) end |
#link ⇒ Object
Returns the crisis gdacs link
23 24 25 |
# File 'lib/semantic_crawler/gdacs/emergency_feed_item.rb', line 23 def link query_root_node("link/text()") end |
#pubDate ⇒ Object
Returns the publication date
28 29 30 |
# File 'lib/semantic_crawler/gdacs/emergency_feed_item.rb', line 28 def pubDate query_root_node("pubDate/text()") end |
#query_root_node(xpath_query, namespaces = {}) ⇒ Object
Query the root_node
47 48 49 50 51 |
# File 'lib/semantic_crawler/gdacs/emergency_feed_item.rb', line 47 def query_root_node(xpath_query, namespaces = {}) if !@root_node.nil? @root_node.xpath(xpath_query, namespaces) end end |
#title ⇒ Object
Returns the crisis title
18 19 20 |
# File 'lib/semantic_crawler/gdacs/emergency_feed_item.rb', line 18 def title query_root_node("title/text()") end |