twenty_sixteen 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2c74e308d79f5cde3cfa9130968b11a0725653e
4
+ data.tar.gz: 241369f3631bf521e2b3a750e72860b2a7d3bd83
5
+ SHA512:
6
+ metadata.gz: 7339f26e60e3665acb529c8a71292e71c828ec74453f101cceb32e94e08e4fcae30e7c612c4745a7fb8bb69117fb7ef6ed9bd2ab3f7358843f1567524550d6fe
7
+ data.tar.gz: d80d03c849c1eb4f3d95ff7d43a9d2ce3f920696127a3b07ccaa05efd7949b03a90e9ac77a4372006c2da04f9458b90cc41878324235f643c14fa9eeb4b777a6
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/CREDITS.md ADDED
@@ -0,0 +1,9 @@
1
+ # Credits, Notes, and References
2
+ ## Candidates
3
+ + http://www.theatlantic.com/politics/archive/2015/07/2016-election/384828/
4
+ + http://www.nytimes.com/interactive/2016/us/elections/2016-presidential-candidates.html?_r=0
5
+ + http://www.cnn.com/specials/politics/2016-election
6
+ + http://www.cnn.com/interactive/2015/05/politics/2016-election-candidates/
7
+
8
+ ## Candidate Support Groups
9
+ + http://www.nytimes.com/politics/first-draft/2015/07/02/super-pac-raises-15-6-million-for-hillary-clinton-campaign/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in twenty_sixteen.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 MJ Rossetti (@s2t2)
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # TwentySixteen
2
+
3
+ A source for data about the 2016 United States Presidential election. Includes a "candidates" endpoint.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'twenty_sixteen'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install twenty_sixteen
20
+
21
+ > A NOTE ON VERSIONING: The master branch is considered live and may contain newer data than the latest rubygems release version. You may want to bundle install using a git reference. Minor version changes will be made to reflect new data, and major version changes may be made to reflect new or revised functionality, which may or may not be backwards-compatible.
22
+
23
+ ## Usage
24
+
25
+ ### Candidates
26
+
27
+ List all candidates running for President.
28
+
29
+ ```` rb
30
+ candidates = TwentySixteen::Candidate.all #> [{},{},{}]
31
+ candidates.each do |candidate|
32
+ # do something crazy
33
+ end
34
+ ````
35
+
36
+ Filter candidates.
37
+
38
+ ```` rb
39
+ reps = Candidate.republican #> [{},{},{}]
40
+ dems = Candidate.democrat #> [{},{},{}]
41
+ ````
42
+
43
+ Find a specific candidate.
44
+
45
+ ```` rb
46
+ hrc = Candidate.find_by_url("https://www.hillaryclinton.com/") #> {}
47
+ joe = Candidate.find_by_last_name("Biden") #> {}
48
+ ````
49
+
50
+ ## Contributing
51
+
52
+ Edit candidate data in **lib/twenty_sixteen/candidate.rb**. Please add new slogans in sequential order of appearance.
53
+
54
+ 1. Fork it ( https://github.com/debate-watch/twenty_sixteen/fork )
55
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
56
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
57
+ 4. Push to the branch (`git push origin my-new-feature`)
58
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,6 @@
1
+ require "twenty_sixteen/version"
2
+
3
+ module TwentySixteen
4
+ end
5
+
6
+ require "twenty_sixteen/candidate"
@@ -0,0 +1,121 @@
1
+ module TwentySixteen
2
+ class Candidate
3
+ CANDIDATES = [
4
+ {
5
+ :party => "Democrat",
6
+ :first_name => "Jim",
7
+ :last_name => "Webb",
8
+ :url => "http://www.webb2016.com/",
9
+ :campaign_name => nil,
10
+ :slogans => ["Leadership You Can Trust"],
11
+ :social_urls => [
12
+ "http://www.facebook.com/IHeardMyCountryCalling",
13
+ "http://instagram.com/webb2016/",
14
+ "http://www.twitter.com/jimwebbusa",
15
+ "https://www.youtube.com/channel/UC-Cs55IKt_UoYTMyioTSPww"
16
+ ],
17
+ :support_groups => [{:name => "Born Fighting PAC", :url => "http://www.bornfighting.com"}]
18
+ },
19
+ {
20
+ :party => "Democrat",
21
+ :first_name => "Hillary",
22
+ :last_name => "Clinton",
23
+ :url => "https://www.hillaryclinton.com/",
24
+ :campaign_name => "Hillary for America",
25
+ :slogans => [],
26
+ :social_urls => [
27
+ "https://www.facebook.com/hillaryclinton",
28
+ "https://twitter.com/hillaryclinton",
29
+ "https://youtube.com/hillaryclinton",
30
+ "https://instagram.com/hillaryclinton"
31
+ ],
32
+ :support_groups => [
33
+ {:name => "Ready PAC (Ready for Hillary)", :url => "https://www.readyforhillary.com/"},
34
+ {:name => "Priorities USA Action", :url => "http://www.prioritiesusaaction.org/"},
35
+ {:name => "American Bridge 21st Century", :url => "https://americanbridgepac.org/"}
36
+ ]
37
+ },
38
+ {
39
+ :party => "Democrat",
40
+ :first_name => "Lincoln",
41
+ :last_name => "Chafee",
42
+ :url => "http://www.chafee2016.com/",
43
+ :campaign_name => "Chafee 2016 Committee",
44
+ :slogans => ["Fresh Ideas for America"],
45
+ :social_urls => [
46
+ "https://www.facebook.com/chafee2016",
47
+ "https://twitter.com/lincolnchafee",
48
+ "https://instagram.com/lincchafee/",
49
+ "https://vimeo.com/chafee2016"
50
+ ],
51
+ :support_groups => []
52
+ },
53
+ {
54
+ :party => "Democrat",
55
+ :first_name => "Martin",
56
+ :last_name => "O'Malley",
57
+ :url => "https://martinomalley.com/",
58
+ :campaign_name => "O'Malley for President",
59
+ :slogans => [],
60
+ :social_urls => [
61
+ "https://facebook.com/MartinOMalley",
62
+ "https://twitter.com/martinomalley",
63
+ "https://youtube.com/channel/UCb7eu74-_tCNLw9FfavvKnw",
64
+ "https://instagram.com/MartinOmalley"
65
+ ],
66
+ :support_groups => []
67
+ },
68
+ {
69
+ :party => "Democrat",
70
+ :first_name => "Bernie",
71
+ :last_name => "Sanders",
72
+ :url => "https://berniesanders.com/",
73
+ :campaign_name => "Bernie 2016",
74
+ :slogans => [],
75
+ :social_urls => [
76
+ "https://www.facebook.com/berniesanders",
77
+ "https://twitter.com/BernieSanders",
78
+ "https://www.youtube.com/channel/UCH1dpzjCEiGAt8CXkryhkZg",
79
+ "https://instagram.com/berniesanders/"
80
+ ],
81
+ :support_groups => []
82
+ }#,
83
+ #{
84
+ # :party => "Democrat",
85
+ # :first_name => "Joe",
86
+ # :last_name => "Biden",
87
+ # :url => "___________",
88
+ # :campaign_name => "__________",
89
+ # :slogans => [],
90
+ # :social_urls => [
91
+ # "_______________",
92
+ # "_________________________________",
93
+ # "_________________________________",
94
+ # "__________"
95
+ # ],
96
+ # :support_groups => []
97
+ #},
98
+ ]
99
+
100
+ def self.all
101
+ CANDIDATES
102
+ end
103
+
104
+ def self.find_by_url(url)
105
+ CANDIDATES.find{|candidate| candidate[:url] == url}
106
+ end
107
+
108
+ # assumes uniqueness of last_name... change `find` to `select` otherwise.
109
+ def self.find_by_last_name(last_name)
110
+ CANDIDATES.find{|candidate| candidate[:last_name] == last_name}
111
+ end
112
+
113
+ def self.democrat
114
+ CANDIDATES.select{|candidate| candidate[:party] == "Democrat"}
115
+ end
116
+
117
+ def self.republican
118
+ CANDIDATES.select{|candidate| candidate[:party] == "Republican"}
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,3 @@
1
+ module TwentySixteen
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'twenty_sixteen/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "twenty_sixteen"
8
+ spec.version = TwentySixteen::VERSION
9
+ spec.authors = ["MJ Rossetti (@s2t2)"]
10
+ spec.email = ["s2t2mail@gmail.com"]
11
+ spec.summary = %q{A source for data about the 2016 United States Presidential election.}
12
+ spec.description = %q{A source for data about the 2016 United States Presidential election. Includes a "candidates" endpoint.}
13
+ spec.homepage = "https://github.com/debate-watch/twenty_sixteen"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: twenty_sixteen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - MJ Rossetti (@s2t2)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: A source for data about the 2016 United States Presidential election.
42
+ Includes a "candidates" endpoint.
43
+ email:
44
+ - s2t2mail@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - CREDITS.md
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/twenty_sixteen.rb
56
+ - lib/twenty_sixteen/candidate.rb
57
+ - lib/twenty_sixteen/version.rb
58
+ - twenty_sixteen.gemspec
59
+ homepage: https://github.com/debate-watch/twenty_sixteen
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.2.2
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: A source for data about the 2016 United States Presidential election.
83
+ test_files: []