postcode_gem 0.3.5 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63e56495470c999b6a37bd619eb97a8c6272c8636d6451134eccb7d109b10f1d
4
- data.tar.gz: ae1c19704a9bbf6026a98795ef3aba31010077b0c551e7ea4a31a4ed08063936
3
+ metadata.gz: 12e9f17778220e34566b5b2d66f016a76173a52e6cf61d579fbd97e945a25e78
4
+ data.tar.gz: c4d38006e6e6ba8933bca39f670f48b2447c8111773d0122e619bb5562012e70
5
5
  SHA512:
6
- metadata.gz: cefa6d0d888e4b0823662c9d8143d5b3a735079b11b9ab3ad33d4294c932cf238c8e75bc5af8f349113fa0616ee63370a4843cd974e6b0a3114d048ca292c9ee
7
- data.tar.gz: 897c0654f9b731457e9c99b4a1f85ef079bb57614308e9561827d4433e30c106fa934aa222dd2a27df6fa4fd2d6aad4c9791ed8a7810a71964a62726d63dd3a4
6
+ metadata.gz: a3e1d440aff5d46d5b0b038c67c7d29f6bb6df8cfbf9c7e640a5f99cde7f199e0766dd42b60a2fb9580ecc910dac7c56c48d1cd0515d1dbbc1cff3f5ecb86922
7
+ data.tar.gz: bde474e7030d92c2766f38d01213ead4e5c0bcfca4fca82e9adabf4dc7a921f020c2114179c8bfa0b8bad2234624c572eb0c1f9df7addaf8bd7e601f20cdc902
@@ -1,23 +1,18 @@
1
1
  require_relative '../lib/postcode_gem/version'
2
+ require_relative '../lib/postcode_gem/postcode_areacode'
2
3
  require "json"
3
4
  require "tty-prompt"
4
5
  require "pry"
5
6
 
6
7
  module PostcodeGem
7
- def self.select_country
8
- @data = JSON.load(File.read('./data/postcode_areacode.json'))
9
- attr_accessor :country, :city, :zipcode
8
+ attr_accessor :country, :city, :zipcode
9
+ def output_zipcode
10
+ @data = PostcodeAreacode::DATA
10
11
  prompt = TTY::Prompt.new
11
12
  @country = prompt.select('Enter the country you want to select', %w(Vietnam England Japan))
12
- end
13
- def self.process_input
14
- select_country
15
13
  print "Enter the city or area code you want to search: "
16
14
  @city_zipcode = gets.chomp
17
15
  @firstWord = @city_zipcode.split('')[0]
18
- end
19
- def output_zipcode
20
- process_input
21
16
  @city = @data["#{@country}"].values
22
17
  @zipcode = @data["#{@country}"].keys
23
18
  @data_country = @data["#{@country}"]
@@ -35,3 +30,11 @@ module PostcodeGem
35
30
  end
36
31
  module_function :output_zipcode
37
32
  end
33
+
34
+ class Show
35
+ include PostcodeGem
36
+ def call_result
37
+ output_zipcode
38
+ end
39
+ end
40
+
@@ -1,3 +1,3 @@
1
1
  module PostcodeGem
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.10"
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.3.5
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - PhuongTr1501