forward-calendar 0.1.0 → 0.1.1
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/forward-calendar.gemspec +2 -2
- data/lib/forward_calendar.rb +1 -1
- data/lib/forward_calendar/event.rb +12 -2
- data/lib/forward_calendar/forward_calendar.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a12b64c81231b047dbba014ec6ca581322fcbe8
|
4
|
+
data.tar.gz: e79b9313e90499d7530a59e4da7d15eeeb54c2ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f3eac055c4e1bf09f886bd152bc39491493077be3c8af7f346377754cb937eb1e7d90032aa2296c727d86b2076fbb251e838387e05d16bf2f7a887ba0a65d5d
|
7
|
+
data.tar.gz: 00cda194d2c52913d1360398c14cce3aee27306d75a5464353517284d8a2f9b4fc62e63f0686a9dc7d73d0c90be4abfdea4096acc7f64b90638446493b2e232e
|
data/forward-calendar.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'forward-calendar'
|
5
|
-
s.version = '0.1.
|
6
|
-
s.date = '2017-12-
|
5
|
+
s.version = '0.1.1'
|
6
|
+
s.date = '2017-12-11'
|
7
7
|
s.summary = 'Forward Calendar XML parser'
|
8
8
|
s.description = 'Parser for Forward Calendar XML files'
|
9
9
|
s.homepage = 'https://github.com/AlphaExchange/forward-calendar-rb'
|
data/lib/forward_calendar.rb
CHANGED
@@ -6,12 +6,17 @@ require_relative './location'
|
|
6
6
|
require_relative './helper/normalized_string'
|
7
7
|
|
8
8
|
module ForwardCalendar
|
9
|
+
class Locations < Node
|
10
|
+
include HappyMapper
|
11
|
+
tag 'eventLocations'
|
12
|
+
|
13
|
+
has_many :locations, Location, tag: 'eventLocation'
|
14
|
+
end
|
15
|
+
|
9
16
|
class Event < Node
|
10
17
|
include HappyMapper
|
11
18
|
tag 'event'
|
12
19
|
|
13
|
-
has_many :locations, Location, tag: 'eventLocation', xpath: './eventLocations'
|
14
|
-
|
15
20
|
element :id, Integer, tag: 'eventID'
|
16
21
|
element :type, Helper::NormalizedString, tag: 'eventType'
|
17
22
|
element :title, String, tag: 'eventTitle'
|
@@ -21,5 +26,10 @@ module ForwardCalendar
|
|
21
26
|
element :start, Date, tag: 'start'
|
22
27
|
element :end, Date, tag: 'end'
|
23
28
|
element :url, String, tag: 'URL'
|
29
|
+
element :event_locations, Locations, tag: 'eventLocations'
|
30
|
+
|
31
|
+
def locations
|
32
|
+
event_locations&.locations
|
33
|
+
end
|
24
34
|
end
|
25
35
|
end
|
@@ -18,7 +18,7 @@ module ForwardCalendar
|
|
18
18
|
def updated
|
19
19
|
Nokogiri::XML::Reader(@file).each do |node|
|
20
20
|
next unless node.name == 'updated' && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
|
21
|
-
return Updated.parse(Nokogiri::XML(node.outer_xml))
|
21
|
+
return Updated.parse(Nokogiri::XML(node.outer_xml), single: true)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -28,7 +28,7 @@ module ForwardCalendar
|
|
28
28
|
def each_event
|
29
29
|
Nokogiri::XML::Reader(@file).each do |node|
|
30
30
|
next unless node.name == 'event' && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
|
31
|
-
yield Event.parse(Nokogiri::XML(node.outer_xml))
|
31
|
+
yield Event.parse(Nokogiri::XML(node.outer_xml), single: true)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forward-calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- João Simões
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|