twenty_sixteen 0.1.1 → 0.1.2

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: 85b0c555d3f6b0cde17cd687bb4800dfe91d3aa7
4
- data.tar.gz: 467edba01191f208beb89efac1bd4299d11d5e60
3
+ metadata.gz: 2ebb50875827843f9ea6ce824bc284ad57269e2e
4
+ data.tar.gz: 92446ac9056d8f529c941c8545d80b254a70589e
5
5
  SHA512:
6
- metadata.gz: 3047bc03ee14a1314576f2777b990eece816cbe259c83c9150b8a8d704d747bd28363b420ee4603e4243751e2ec8fb26f67d98439ac455ccc630587849114743
7
- data.tar.gz: 5d0a1d0af243d2e72896f475a34072196d52147222ddf011c7d3ad83d77b12ff391a58f6361c93ce9c6c4ee7b5c22dad92d77658ace1f575cae6bcce0ea24e36
6
+ metadata.gz: 4893c77a65f89c19bbe32fa5f1b5354c97b49cff8d30c597e157b67ac1940005ddc4879e793828195e219cc85e68782bd19ecd477ba888b75e88e9b6558873b9
7
+ data.tar.gz: fcd82194c3886dd17f8c8adb218e94eb6c01f47140bba7b296cf41951459d3ea662e90ad890aea1e4892261e1d6b0c704faf66d2a85bfd985eb0fc4e59a13583
data/README.md CHANGED
@@ -24,10 +24,7 @@ Or install it yourself as:
24
24
 
25
25
  ### Client-side
26
26
 
27
- Feel free to make client-side requests for the JSON data file:
28
- + https://raw.githubusercontent.com/debate-watch/twenty_sixteen/master/lib/twenty_sixteen/candidates.json
29
-
30
- Thanks to GitHub for hosting.
27
+ Request the [hosted JSON data file](https://raw.githubusercontent.com/debate-watch/twenty_sixteen/master/lib/twenty_sixteen/candidates.json).
31
28
 
32
29
  ### Server-side
33
30
 
@@ -37,37 +34,21 @@ List all candidates running for President.
37
34
 
38
35
  ```` rb
39
36
  candidates = TwentySixteen::Candidate.all
40
- candidates.each do |candidate|
41
- puts candidate
42
- #=> {
43
- # :party=>"Democrat",
44
- # :first_name=>"Jim",
45
- # :last_name=>"Webb",
46
- # :url=>"http://www.webb2016.com/",
47
- # :campaign_name=>nil,
48
- # :slogans=>["Leadership You Can Trust"],
49
- # :social_urls=>
50
- # ["http://www.facebook.com/IHeardMyCountryCalling",
51
- # "http://instagram.com/webb2016/",
52
- # "http://www.twitter.com/jimwebbusa",
53
- # "https://www.youtube.com/channel/UC-Cs55IKt_UoYTMyioTSPww"],
54
- # :support_groups=>[{:name=>"Born Fighting PAC", :url=>"http://www.bornfighting.com"}]
55
- #}
56
- end
57
37
  ````
58
38
 
59
39
  Filter candidates.
60
40
 
61
41
  ```` rb
62
- reps = TwentySixteen::Candidate.republican
63
42
  dems = TwentySixteen::Candidate.democrat
43
+ reps = TwentySixteen::Candidate.republican
44
+ indies = TwentySixteen::Candidate.independent
64
45
  ````
65
46
 
66
47
  Find a specific candidate.
67
48
 
68
49
  ```` rb
69
50
  hrc = TwentySixteen::Candidate.find_by_url("https://www.hillaryclinton.com/")
70
- joe = TwentySixteen::Candidate.find_by_last_name("Biden")
51
+ donald = TwentySixteen::Candidate.find_by_last_name("Trump")
71
52
  ````
72
53
 
73
54
  ## Contributing
@@ -17,6 +17,10 @@ module TwentySixteen
17
17
  all.select{|candidate| candidate[:party] == "Republican"}
18
18
  end
19
19
 
20
+ def self.independent
21
+ all.select{|candidate| candidate[:party] == "Independent"}
22
+ end
23
+
20
24
  def self.find_by_url(url)
21
25
  all.find{|candidate| candidate[:url] == url}
22
26
  end
@@ -1,3 +1,3 @@
1
1
  module TwentySixteen
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -29,6 +29,15 @@ module TwentySixteen
29
29
  end
30
30
  end
31
31
 
32
+ describe '#independent' do
33
+ it "returns an array of matching candidates, indies only" do
34
+ indies = TwentySixteen::Candidate.independent
35
+ expect(indies).to be_kind_of(Array)
36
+ expect(indies).not_to be_empty
37
+ expect(indies.first).to be_kind_of(Hash)
38
+ end
39
+ end
40
+
32
41
  describe '#find_by_url' do
33
42
  it "returns a candidate whose campaign url matches the paramater" do
34
43
  hrc = TwentySixteen::Candidate.find_by_url("https://www.hillaryclinton.com/")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twenty_sixteen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MJ Rossetti (@s2t2)