Class: Puree::Event
Overview
Event resource
Instance Method Summary collapse
-
#city ⇒ String
City.
-
#country ⇒ String
Country.
-
#date ⇒ Hash
Date.
-
#description ⇒ String
Description.
-
#initialize(endpoint: nil, username: nil, password: nil) ⇒ Event
constructor
A new instance of Event.
-
#location ⇒ String
Location.
-
#metadata ⇒ Hash
All metadata.
-
#title ⇒ String
Title.
-
#type ⇒ String
Type.
Methods inherited from Resource
#content, #created, #get, #modified, #response, #set_content, #uuid
Constructor Details
#initialize(endpoint: nil, username: nil, password: nil) ⇒ Event
Returns a new instance of Event.
10 11 12 13 14 15 |
# File 'lib/puree/event.rb', line 10 def initialize(endpoint: nil, username: nil, password: nil) super(api: :event, endpoint: endpoint, username: username, password: password) end |
Instance Method Details
#city ⇒ String
City
20 21 22 23 |
# File 'lib/puree/event.rb', line 20 def city path = '//city' xpath_query(path).text.strip end |
#country ⇒ String
Country
28 29 30 31 |
# File 'lib/puree/event.rb', line 28 def country path = '//country/term/localizedString' xpath_query(path).text.strip end |
#date ⇒ Hash
Date
36 37 38 39 40 41 42 43 |
# File 'lib/puree/event.rb', line 36 def date data = {} path = '//dateRange' range = xpath_query path data['start'] = range.xpath('startDate').text.strip data['end'] = range.xpath('startDate').text.strip data end |
#description ⇒ String
Description
48 49 50 51 |
# File 'lib/puree/event.rb', line 48 def description path = '//content/description' xpath_query(path).text.strip end |
#location ⇒ String
Location
56 57 58 59 |
# File 'lib/puree/event.rb', line 56 def location path = '//location' xpath_query(path).text.strip end |
#metadata ⇒ Hash
All metadata
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/puree/event.rb', line 80 def o = super o['city'] = city o['country'] = country o['date'] = date o['description'] = description o['location'] = location o['title'] = title o['type'] = type o end |
#title ⇒ String
Title
64 65 66 67 |
# File 'lib/puree/event.rb', line 64 def title path = '//title/localizedString' xpath_query(path).text.strip end |
#type ⇒ String
Type
72 73 74 75 |
# File 'lib/puree/event.rb', line 72 def type path = '//content/typeClassification/term/localizedString' xpath_query(path).text.strip end |