sunweather 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7959e44051224f4ef0eaae0a721d5d617bf9e467
4
+ data.tar.gz: 40c62de7d010e330c8b4a35965dc52686bfb0b5c
5
+ SHA512:
6
+ metadata.gz: 30eada42b4b8584d8ecb0cce82b0ed2ebd002ff0a0632b3c68608bde28cf408c3f58ac5928413a0d235277f34a9304eaab56770d6e971734982c2873efd3e758
7
+ data.tar.gz: bbf747fd11d6ca2da5b68353b918852744e8ed0fc3c2b546c56bb0d14a0f2db8f99dbd7f7c5d276cf81fe3143a2917d536dea4b34a02a5d39aecf8d34a8a8160
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.8.0"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "bundler", "~> 1.0"
12
+ gem "jeweler", "~> 1.8.7"
13
+ gem "simplecov", ">= 0"
14
+ gem "geocoder", "~> 1.1.8"
15
+ gem "json", "~> 1.8.0"
16
+ gem "capybara", "~> 2.1.0"
17
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,83 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.5)
5
+ builder (3.2.2)
6
+ capybara (2.1.0)
7
+ mime-types (>= 1.16)
8
+ nokogiri (>= 1.3.3)
9
+ rack (>= 1.0.0)
10
+ rack-test (>= 0.5.4)
11
+ xpath (~> 2.0)
12
+ diff-lcs (1.1.3)
13
+ faraday (0.8.8)
14
+ multipart-post (~> 1.2.0)
15
+ geocoder (1.1.8)
16
+ git (1.2.6)
17
+ github_api (0.10.1)
18
+ addressable
19
+ faraday (~> 0.8.1)
20
+ hashie (>= 1.2)
21
+ multi_json (~> 1.4)
22
+ nokogiri (~> 1.5.2)
23
+ oauth2
24
+ hashie (2.0.5)
25
+ highline (1.6.19)
26
+ httpauth (0.2.0)
27
+ jeweler (1.8.8)
28
+ builder
29
+ bundler (~> 1.0)
30
+ git (>= 1.2.5)
31
+ github_api (= 0.10.1)
32
+ highline (>= 1.6.15)
33
+ nokogiri (= 1.5.10)
34
+ rake
35
+ rdoc
36
+ json (1.8.0)
37
+ jwt (0.1.8)
38
+ multi_json (>= 1.5)
39
+ mime-types (1.25)
40
+ multi_json (1.8.1)
41
+ multi_xml (0.5.5)
42
+ multipart-post (1.2.0)
43
+ nokogiri (1.5.10)
44
+ oauth2 (0.9.2)
45
+ faraday (~> 0.8)
46
+ httpauth (~> 0.2)
47
+ jwt (~> 0.1.4)
48
+ multi_json (~> 1.0)
49
+ multi_xml (~> 0.5)
50
+ rack (~> 1.2)
51
+ rack (1.5.2)
52
+ rack-test (0.6.2)
53
+ rack (>= 1.0)
54
+ rake (10.1.0)
55
+ rdoc (3.12.2)
56
+ json (~> 1.4)
57
+ rspec (2.8.0)
58
+ rspec-core (~> 2.8.0)
59
+ rspec-expectations (~> 2.8.0)
60
+ rspec-mocks (~> 2.8.0)
61
+ rspec-core (2.8.0)
62
+ rspec-expectations (2.8.0)
63
+ diff-lcs (~> 1.1.2)
64
+ rspec-mocks (2.8.0)
65
+ simplecov (0.7.1)
66
+ multi_json (~> 1.0)
67
+ simplecov-html (~> 0.7.1)
68
+ simplecov-html (0.7.1)
69
+ xpath (2.0.0)
70
+ nokogiri (~> 1.3)
71
+
72
+ PLATFORMS
73
+ ruby
74
+
75
+ DEPENDENCIES
76
+ bundler (~> 1.0)
77
+ capybara (~> 2.1.0)
78
+ geocoder (~> 1.1.8)
79
+ jeweler (~> 1.8.7)
80
+ json (~> 1.8.0)
81
+ rdoc (~> 3.12)
82
+ rspec (~> 2.8.0)
83
+ simplecov
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Tobi Frank
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = sunweather
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to sunweather
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2013 Tobi Frank. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "sunweather"
18
+ gem.homepage = "http://github.com/tobifrank/sunweather"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Provides sunrise/sunset and weather info for given address.}
21
+ gem.description = %Q{Provides sunrise/sunset and weather info for given address.}
22
+ gem.email = "tobifrank38@gmail.com"
23
+ gem.authors = ["Tobi Frank"]
24
+ gem.executables = ["sunweather"]
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
36
+ spec.pattern = 'spec/**/*_spec.rb'
37
+ spec.rcov = true
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rdoc/task'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "sunweather #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/sunweather ADDED
@@ -0,0 +1,5 @@
1
+ #! /usr/bin/env ruby
2
+ require_relative '../lib/runner'
3
+
4
+ runner = Sunweather::Runner.new
5
+ runner.run
data/lib/geo.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'geocoder'
2
+
3
+ module Sunweather
4
+ class Geo
5
+ attr_reader :data
6
+
7
+ def initialize (request = "Friedrich-von-Spee-Straße 10, Paderborn")
8
+ @data = Geocoder.search(request)
9
+ end
10
+
11
+ def lat
12
+ @data[0].data["geometry"]["location"]["lat"]
13
+ end
14
+
15
+ def lng
16
+ @data[0].data["geometry"]["location"]["lng"]
17
+ end
18
+ end
19
+ end
data/lib/runner.rb ADDED
@@ -0,0 +1,15 @@
1
+ require_relative 'geo'
2
+
3
+ module Sunweather
4
+ class Runner
5
+
6
+ def initialize
7
+ end
8
+
9
+ def run
10
+ @geo = (ARGV[0] ? Geo.new(ARGV[0]) : Geo.new)
11
+ puts @geo.lat
12
+ puts @geo.lng
13
+ end
14
+ end
15
+ end
data/spec/geo_spec.rb ADDED
@@ -0,0 +1,51 @@
1
+ require_relative "../lib/geo"
2
+
3
+ describe Sunweather::Geo, "after initializing with a string" do
4
+ let (:geo) { Sunweather::Geo.new("test") }
5
+
6
+ it "contains data" do
7
+ expect(geo.data).not_to be_nil
8
+ end
9
+
10
+ it "contains a latitude value" do
11
+ expect(geo.data[0].data["geometry"]["location"]["lat"]).to be_within(90).of(0)
12
+ end
13
+
14
+ it "contains a longitude value" do
15
+ expect(geo.data[0].data["geometry"]["location"]["lng"]).to be_within(180).of(0)
16
+ end
17
+
18
+ it "returns a latitude value on lat" do
19
+ expect(geo.lat).to be_within(90).of(0)
20
+ end
21
+
22
+ it "returns a longitude value on lng" do
23
+ expect(geo.lng).to be_within(180).of(0)
24
+ end
25
+
26
+ end
27
+
28
+ describe Sunweather::Geo, "after initializing without a string" do
29
+ let (:geo) { Sunweather::Geo.new }
30
+
31
+ it "contains data" do
32
+ expect(geo.data).not_to be_nil
33
+ end
34
+
35
+ it "contains a latitude value" do
36
+ expect(geo.data[0].data["geometry"]["location"]["lat"]).to be_within(90).of(0)
37
+ end
38
+
39
+ it "contains a longitude value" do
40
+ expect(geo.data[0].data["geometry"]["location"]["lng"]).to be_within(180).of(0)
41
+ end
42
+
43
+ it "returns default latitude value on lat" do
44
+ expect(geo.lat).to eq(51.713741)
45
+ end
46
+
47
+ it "returns default longitude value on lng" do
48
+ expect(geo.lng).to eq(8.770812)
49
+ end
50
+
51
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'sunweather'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sunweather
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tobi Frank
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 2.8.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 2.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '3.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jeweler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.8.7
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.8.7
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: geocoder
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.1.8
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.1.8
97
+ - !ruby/object:Gem::Dependency
98
+ name: json
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.8.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.8.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: capybara
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 2.1.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 2.1.0
125
+ description: Provides sunrise/sunset and weather info for given address.
126
+ email: tobifrank38@gmail.com
127
+ executables:
128
+ - sunweather
129
+ extensions: []
130
+ extra_rdoc_files:
131
+ - LICENSE.txt
132
+ - README.rdoc
133
+ files:
134
+ - .document
135
+ - .rspec
136
+ - Gemfile
137
+ - Gemfile.lock
138
+ - LICENSE.txt
139
+ - README.rdoc
140
+ - Rakefile
141
+ - VERSION
142
+ - bin/sunweather
143
+ - lib/geo.rb
144
+ - lib/runner.rb
145
+ - spec/geo_spec.rb
146
+ - spec/spec_helper.rb
147
+ homepage: http://github.com/tobifrank/sunweather
148
+ licenses:
149
+ - MIT
150
+ metadata: {}
151
+ post_install_message:
152
+ rdoc_options: []
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - '>='
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
165
+ requirements: []
166
+ rubyforge_project:
167
+ rubygems_version: 2.0.3
168
+ signing_key:
169
+ specification_version: 4
170
+ summary: Provides sunrise/sunset and weather info for given address.
171
+ test_files: []