postcode_gem 0.2.2 → 0.2.7
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 +4 -4
- data/Gemfile +1 -0
- data/lib/postcode_gem.rb +4 -5
- data/lib/postcode_gem/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1eab1e7cd2da8739aede700bd989d6b722ed7dd3ffbd070c037e47d2e978d92f
|
|
4
|
+
data.tar.gz: fde152bc2fd49d7879ebe9848ff5fd01022a692bd69b41f061c8ba8ebc10bf4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6137797d35904ee9b500d83f9829719cb33db82f363afc3f1e96b1d25441a0100ce7e0911ae145881ded9ac9d30cf47467b748def0c9f226ef75718367f0a581
|
|
7
|
+
data.tar.gz: 790ee54e009f940446fb1ad3efadd9730fb1d2874113e5c57627694d45ca88d7581344ca16c2cbb0fa44a0459ca8280637548e415cd91f8e8b4d3b2bcacfc0c0
|
data/Gemfile
CHANGED
data/lib/postcode_gem.rb
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
require "tty-prompt"
|
|
3
3
|
require "pry"
|
|
4
|
-
require_relative "../lib/postcode_gem/version"
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
module PostcodeGem
|
|
8
|
-
DATA = JSON.parse(File.read('../data/postcode_areacode.json'))
|
|
9
7
|
def self.select_country
|
|
8
|
+
@data = JSON.load(File.read('./data/postcode_areacode.json'))
|
|
10
9
|
attr_accessor :country, :city, :zipcode
|
|
11
10
|
prompt = TTY::Prompt.new
|
|
12
11
|
@country = prompt.select('Enter the country you want to select', %w(Vietnam England Japan))
|
|
@@ -19,9 +18,9 @@ module PostcodeGem
|
|
|
19
18
|
end
|
|
20
19
|
def output_zipcode
|
|
21
20
|
process_input
|
|
22
|
-
@city =
|
|
23
|
-
@zipcode =
|
|
24
|
-
@data_country =
|
|
21
|
+
@city = @data["#{@country}"].values
|
|
22
|
+
@zipcode = @data["#{@country}"].keys
|
|
23
|
+
@data_country = @data["#{@country}"]
|
|
25
24
|
|
|
26
25
|
if @data_country.has_key?(@city_zipcode)
|
|
27
26
|
puts @data_country.values_at("#{@city_zipcode}")
|
data/lib/postcode_gem/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: postcode_gem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- PhuongTr1501
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-01-
|
|
11
|
+
date: 2020-01-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: this is postcode country of mine
|
|
14
14
|
email:
|