myweatherforecast 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 48f4290b76ad88f878bc5efb715d904ba0342702
4
+ data.tar.gz: dba5e9e6877bc17530ac2f1bed21aa9ca02fbcb3
5
+ SHA512:
6
+ metadata.gz: 1a1e1d7dd426fde6c9cf07244f90dc6341bb6d1df5ae965585db25cdd7daaf34b93a657812e9c642fd2433b9df52f5c4e5d20d1fc90f0ed32beadacc83c29038
7
+ data.tar.gz: ad4a89bb270501e7ddfdfb881b46d2cab50be19ab83d6f9b5c4c235f48d4987c9d601e50a563929c199b4ec8d0786997782e87e95968e71cfa2bafea4e79562b
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: myweatherforecast.rb
4
+
5
+ require 'forecast_io'
6
+
7
+ # This gem is a wrapper of the forecast_io gem
8
+ # SI explained: https://en.wikipedia.org/wiki/SI_derived_unit
9
+
10
+ class MyWeatherForecast
11
+
12
+ def initialize(lat, lon, api_key: nil, si: true)
13
+
14
+ ForecastIO.api_key = api_key
15
+
16
+
17
+ if si then
18
+ params = { units: 'si' }
19
+ @tlabel = 'degrees Celcius'
20
+ else
21
+ params = {}
22
+ @tlabel = 'degrees Farenheit'
23
+ end
24
+
25
+ @forecast = ForecastIO.forecast(lat, lon, params: params)
26
+ end
27
+
28
+ class Day
29
+
30
+ def initialize(x, tlabel)
31
+
32
+ @x = x
33
+ @tlabel = tlabel
34
+
35
+ end
36
+
37
+ def to_s
38
+ "%s %s, %s" % [@x.temperature.round, @tlabel, @x.summary]
39
+ end
40
+
41
+ def summary()
42
+ @x.summary
43
+ end
44
+
45
+ def temperature
46
+ @x.temperature
47
+ end
48
+ end
49
+
50
+ class DaysAhead
51
+
52
+ def initialize(x, tlabel)
53
+
54
+ @x = x
55
+ @tlabel = tlabel
56
+
57
+ end
58
+
59
+ def to_s
60
+ "%s" % [@x.summary]
61
+ end
62
+
63
+ def summary()
64
+ @x.summary
65
+ end
66
+
67
+ end
68
+
69
+ def today()
70
+ Day.new(@forecast.currently, @tlabel)
71
+ end
72
+
73
+ def tomorrow()
74
+ DaysAhead.new(@forecast['daily']['data'][1], @tlabel)
75
+ end
76
+
77
+ end
78
+
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: myweatherforecast
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE1MTAyMjExMzYyMVoXDTE2MTAyMTExMzYyMVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAMleuTWI7tS6RWUJQWbI9pRifVQMJgiTTxmFRrpLBBXnFtp4Dzw/GRlyIlVt
19
+ Hs+SOcdYzWbA+7Uto1YA1BHdNvbPHE3t9YUyr5BbZFDwgNtYLZ27kRD7pSD9gyC9
20
+ HnwO+y1sfpSNS3fkjlaY7iDUGNlGIkbJQ2biocy9UjNQJCmZQhtZzlFU8bwGiPJf
21
+ Lbcd0kluy1ykErfttRg2mrWcEJBEgkol6SSATAiCp+kZUNeQlbZSmvQDsFZd+FJa
22
+ Qhjya+OtL4GRxCBWjKeFOMq7lByj6wK6s8Yavi26Qwh1+J1suFjn2tPVwqVx9Fkc
23
+ sEqoWSMkdz8w7efnrmF+06lgIskCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQURRhjt8qerss2WEHGCyHGhkQH97AwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEArq5KBg2O
27
+ 5PhI7e3N049PuXd3CL2OJoZTZ6kL863VxrMawHz3gigFQ4uEQFn9hWH/SNF8mKTJ
28
+ ScICTLpTohfVGlzTDSuvpPKZfkYSkGYcfHGDmD8+Nl3IZcMFHIJ3PjFeGEjM3j8M
29
+ i4OEt2c0wVObiZL2E/czP7u541GaFupk63le70iojjFI4KrO7Jlh3T5slxJxusiE
30
+ cjf+31b892gC+ztTfY1S1+eVVwkNoQi75FI37AW9ZK/hACBWKaLYiGARpb8WU7II
31
+ GwZIa3P1Ea+RT3dq6Es6+k/jkXNYth2ABedYgIgU0DgZpU/JrQ1DcvAA6VGUEwar
32
+ ztA769NWsU/h1g==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-10-22 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: forecast_io
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '2.0'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.0
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '2.0'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 2.0.0
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/myweatherforecast.rb
63
+ homepage: https://github.com/jrobertson/myweatherforecast
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.4.8
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: myweatherforecast
87
+ test_files: []
metadata.gz.sig ADDED
Binary file