china_phone_region 0.0.1
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 +7 -0
- data/data/area_codes_map.json +1951 -0
- data/lib/china_phone_region.rb +9 -0
- metadata +45 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
class ChinaPhoneRegion
|
2
|
+
require 'json'
|
3
|
+
@@ac_map = JSON.parse(File.read(File.expand_path('../../data/area_codes_map.json', __FILE__), mode: 'r'))
|
4
|
+
|
5
|
+
def self.area_code(code)
|
6
|
+
address = @@ac_map['ac' + code]
|
7
|
+
"#{address['province']}#{address['citys'][0]}" unless address.nil?
|
8
|
+
end
|
9
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: china_phone_region
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tyler Chang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Query phone number and area code region!
|
14
|
+
email: TylerChangMore@icloud.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- data/area_codes_map.json
|
20
|
+
- lib/china_phone_region.rb
|
21
|
+
homepage: https://github.com/tyler-chang/china_phone_region
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.4.5.1
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Query regions!
|
45
|
+
test_files: []
|