postcode_gem 0.2.3 → 0.2.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cd39242ccd49e83c10b7c2f4f47005329d7f4fed9ce6dab55021a1fcf370bda
4
- data.tar.gz: 7716698b1fd7bd3cd73d659fd6d13fdb15a80a64cecd0209568aecbdf44ba3d7
3
+ metadata.gz: 42243b993d9fcdf197903c77eba292c7c9e28be98bab59a10e6ad197f9d9f439
4
+ data.tar.gz: 19ea5bbfa7bafea06acf15f02d35b384cf68bbe1231cad71aea62ec2aaeba692
5
5
  SHA512:
6
- metadata.gz: e2b535bf70f16f105d445a14823871e1ee4f66e4cb149d4a1cc96bf3183832c2b1c847a6ecacc4dbc96b6537a092ceef5baf1d20c17875f5b12bf77ad57c7275
7
- data.tar.gz: 73c0472dc9dec6272943f1cb1c50bd587eeab98700e033e0ebdcba122867a1a567fa26a49ef5a13d99e15b4960f90b4bf957cf854e92d17cefb0a72ed0c20ad2
6
+ metadata.gz: 11099c43b6e277a525defd8c018fd3667a42e310678da4a17b9359ac2959a2a30fb51fca4b52af4d2baa662c739f34eb6fce609fba4a932dce29d5c9f6891313
7
+ data.tar.gz: ef880366a88f9f4f0061a49cc851d427e1f1f6747fde28705a2e6b80037151762b6a6a7e709bc52fd54f0d823d5f873ef3871a40ff65dd2c6c431184529c826f
data/Gemfile CHANGED
@@ -8,3 +8,4 @@ gem "rspec", "~> 3.0"
8
8
  gem 'tty-spinner'
9
9
  gem 'tty-table'
10
10
  gem 'pry'
11
+ gem 'json'
@@ -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 = DATA["#{@country}"].values
23
- @zipcode = DATA["#{@country}"].keys
24
- @data_country = 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}")
@@ -1,3 +1,3 @@
1
1
  module PostcodeGem
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postcode_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - PhuongTr1501