meteoub-gem 0.2.0 → 0.2.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.
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ # - 1.9.3
5
+ # - jruby-18mode # JRuby in 1.8 mode
6
+ # - jruby-19mode # JRuby in 1.9 mode
7
+ # - rbx-18mode
8
+ # - rbx-19mode
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ### meteoub-gem
2
2
 
3
+ [![Build Status](https://travis-ci.org/apuratepp/meteoub-gem.png)](https://travis-ci.org/apuratepp/meteoub-gem])
4
+
3
5
  A rewrite of the MeteoUB library which gets, parses and stores weather data from *infomet.am.ub.es*: [www.dat](http://infomet.am.ub.es/campbell/www.dat) and [maxmin.dat](http://infomet.am.ub.edu/campbell/maxmin.dat)
4
6
 
5
7
  ### License
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -9,6 +9,4 @@ require 'meteoub-gem'
9
9
  # MeteoUB::MeasureTable.up unless ActiveRecord::Base.connection.table_exists? :measures
10
10
 
11
11
  dades = MeteoUB::Data.new
12
- p dades.temperature
13
- p dades.temperature_max, dades.datetime_max
14
- p dades.temperature_min, dades.datetime_min
12
+ puts "Current temperature #{dades.temperature} ºC. Sunrise/Sunset: #{dades.sunrise}/#{dades.sunset}"
@@ -57,23 +57,24 @@ module MeteoUB
57
57
  end
58
58
 
59
59
  def parse_date(date_raw)
60
- hour, minutes = date_raw.split(":")
61
- if minutes == 60
62
- minutes = 0
63
- hour += 1
64
- end
60
+ hour, minutes = sanitize_time(date_raw.split(":"))
65
61
  DateTime.strptime(@raw_data[0] + " #{hour}:#{minutes} UTC", "%d-%m-%y %k:%M %Z")
66
62
  end
63
+
67
64
  def parse_maxmin(maxmin_raw)
68
65
  temperature, time, date = maxmin_raw.split(" ")
69
- hour, minutes = time.split(":")
70
- if minutes == 60
71
- minutes = 0
72
- hour += 1
73
- end
66
+ hour, minutes = sanitize_time(time.split(":"))
74
67
  [temperature.to_f, DateTime.strptime("#{date} #{hour}:#{minutes} UTC", "%Y%m%d %k:%M %Z")]
75
68
  end
76
69
 
70
+ def sanitize_time(time_split)
71
+ if time_split[1] == "60"
72
+ time_split[1] = 0
73
+ time_split[0] = time_split[0].to_i + 1
74
+ end
75
+ time_split
76
+ end
77
+
77
78
  # http://cbc.riocean.com/wstat/012006rose.html
78
79
  def parse_windrose(windrose_raw)
79
80
  case(windrose_raw)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "meteoub-gem"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josep"]
12
- s.date = "2013-05-02"
12
+ s.date = "2013-10-08"
13
13
  s.description = "A rewrite of the MeteoUB library wich gets, parses and stores weather data from infomet.am.ub.es"
14
14
  s.email = "apuratepp@gmail.com"
15
15
  s.executables = ["meteoub"]
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  ".document",
22
+ ".travis.yml",
22
23
  "Gemfile",
23
24
  "Gemfile.lock",
24
25
  "LICENSE.txt",
@@ -1,7 +1,18 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestMeteoubGem < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
4
+ # should "probably rename this file and start testing for real" do
5
+ # flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ # end
7
+
8
+ context "Gettings temperature" do
9
+ should "get float temperature" do
10
+ dades = MeteoUB::Data.new
11
+ assert_operator(dades.temperature, :>, -10.0)
12
+ end
13
+ should "" do
14
+ dades = MeteoUB::Data.new
15
+ assert_operator(dades.temperature, :<, 50.0)
16
+ end
6
17
  end
7
18
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meteoub-gem
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Josep
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-05-02 00:00:00 Z
18
+ date: 2013-10-08 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -128,6 +128,7 @@ extra_rdoc_files:
128
128
  - README.md
129
129
  files:
130
130
  - .document
131
+ - .travis.yml
131
132
  - Gemfile
132
133
  - Gemfile.lock
133
134
  - LICENSE.txt