puertos 0.1.1 → 0.1.2

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: 6b8dafc8afa46f05328511297296b491cca5e44c
4
- data.tar.gz: b29aa2fb7e86c349cd8d40ca00dac0cfc7f91e69
3
+ metadata.gz: ccf33fe7085a01d027c52c6409f985f136b10b76
4
+ data.tar.gz: b3249491e9013ec9fcecba80aead88f0227fb064
5
5
  SHA512:
6
- metadata.gz: 5addb2919657a0b8feb730867e286eb8ef5273f7cb07b9fd8d3e191c973e296d65993f5fc6ddbb3e7857ab7277abb4b13bc452249bdafa33f94bcbbb3e6eb238
7
- data.tar.gz: 06a65c3c8549b8f29a294c27caf40c19120d2c52302d88599a4d5e72427551e76ef75b12a7049bb91500e56e052b2b596689a8342e92b1ba3ac4693c5a99ffd3
6
+ metadata.gz: 277b6062b7241ad9f7fad115b517dd7cc16d44ff53e963eb2433891da4bb2a23616a8d829f9824d05895f336b697ee425f9825a3946ef64701f28dd8963c29ae
7
+ data.tar.gz: b55f5503d7bff00442ec894b189f56ba3b784012e331a9b9ccd373b253ce789dd361ada89e5b4fe6e18ff6c5aaef602024ee00a8eba92275db7c0e5beb355f28
@@ -0,0 +1,5 @@
1
+ --protected
2
+ --no-private
3
+ --embed-mixin ClassMethods
4
+ -
5
+
@@ -4,9 +4,14 @@ require 'nokogiri'
4
4
 
5
5
  module Puertos
6
6
  class Parser
7
+ #@private
7
8
  DATA_URL = 'http://static.puertos.es/pred_simplificada/Predolas/Tablas/Med/BAR.html'
9
+ #@private
8
10
  CSS_ROWS_SELECTOR = 'center center table tr'
9
11
 
12
+ # uses the row parser to parse line by line the forecast table
13
+ #
14
+ # @return [Array] Array of ForecastData with all the relevant information
10
15
  def run
11
16
  rows = Nokogiri::HTML(open(DATA_URL)).css CSS_ROWS_SELECTOR
12
17
 
@@ -2,6 +2,9 @@ require "puertos/version"
2
2
  require "parser"
3
3
 
4
4
  module Puertos
5
+ # public interface for getting the forecast data
6
+ #
7
+ # @return [array] of ForecastData with the next 72 hours of forecast
5
8
  def self.fetch
6
9
  Parser.new.run
7
10
  end
@@ -1,3 +1,3 @@
1
1
  module Puertos
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -2,14 +2,18 @@ require "wind_data"
2
2
  require "swell_data"
3
3
 
4
4
  module Puertos
5
+ # The Parser is responsible of fetching the data from Puertos del Estado
6
+ # and return it as ruby objects
5
7
  class RowParser
6
-
7
8
  attr_reader :row
8
9
 
9
10
  def initialize row
10
11
  @row = row
11
12
  end
12
13
 
14
+ # parses each input line and returns a ForecastData object
15
+ #
16
+ # @return [ForecastData] with all the relevant information
13
17
  def run
14
18
  timestamp = create_timestamp
15
19
  wind = create_wind_data
@@ -1,6 +1,5 @@
1
1
  module Puertos
2
2
  class SwellData
3
-
4
3
  attr_reader :height, :height_unit, :direction, :avg_period, :peak_period, :period_unit
5
4
 
6
5
  def initialize(height: nil, height_unit: 'm', direction: nil, avg_period: nil, peak_period: nil, period_unit: 's')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puertos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raul Galindo
@@ -62,6 +62,7 @@ extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
64
  - ".travis.yml"
65
+ - ".yardopts"
65
66
  - Gemfile
66
67
  - Guardfile
67
68
  - LICENSE.txt