tellus 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 77ab48433d8e15034d7fd32e98b59186764d81305ef09546846fa3ce4f7e7530
4
+ data.tar.gz: 2d5f27919ad39b29b13ad18954c7d8b6ac05f23a47395b4b2fc93185a9f9aaf1
5
+ SHA512:
6
+ metadata.gz: 4c40748952d5375c62c18e1144359b303d99afbf9659325f31ef3ba302813e9f2bc941e2016257994df5ea3cf593de22b79df61aa8b3b3321c2e471208825a58
7
+ data.tar.gz: 8b50fd5b7f923b1857b93cfb51887509f90ed3d18cd37b905e58a862a0196649ecd4acc244a3329fa73ad16bc5be862cab73893f888e969acad35e46ee2b035c
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in tellus.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "minitest", "~> 5.0"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Damoon Imani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,36 @@
1
+ # Tellus
2
+
3
+ The gem that converts latitude and longitude to human readable address. Tellus is Earth.
4
+ Tellus uses nominatim api from openstreetmap for reverse geocoding with zoom equal to 14.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'tellus'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install tellus
21
+
22
+ ## Usage
23
+
24
+ ```
25
+ tellus address 'latitude' 'longitude'
26
+ ```
27
+
28
+ ## Development
29
+
30
+ This little gem is my playground to understand TDD, BDD, Design patterns, git, Get/Post HTTP methods, ruby gems, CI, and much more.
31
+
32
+
33
+
34
+ ## License
35
+
36
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << "test"
7
+ t.libs << "lib"
8
+ t.test_files = FileList["test/**/*_test.rb"]
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "tellus"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'tellus/cli'
4
+
5
+ Tellus::CLI.start
@@ -0,0 +1,6 @@
1
+ require "tellus/version"
2
+
3
+
4
+ module Tellus
5
+ class Error < StandardError; end
6
+ end
@@ -0,0 +1,13 @@
1
+ require 'thor'
2
+ require 'tellus/client'
3
+ module Tellus
4
+ class CLI < Thor
5
+
6
+ desc "gets ITEM", "Determines human readable address for provided latitude and longitude"
7
+ def address(latitude, longtitude)
8
+ tellus_client = Tellus::Client.new latitude, longtitude
9
+ puts tellus_client.get_address
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require "httparty"
2
+
3
+ module Tellus
4
+ class Client
5
+ attr_reader :latitude, :longitude, :url
6
+
7
+ def initialize latitude, longitude
8
+ @latitude, @longitude = latitude, longitude
9
+ @url = "https://nominatim.openstreetmap.org/reverse?format=json&lat=#{@latitude}&lon=#{@longitude}&zoom=14"
10
+ end
11
+
12
+ def get_address
13
+ response = HTTParty.get @url
14
+ return response['display_name']
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Tellus
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,40 @@
1
+ require_relative 'lib/tellus/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'tellus'
5
+ spec.version = Tellus::VERSION
6
+ spec.authors = ["Damoon Imani"]
7
+ spec.email = ["damoonimani@pm.me"]
8
+
9
+ spec.summary = %q{change any latitude and longitude pair to human readable addresses.}
10
+ spec.description = %q{
11
+
12
+ Tellus: Mother Earth
13
+ A reverse geocoding utility for terminal.
14
+ Use any CLI to change a pair of latitude and longitude to human readable addresses.
15
+ This also works with csv of latitudes and longitudes.
16
+ }
17
+ spec.homepage = "https://github.com/domimani/tellus"
18
+ spec.license = "MIT"
19
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = "https://github.com/domimani/tellus"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ #dependencies
33
+ spec.add_dependency 'httparty', '~> 0.18.0'
34
+
35
+ spec.add_development_dependency 'cucumber', '~> 4.0'
36
+ spec.add_development_dependency 'aruba', '~> 1.0', '>= 1.0.1'
37
+
38
+ spec.add_dependency 'thor', '~> 1.0', '>= 1.0.1'
39
+
40
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tellus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Damoon Imani
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-06-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.18.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.18.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: cucumber
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aruba
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.0.1
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '1.0'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.0.1
61
+ - !ruby/object:Gem::Dependency
62
+ name: thor
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.0'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.0.1
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 1.0.1
81
+ description: "\n\n Tellus: Mother Earth\n A reverse geocoding utility for terminal.\n
82
+ \ Use any CLI to change a pair of latitude and longitude to human readable addresses.\n
83
+ \ This also works with csv of latitudes and longitudes.\n "
84
+ email:
85
+ - damoonimani@pm.me
86
+ executables:
87
+ - tellus
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - exe/tellus
100
+ - lib/tellus.rb
101
+ - lib/tellus/cli.rb
102
+ - lib/tellus/client.rb
103
+ - lib/tellus/version.rb
104
+ - tellus.gemspec
105
+ homepage: https://github.com/domimani/tellus
106
+ licenses:
107
+ - MIT
108
+ metadata:
109
+ homepage_uri: https://github.com/domimani/tellus
110
+ source_code_uri: https://github.com/domimani/tellus
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: 2.3.0
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubygems_version: 3.0.8
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: change any latitude and longitude pair to human readable addresses.
130
+ test_files: []