geolookup 0.5.9 → 0.5.10
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/CHANGELOG.rdoc +3 -0
- data/README.md +8 -0
- data/lib/geolookup/usa/state.rb +18 -0
- data/lib/geolookup/version.rb +1 -1
- data/spec/lib/state_spec.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df09c01af57af67b9990d661a2117074e781a34b
|
|
4
|
+
data.tar.gz: d7f992d489389ea3e209937472e7e14ec6e605db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67e99b0c5c98d21587b268e978ebaf87acd71911314825bc3a359600cd397244d06d9332fb48665a4ecbc86a402eba154664dc4ced225b053e5f231fa27b8f9e
|
|
7
|
+
data.tar.gz: 8cbc57fc90fff2a914cc11e20bb163cd0d94ac2dbf338fb2823405cb5a592b6356acfeae336965a4bd4d93418450b6e64cc35a773f6ff8b006a904865adc3e79
|
data/CHANGELOG.rdoc
CHANGED
data/README.md
CHANGED
|
@@ -69,6 +69,14 @@ Geolookup::USA::State.domestic_abbreviations
|
|
|
69
69
|
Geolookup::USA::State.domestic_names
|
|
70
70
|
# => ["California", "Arizona", ...]
|
|
71
71
|
|
|
72
|
+
# US state codes and abbreviations
|
|
73
|
+
Geolookup::USA::State.codes_and_abbreviations
|
|
74
|
+
# => {1: "AL", 2: "AK", ...}
|
|
75
|
+
|
|
76
|
+
# US state codes and names
|
|
77
|
+
Geolookup::USA::State.codes_and_names
|
|
78
|
+
# => {1: "Alabama", 2: "Alaska", ...}
|
|
79
|
+
|
|
72
80
|
# US State Codes
|
|
73
81
|
Geolookup::USA::State.codes
|
|
74
82
|
# => [1, 2, 4, ...]
|
data/lib/geolookup/usa/state.rb
CHANGED
|
@@ -117,6 +117,24 @@ module Geolookup
|
|
|
117
117
|
@domestic_state_code_to_name.values
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
+
###################################################################
|
|
121
|
+
# self.names
|
|
122
|
+
#
|
|
123
|
+
# Returns an array of state names
|
|
124
|
+
#
|
|
125
|
+
def self.codes_and_names
|
|
126
|
+
@codes_and_names ||= Geolookup.load_hash_from_file(STATE_CODE_TO_FULL_FILE)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
###################################################################
|
|
130
|
+
# self.names
|
|
131
|
+
#
|
|
132
|
+
# Returns an array of state names
|
|
133
|
+
#
|
|
134
|
+
def self.codes_and_abbreviations
|
|
135
|
+
@codes_and_abbreviations ||= Geolookup.load_hash_from_file(STATE_CODE_TO_ABBREVIATION_FILE)
|
|
136
|
+
end
|
|
137
|
+
|
|
120
138
|
###################################################################
|
|
121
139
|
# self.names
|
|
122
140
|
#
|
data/lib/geolookup/version.rb
CHANGED
data/spec/lib/state_spec.rb
CHANGED
|
@@ -80,6 +80,22 @@ describe "Geolookup::USA::State" do
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
describe "#codes_and_names" do
|
|
84
|
+
it "should return a Hash where the key is the code and the value is the full state name" do
|
|
85
|
+
codes_and_names = Geolookup::USA::State.codes_and_names
|
|
86
|
+
expect(codes_and_names).to be_kind_of(Hash)
|
|
87
|
+
expect(codes_and_names[1]).to be_eql("Alabama")
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
describe "#codes_and_abbreviations" do
|
|
92
|
+
it "should return a Hash where the key is the code and the value is the state abbrevation" do
|
|
93
|
+
codes_and_abbreviations = Geolookup::USA::State.codes_and_abbreviations
|
|
94
|
+
expect(codes_and_abbreviations).to be_kind_of(Hash)
|
|
95
|
+
expect(codes_and_abbreviations[1]).to be_eql("AL")
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
83
99
|
describe "#name_to_lat_long" do
|
|
84
100
|
it "should return a lat / long for state name" do
|
|
85
101
|
expect(Geolookup::USA::State.name_to_lat_long("Alabama")).to eql(state_lat_long)
|