lakes 0.2.0 → 0.2.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: f597194858084bb20304f2bd2c5b341d0dbd2449
4
- data.tar.gz: fff886dcc159996c8d035fd959e418196dc5ec20
3
+ metadata.gz: 1a756d1ea13c5a84e230b34db431cf1b4e509e7c
4
+ data.tar.gz: cd03a73fb8fd3a56f99b41366ed4ad03d32aa279
5
5
  SHA512:
6
- metadata.gz: e219445907985cfbe3942e33d5ab58f221bd8ac2cc84d7b112804a0e3d2fdebffd647e94d5d619897542ce21e58961f6fca790e58f59ed38dd1f4df2ff89b599
7
- data.tar.gz: a674b853d26daa5bbe0248ab4eac73e8db80f4356ea734d7fcd002a7bbc32aed247ca9b42302439c0bd412f5155d91573b6bf3ba784938b27310fb5b4acfdb55
6
+ metadata.gz: 0dd09514f415f05211033b2a7f0493ead9ef64f0315c9d1d14d2cad7c73fb6b6515618cfb8139ee91fda44a904f80e9bd7a66ee3a47e20c313268e672ed9070a
7
+ data.tar.gz: 1fe386f2552245b0ba7688980850b43bb02b65f6eaf17fb9ef0c028d5aa5888f8f2334e8f3ee9b34f23804fc3b338738d9f24314933bf4d4a8536bd875e76f01
@@ -0,0 +1,30 @@
1
+ require 'nokogiri'
2
+ module Lakes
3
+ class Texas
4
+ class FishingReportParser
5
+ include Lakes::Helper
6
+
7
+ attr_reader :raw_text
8
+ attr_reader :raw_date
9
+ attr_reader :date
10
+ attr_reader :report
11
+
12
+ def initialize(text)
13
+ @raw_text = text
14
+ parse
15
+ end
16
+
17
+ def parse
18
+ current_fishing_report_doc = Nokogiri::HTML(raw_text)
19
+ current_fishing_report_dl = current_fishing_report_doc.at('div.row.report div.container dl')
20
+ return if current_fishing_report_dl.nil?
21
+
22
+ date_text = current_fishing_report_dl.at('dt span.title').try(:text)
23
+ @raw_date = cleanup_data(date_text) unless date_text.nil?
24
+
25
+ report_text = current_fishing_report_dl.xpath('dd').try(:text)
26
+ @report = cleanup_data(report_text) unless report_text.nil?
27
+ end
28
+ end
29
+ end
30
+ end
data/lib/lakes/texas.rb CHANGED
@@ -214,6 +214,7 @@ module Lakes
214
214
  lake_data[:current_fishing_report_uri] = convert_relative_href(uri, lake_data[:details_uri])
215
215
 
216
216
  content = http_get(lake_data[:current_fishing_report_uri])
217
+ report_parser = FishingReportDataParser.new(content)
217
218
  current_fishing_report_doc = Nokogiri::HTML(content)
218
219
  current_fishing_report_dl = current_fishing_report_doc.at('div.row.report div.container dl')
219
220
 
data/lib/lakes.rb CHANGED
@@ -2,6 +2,7 @@ require 'lakes/texas'
2
2
  require 'lakes/texas/lake_characteristics_parser'
3
3
  require 'lakes/texas/water_conditions_parser'
4
4
  require 'lakes/texas/water_data_parser'
5
+ require 'lakes/texas/fishing_report_parser'
5
6
  module Lakes
6
- VERSION = '0.2.0'.freeze
7
+ VERSION = '0.2.1'.freeze
7
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lakes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Sherman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-29 00:00:00.000000000 Z
11
+ date: 2018-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,6 +86,7 @@ files:
86
86
  - lib/lakes.rb
87
87
  - lib/lakes/helper.rb
88
88
  - lib/lakes/texas.rb
89
+ - lib/lakes/texas/fishing_report_parser.rb
89
90
  - lib/lakes/texas/lake_characteristics_parser.rb
90
91
  - lib/lakes/texas/water_conditions_parser.rb
91
92
  - lib/lakes/texas/water_data_parser.rb