get-your-rep 1.0.0.1 → 1.1.0

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: 0f800afcd86e1ceb01731dd15f8a6ee0f4142bab
4
- data.tar.gz: 64c3107718dd3036bcee398db92fea17c61466b8
3
+ metadata.gz: 525f29909bf1690e4fe35ca0b23571e9e5aa2c1d
4
+ data.tar.gz: d6378420bd8bf41840d5b91764474146a721fcae
5
5
  SHA512:
6
- metadata.gz: 9f100f82620fe8c53c7cef27b5d12dab61b79ee54f75f86788c651c465fa4a436208c48d9d1b093d62a40d8a84d48f3f44da40111332a3ce2cd9f4587332e184
7
- data.tar.gz: d9a16f2f43f39ca951f3aaebe2b7ff63af17104c604f8189848c34cda04f3f319ee3c83c4f8394c3bd2520e7b05807ee4891f42eede116d278a465c258be7c22
6
+ metadata.gz: 286fc80f857728c5180ad4547aa072123ea10ead4eaff9c97b5ec58f81e0f841b04bdea0bdfa5468b0f7902a3bc5574fbc8891fef86592f3928649b58cc57bcf
7
+ data.tar.gz: 7af1318a9327e8d8d3245672247f4102dcba9693c8d49ef81b9d10c1b5c702e4e243b0963933a525d8c69a2f1fa0f7d5882bbb6ad7c7a728922c9e45bb0defd6
@@ -1,6 +1,7 @@
1
1
  # require 'pry'
2
2
  require 'httparty'
3
3
  require_relative 'get-your-rep/delegation.rb'
4
+ require_relative 'get-your-rep/patches.rb'
4
5
 
5
6
  # The GetYourRep class has a collection of class methods that retrieve your elected representatives
6
7
  # from the Google Civic Information API, parse it from JSON, and assemble it into a usable
@@ -10,6 +10,11 @@ class Delegation < Array
10
10
  end
11
11
  end
12
12
 
13
+ # Overloads the + operator to return a new Delegation instead of an Array.
14
+ def +(value)
15
+ Delegation.new(super)
16
+ end
17
+
13
18
  # Collects the first names of every rep in the Delegation.
14
19
  def first_names
15
20
  self.map { |rep| rep[:name].split[0..-2].join(' ')}
@@ -28,12 +33,7 @@ class Delegation < Array
28
33
  card[i] = []
29
34
  rep.each do |key, value|
30
35
  next if value.nil?
31
- case key
32
- when :facebook
33
- card[i] << "#{key.to_s.capitalize}: #{value}"
34
- when :twitter
35
- card[i] << "#{key.to_s.capitalize}: #{value}"
36
- when :youtube
36
+ if key == :facebook || key == :twitter || key == :youtube || key == :googleplus
37
37
  card[i] << "#{key.to_s.capitalize}: #{value}"
38
38
  else
39
39
  card[i] << "#{value}"
@@ -0,0 +1,16 @@
1
+ # :nodoc
2
+ class Array
3
+ # Converts an Array to a Delegation
4
+ def to_del
5
+ Delegation.new(self)
6
+ end
7
+ end
8
+
9
+ # :nodoc
10
+ class Hash
11
+ # Converts a Hash to a Delegation
12
+ def to_del
13
+ del = Delegation.new
14
+ del << self
15
+ end
16
+ 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.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - msimonborg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-10 00:00:00.000000000 Z
11
+ date: 2016-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -38,6 +38,26 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.10'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 5.10.1
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '5.10'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 5.10.1
41
61
  description: Get your rep with Google's Civic Information API using your address and
42
62
  API key.
43
63
  email: msimonborg@gmail.com
@@ -47,6 +67,7 @@ extra_rdoc_files: []
47
67
  files:
48
68
  - lib/get-your-rep.rb
49
69
  - lib/get-your-rep/delegation.rb
70
+ - lib/get-your-rep/patches.rb
50
71
  homepage: https://github.com/msimonborg/get-your-rep
51
72
  licenses:
52
73
  - MIT