forward-calendar 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 862009b8848681c1e0194d4542a9d3e9c02d0ec5
4
- data.tar.gz: 55be0c0aa4df8e86a278365f9955123e9564c48d
3
+ metadata.gz: 8a12b64c81231b047dbba014ec6ca581322fcbe8
4
+ data.tar.gz: e79b9313e90499d7530a59e4da7d15eeeb54c2ba
5
5
  SHA512:
6
- metadata.gz: f42238e2c8f2edad3b68f61f44714045fac80474ab5a83cbd563c19f5b520e30ae1758317aeab5a029fadf59d42b1dcb150d8084063c731f692a65322afef9a3
7
- data.tar.gz: 99a34126b47f19d2034e31613849899eb8c9316d0e40eb3794ceca4296d43808270f3906157fa5754b40ebef1898331905c1c05010a86f461eb3f4ab900bb562
6
+ metadata.gz: 6f3eac055c4e1bf09f886bd152bc39491493077be3c8af7f346377754cb937eb1e7d90032aa2296c727d86b2076fbb251e838387e05d16bf2f7a887ba0a65d5d
7
+ data.tar.gz: 00cda194d2c52913d1360398c14cce3aee27306d75a5464353517284d8a2f9b4fc62e63f0686a9dc7d73d0c90be4abfdea4096acc7f64b90638446493b2e232e
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'forward-calendar'
5
- s.version = '0.1.0'
6
- s.date = '2017-12-07'
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'
@@ -8,7 +8,7 @@ module ForwardCalendar
8
8
  end
9
9
 
10
10
  def self.parser_from_file(file_path)
11
- xml = File.read(file_path)
11
+ xml = File.open(file_path)
12
12
  parser(xml)
13
13
  end
14
14
  end
@@ -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.0
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-07 00:00:00.000000000 Z
11
+ date: 2017-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler