countries_cli 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Country.gemspec +2 -2
- data/Gemfile.lock +1 -1
- data/README.md +15 -49
- data/bin/console +1 -1
- data/bin/country +2 -2
- data/lib/countries_cli.rb +9 -0
- data/lib/{Country → countries_cli}/cli.rb +14 -14
- data/lib/{Country → countries_cli}/country.rb +1 -1
- data/lib/countries_cli/version.rb +3 -0
- metadata +6 -6
- data/lib/Country.rb +0 -9
- data/lib/Country/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad65c0c12ebcc7c6124678bf7b15f8da54fbe880
|
4
|
+
data.tar.gz: 91dff111be7d365d021643e10e73ad7b044e701d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aab3f8c680143aebe51c2fd4a9818f24cc62549b9f00b6e83fc70b554e051815207a49d56374c3c514965256a8688913f5fa0f8ed256a054edfb9e6f5a123c2e
|
7
|
+
data.tar.gz: f16879391fa6d8d75196a19d956050e4b283e6b7aa5d469d35fb874938d8c1e6107b1f278b0e09b21271df7bb1925154f794aa85e8171c8e92e2525afcd7efe1
|
data/Country.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
2
|
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "
|
4
|
+
require "countries_cli/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "countries_cli"
|
8
|
-
spec.version =
|
8
|
+
spec.version = CountriesCli::VERSION
|
9
9
|
spec.authors = ["Kenneth Young Castro"]
|
10
10
|
spec.email = ["kenneth.young90@gmail.com"]
|
11
11
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,84 +4,50 @@ A CLI of countries based on the REST Countries API. It allows you to look for in
|
|
4
4
|
|
5
5
|
## Getting Started
|
6
6
|
|
7
|
-
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
|
7
|
+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
|
8
8
|
|
9
9
|
### Prerequisites
|
10
10
|
|
11
|
-
|
11
|
+
You will need to have bundler installed. To install, go to your terminal and run:
|
12
12
|
|
13
13
|
```
|
14
|
-
|
14
|
+
gem install bundler
|
15
15
|
```
|
16
16
|
|
17
17
|
### Installing
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
Say what the step will be
|
19
|
+
To install, go to your terminal and run:
|
22
20
|
|
23
21
|
```
|
24
|
-
|
22
|
+
gem install countries_cli
|
25
23
|
```
|
26
24
|
|
27
|
-
And
|
25
|
+
And then:
|
28
26
|
|
29
27
|
```
|
30
|
-
|
28
|
+
country
|
31
29
|
```
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
## Running the tests
|
36
|
-
|
37
|
-
Explain how to run the automated tests for this system
|
31
|
+
Now you should be seeing a menu similar to this:
|
38
32
|
|
39
|
-
|
33
|
+
![countries_cli menu](https://i.imgur.com/NA7eqEr.png)
|
40
34
|
|
41
|
-
|
42
|
-
|
43
|
-
```
|
44
|
-
Give an example
|
45
|
-
```
|
46
|
-
|
47
|
-
### And coding style tests
|
48
|
-
|
49
|
-
Explain what these tests test and why
|
50
|
-
|
51
|
-
```
|
52
|
-
Give an example
|
53
|
-
```
|
54
|
-
|
55
|
-
## Deployment
|
56
|
-
|
57
|
-
Add additional notes about how to deploy this on a live system
|
58
|
-
|
59
|
-
## Built With
|
60
|
-
|
61
|
-
* [Dropwizard](http://www.dropwizard.io/1.0.2/docs/) - The web framework used
|
62
|
-
* [Maven](https://maven.apache.org/) - Dependency Management
|
63
|
-
* [ROME](https://rometools.github.io/rome/) - Used to generate RSS Feeds
|
35
|
+
Happy Searching! =)
|
64
36
|
|
65
37
|
## Contributing
|
66
38
|
|
67
|
-
Please
|
68
|
-
|
69
|
-
## Versioning
|
70
|
-
|
71
|
-
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
|
39
|
+
Please feel free to contribute :)
|
72
40
|
|
73
41
|
## Authors
|
74
42
|
|
75
|
-
* **
|
43
|
+
* **Kenneth Young Castro** - *Initial work* - [kyoung90](https://github.com/kyoung90)
|
76
44
|
|
77
|
-
See also the list of [contributors](https://github.com/
|
45
|
+
See also the list of [contributors](https://github.com/kyoung90/country/graphs/contributors) who participated in this project.
|
78
46
|
|
79
47
|
## License
|
80
48
|
|
81
49
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
82
50
|
|
83
|
-
##
|
51
|
+
## Link
|
84
52
|
|
85
|
-
*
|
86
|
-
* Inspiration
|
87
|
-
* etc
|
53
|
+
* [RubyGem countries_cli](https://rubygems.org/gems/countries_cli)
|
data/bin/console
CHANGED
data/bin/country
CHANGED
@@ -2,7 +2,7 @@ require_relative 'country'
|
|
2
2
|
require 'open-uri'
|
3
3
|
require 'json'
|
4
4
|
# CLI Controller
|
5
|
-
class
|
5
|
+
class CountriesCli::CLI
|
6
6
|
|
7
7
|
def initialize()
|
8
8
|
# Get all countries from API in JSON format
|
@@ -10,7 +10,7 @@ class Country::CLI
|
|
10
10
|
countries = JSON.parse(page.read)
|
11
11
|
# Parse JSON to objects
|
12
12
|
countries.each do |country|
|
13
|
-
|
13
|
+
CountriesCli::COUNTRY.new(country)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -69,13 +69,13 @@ class Country::CLI
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def list_all_country_names
|
72
|
-
|
72
|
+
CountriesCli::COUNTRY.all_country_names
|
73
73
|
end
|
74
74
|
|
75
75
|
def search_by_name
|
76
76
|
puts "Please enter the name: "
|
77
77
|
input = gets.chomp
|
78
|
-
country =
|
78
|
+
country = CountriesCli::COUNTRY.search_by_name(input)
|
79
79
|
if country
|
80
80
|
country.info
|
81
81
|
puts "\n"
|
@@ -87,7 +87,7 @@ class Country::CLI
|
|
87
87
|
def search_by_suffix
|
88
88
|
puts "Please enter the suffix: "
|
89
89
|
input = gets.chomp
|
90
|
-
country =
|
90
|
+
country = CountriesCli::COUNTRY.search_by_suffix(input)
|
91
91
|
if country
|
92
92
|
country.info
|
93
93
|
puts "\n"
|
@@ -99,7 +99,7 @@ class Country::CLI
|
|
99
99
|
def search_by_currency_symbol
|
100
100
|
puts "Please enter the currency symbol: "
|
101
101
|
input = gets.chomp
|
102
|
-
countries =
|
102
|
+
countries = CountriesCli::COUNTRY.search_all_with_currency_symbol(input)
|
103
103
|
if countries.count > 0
|
104
104
|
countries.each do |country|
|
105
105
|
country.info
|
@@ -113,7 +113,7 @@ class Country::CLI
|
|
113
113
|
def search_by_currency_name
|
114
114
|
puts "Please enter the currency name: "
|
115
115
|
input = gets.chomp
|
116
|
-
countries =
|
116
|
+
countries = CountriesCli::COUNTRY.search_all_with_currency_name(input)
|
117
117
|
if countries.count > 0
|
118
118
|
countries.each do |country|
|
119
119
|
country.info
|
@@ -127,7 +127,7 @@ class Country::CLI
|
|
127
127
|
def search_by_language
|
128
128
|
puts "Please enter a language: "
|
129
129
|
input = gets.chomp
|
130
|
-
countries =
|
130
|
+
countries = CountriesCli::COUNTRY.search_all_with_language(input)
|
131
131
|
if countries.count > 0
|
132
132
|
countries.each do |country|
|
133
133
|
country.info
|
@@ -145,7 +145,7 @@ class Country::CLI
|
|
145
145
|
if input.downcase == "l" || input.downcase == "lower" || input.downcase == "g" || input.downcase == "greater" || input.downcase == "h" || input.downcase == "higher"
|
146
146
|
puts "Enter population (ex: 10000): "
|
147
147
|
population = gets.chomp.to_i
|
148
|
-
countries =
|
148
|
+
countries = CountriesCli::COUNTRY.search_all_with_population(input, population)
|
149
149
|
if countries.count > 0
|
150
150
|
countries.each do |country|
|
151
151
|
country.info
|
@@ -164,13 +164,13 @@ class Country::CLI
|
|
164
164
|
puts "Ascending(a) or descending(d)?"
|
165
165
|
input = gets.chomp
|
166
166
|
if input == "d"
|
167
|
-
countries_sorted =
|
167
|
+
countries_sorted = CountriesCli::COUNTRY.all.sort{|country1, country2| country2.population <=> country1.population}
|
168
168
|
countries_sorted.each do |country|
|
169
169
|
country.info
|
170
170
|
puts "\n"
|
171
171
|
end
|
172
172
|
elsif input == "a"
|
173
|
-
countries_sorted =
|
173
|
+
countries_sorted = CountriesCli::COUNTRY.all.sort{|country1, country2| country1.population <=> country2.population}
|
174
174
|
countries_sorted.each do |country|
|
175
175
|
country.info
|
176
176
|
puts "\n"
|
@@ -184,7 +184,7 @@ class Country::CLI
|
|
184
184
|
def search_by_capital
|
185
185
|
puts "Please enter the capital: "
|
186
186
|
input = gets.chomp
|
187
|
-
country =
|
187
|
+
country = CountriesCli::COUNTRY.search_by_capital(input)
|
188
188
|
if country
|
189
189
|
country.info
|
190
190
|
puts "\n"
|
@@ -196,7 +196,7 @@ class Country::CLI
|
|
196
196
|
def search_by_region
|
197
197
|
puts "Please enter the region: "
|
198
198
|
input = gets.chomp
|
199
|
-
countries =
|
199
|
+
countries = CountriesCli::COUNTRY.search_by_region(input)
|
200
200
|
if countries.count > 0
|
201
201
|
countries.each do |country|
|
202
202
|
country.info
|
@@ -210,7 +210,7 @@ class Country::CLI
|
|
210
210
|
def search_by_subregion
|
211
211
|
puts "Please enter the subregion: "
|
212
212
|
input = gets.chomp
|
213
|
-
countries =
|
213
|
+
countries = CountriesCli::COUNTRY.search_by_subregion(input)
|
214
214
|
if countries.count > 0
|
215
215
|
countries.each do |country|
|
216
216
|
country.info
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: countries_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Young Castro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,10 +88,10 @@ files:
|
|
88
88
|
- bin/console
|
89
89
|
- bin/country
|
90
90
|
- bin/setup
|
91
|
-
- lib/
|
92
|
-
- lib/
|
93
|
-
- lib/
|
94
|
-
- lib/
|
91
|
+
- lib/countries_cli.rb
|
92
|
+
- lib/countries_cli/cli.rb
|
93
|
+
- lib/countries_cli/country.rb
|
94
|
+
- lib/countries_cli/version.rb
|
95
95
|
homepage: https://github.com/kyoung90/country
|
96
96
|
licenses:
|
97
97
|
- MIT
|
data/lib/Country.rb
DELETED
data/lib/Country/version.rb
DELETED