Class: Puree::Event
Overview
Event resource
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#city ⇒ String
City.
-
#country ⇒ String
Country.
-
#date ⇒ Hash
Date.
-
#description ⇒ String
Description.
-
#initialize(endpoint: nil, username: nil, password: nil, basic_auth: 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, #set_content, #uuid
Constructor Details
#initialize(endpoint: nil, username: nil, password: nil, basic_auth: nil) ⇒ Event
Returns a new instance of Event.
11 12 13 14 15 16 17 |
# File 'lib/puree/event.rb', line 11 def initialize(endpoint: nil, username: nil, password: nil, basic_auth: nil) super(api: :event, endpoint: endpoint, username: username, password: password, basic_auth: basic_auth) end |
Instance Method Details
#city ⇒ String
City
25 26 27 28 |
# File 'lib/puree/event.rb', line 25 def city path = '/city' xpath_query(path).text.strip end |
#country ⇒ String
Country
33 34 35 36 |
# File 'lib/puree/event.rb', line 33 def country path = '/country/term/localizedString' xpath_query(path).text.strip end |
#date ⇒ Hash
Date
41 42 43 44 45 46 47 48 |
# File 'lib/puree/event.rb', line 41 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
53 54 55 56 |
# File 'lib/puree/event.rb', line 53 def description path = '/description' xpath_query(path).text.strip end |
#location ⇒ String
Location
61 62 63 64 |
# File 'lib/puree/event.rb', line 61 def location path = '/location' xpath_query(path).text.strip end |
#metadata ⇒ Hash
All metadata
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/puree/event.rb', line 85 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
69 70 71 72 |
# File 'lib/puree/event.rb', line 69 def title path = '/title/localizedString' xpath_query_for_single_value path end |
#type ⇒ String
Type
77 78 79 80 |
# File 'lib/puree/event.rb', line 77 def type path = '//typeClassification/term/localizedString' xpath_query_for_single_value path end |