eolclub_scraper 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80b3a324a83703614e21bed8ea3c5ef0d98909ec
4
- data.tar.gz: 9a60349cd55e495106ecaf1dd738b443f4ae03b0
3
+ metadata.gz: 1aa81ece4ef8fbd1d10cc1794c302b88c56e3ac1
4
+ data.tar.gz: c529ba35fdb15771a21f7614007b729cb75aca3b
5
5
  SHA512:
6
- metadata.gz: d30930978b8fc7017ae153a1fc36d7ae70385e20bd0cdae4e373be8d9dd82429d287ee2803e0e8e7eb1c30d3db7a00cf536ca3adfde1fc2d7042501d43a222a4
7
- data.tar.gz: f734162e795d71e7b4809a3c622c74d39c302acbd10ad0dd886d159c56e795f4f99fac2cebd52c3e0f6596ec2e6bc87712874c33655b9b5cc2fc7470565f53f2
6
+ metadata.gz: 8d8591d3ea3391ba59c783251cc3f5e32af95a512d5ac4d0e9dabc5691b998645662374b994430f52133b53ab8c66f30b5273e7811d943cd90b9aba762596a80
7
+ data.tar.gz: e2ca1d3ae68c831e8b1016e9edaa0c3abfb4914dd221f048f502b1c91ab6fe12bbdf995cd6da75ab33527fa66aac4cee67cb4034b0569c0187e936a3bb36c215
@@ -1,6 +1,6 @@
1
1
  module EolclubScraper
2
2
 
3
- class Event < Struct.new(:start_time, :end_time)
3
+ class Event < Struct.new(:start_time, :end_time, :description)
4
4
  end
5
5
 
6
6
  end
@@ -10,12 +10,14 @@ module EolclubScraper
10
10
  # the same format, so that may be okay.
11
11
  def parse(content)
12
12
  doc = Nokogiri::HTML.parse(content)
13
+ description = doc.css('p').first(3).to_s
13
14
  schedule_text = doc.css('p')[1].text.split("\n")[2].split(',').last.strip.split
14
15
  start_time, end_time = schedule_text.last.split(/\W/)
15
16
 
16
17
  Event.new(
17
18
  Chronic.parse( [ schedule_text[0], schedule_text[1], start_time ].join(' ') ),
18
- Chronic.parse( [ schedule_text[0], schedule_text[1], end_time ].join(' ') )
19
+ Chronic.parse( [ schedule_text[0], schedule_text[1], end_time ].join(' ') ),
20
+ description
19
21
  )
20
22
  end
21
23
 
@@ -1,3 +1,3 @@
1
1
  module EolclubScraper
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -3,13 +3,18 @@ require 'eolclub_scraper/event_parser'
3
3
  describe EolclubScraper::EventParser do
4
4
 
5
5
  describe '#parse' do
6
+ let(:parsed) { subject.parse(content) }
7
+
6
8
  it 'parses an Event from the supplied content' do
7
- expect( subject.parse(content) ).to eq(
8
- EolclubScraper::Event.new(
9
- Time.local(2013, 12, 9, 18, 0, 0),
10
- Time.local(2013, 12, 9, 23, 0, 0)
11
- )
12
- )
9
+ expect( parsed.start_time ).to eq( Time.local(2013, 12, 9, 18, 0, 0) )
10
+ expect( parsed.end_time ).to eq( Time.local(2013, 12, 9, 23, 0, 0) )
11
+ end
12
+
13
+ it 'provides the HTML description from the scraped page' do
14
+ desc = parsed.description
15
+ expect(desc).to include("Monthly Providence, RI hacknight.")
16
+ expect(desc).to include("Our next meetup is")
17
+ expect(desc).to include("@EOLclub")
13
18
  end
14
19
  end
15
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eolclub_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Gillooly