geolookup 0.5.9 → 0.5.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
  SHA1:
3
- metadata.gz: f2186eea9bcf0915748926ab83f72fcbb56e38a0
4
- data.tar.gz: 15619a0014bf29cda59aeefd9a87d1841d0ede05
3
+ metadata.gz: df09c01af57af67b9990d661a2117074e781a34b
4
+ data.tar.gz: d7f992d489389ea3e209937472e7e14ec6e605db
5
5
  SHA512:
6
- metadata.gz: 36ce9339a6e7b1c1d865135ec7ac7a2060ffecfec607c306bef38f4d16479af21d25a59a6b31c0860d976f4248aab7882017c781ef47053d62546f84d7107afb
7
- data.tar.gz: 501372fcf31f594f3400c54778a317ad3277a0ebac173e209fb835a38422af9057e3869b13ba28060db96a377dc489a8214178406716e8a8f70e498be4e96a53
6
+ metadata.gz: 67e99b0c5c98d21587b268e978ebaf87acd71911314825bc3a359600cd397244d06d9332fb48665a4ecbc86a402eba154664dc4ced225b053e5f231fa27b8f9e
7
+ data.tar.gz: 8cbc57fc90fff2a914cc11e20bb163cd0d94ac2dbf338fb2823405cb5a592b6356acfeae336965a4bd4d93418450b6e64cc35a773f6ff8b006a904865adc3e79
@@ -1,3 +1,6 @@
1
+ === 0.5.10
2
+ - Adding a new method for getting a Hash of state names/abbreviations and codes.
3
+
1
4
  === 0.5.9
2
5
  - Correcing misspelling on American Samoa
3
6
 
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, ...]
@@ -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
  #
@@ -1,3 +1,3 @@
1
1
  module Geolookup
2
- VERSION = "0.5.9"
2
+ VERSION = "0.5.10"
3
3
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geolookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Fonacier