netroots-ruby-votesmart 0.2.3 → 0.2.4

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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 3
4
+ :patch: 4
@@ -5,9 +5,9 @@ module VoteSmart
5
5
  attr_accessor :address, :phone, :notes
6
6
 
7
7
  def initialize attributes
8
- self.address = Address.new(attributes["address"])
9
- self.phone = Phone.new(attributes["phone"])
10
- self.notes = Notes.new(attributes["notes"])
8
+ self.address = Address.new(attributes["address"] || {})
9
+ self.phone = Phone.new(attributes["phone"] || {})
10
+ self.notes = Notes.new(attributes["notes"] || {})
11
11
  end
12
12
 
13
13
  end
@@ -27,6 +27,7 @@ module VoteSmart
27
27
  def self.find_by_district district
28
28
  official = find_by_district_id district.id
29
29
  official.district = district if official
30
+ official.office = district.office if official
30
31
  official
31
32
  end
32
33
 
@@ -47,6 +48,9 @@ module VoteSmart
47
48
 
48
49
  def self.find_all_by_address address, city, state, zip
49
50
  placemark = Geocoding.get("#{address} #{city}, #{state} #{zip}").first
51
+
52
+ return [] unless placemark
53
+
50
54
  state ||= placemark.administrative_area
51
55
 
52
56
  placemark ? find_all_by_state_and_latitude_and_longitude(state, placemark.latitude, placemark.longitude) : []
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netroots-ruby-votesmart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Cunning