get_your_rep 1.0.3 → 1.0.4

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: e8903500f5a86d756aa68e7bffdd7eaa4a52058e
4
- data.tar.gz: 82ac60af8212e35ac135e5b76c4d877435f55319
3
+ metadata.gz: 7fe38bde07d4ade3dfcb86928ca140ed53b6761e
4
+ data.tar.gz: 6eedfe6c5b68af6e447c9d7b4b6221e531e31853
5
5
  SHA512:
6
- metadata.gz: 005fe820fb6e3fd02da4c76ba145986b69178a377e5bbd0cea107c1a278e3dc678efa77ce9e5868e02844f9509be11f1601b7b464acca74ac6e158a04194cee1
7
- data.tar.gz: 071e86ac4688a8cd2e47f91540a2301b7f2ee3b8ae7884354700fd9b9a56728a6f54023f3816c9e98154cedd48420dc107b8a761b164e561601470c0af5ecb26
6
+ metadata.gz: de3a833357b414447dc44002dc3260c61808661a9a11ffd2bc52d62f92286113711b133d9b13617af80ef724432df9897a00fa0b8e2f24217707d59116870c02
7
+ data.tar.gz: a14e284a91c1ad1bee2ebf5771df47d58e6bccf6fb2cbc9edae7f0c9fcf0ae22214d6fc1212b12abb811148a05bb6115a65ad05562ad1ecdc00b6c8e96f4bad8
@@ -59,9 +59,9 @@ module GetYourRep
59
59
  puts "'address'................displays address or sets it if there is none".bold.blue
60
60
  puts "'set address'............set a new address".bold.blue
61
61
  puts "'all reps'...............get federal legislators from Google".bold.blue
62
- puts " and state legislators from Open States".bold.blue
62
+ puts ' and state legislators from Open States'.bold.blue
63
63
  puts "'google all reps'........get all federal and state executives and".bold.blue
64
- puts " legislators from Google".bold.blue
64
+ puts ' legislators from Google'.bold.blue
65
65
  puts "'google congress only'...get only congress from Google".bold.blue
66
66
  puts "'open states'............get only state legislators from Open States".bold.blue
67
67
  end
@@ -19,7 +19,7 @@ module GetYourRep
19
19
  def all_reps(address)
20
20
  self.coordinates = address.is_a?(Array) ? address : get_coordinates(address)
21
21
  self.response = find_rep
22
- if response.nil? || response.is_a?(String) || response.first['error']
22
+ if !response || response.is_a?(String) || response.first['error']
23
23
  handle_reps_not_found_error
24
24
  else
25
25
  parse_reps
@@ -31,12 +31,11 @@ module GetYourRep
31
31
 
32
32
  # Sets parameters for and executes Open States API request.
33
33
  def find_rep
34
- if coordinates
35
- lat = coordinates.first
36
- long = coordinates.last
37
- url = "http://openstates.org/api/v1/legislators/geo/?lat=#{lat}&long=#{long}"
38
- HTTParty.get(url).parsed_response
39
- end
34
+ return unless coordinates
35
+ lat = coordinates.first
36
+ long = coordinates.last
37
+ url = "http://openstates.org/api/v1/legislators/geo/?lat=#{lat}&long=#{long}"
38
+ HTTParty.get(url).parsed_response
40
39
  end
41
40
 
42
41
  # Parses the JSON response and assembles it into a Delegation object.
@@ -18,8 +18,8 @@ module GetYourRep
18
18
  { name: full_name.split(', ').reverse.join(' '),
19
19
  office: office,
20
20
  party: party,
21
- phones: phones - [nil],
22
21
  office_locations: office_locations,
22
+ phones: phones - [nil],
23
23
  email: email - [nil],
24
24
  url: url,
25
25
  photo: photo_url,
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GetYourRep
3
- VERSION = '1.0.3' # :nodoc:
3
+ VERSION = '1.0.4' # :nodoc:
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_your_rep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - msimonborg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-08 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty