Class: GovKit::OpenCongress::VotingComparison
- Inherits:
-
OpenCongressObject
- Object
- OpenCongressObject
- GovKit::OpenCongress::VotingComparison
- Defined in:
- lib/gov_kit/open_congress/voting_comparison.rb
Instance Attribute Summary collapse
-
#hot_votes ⇒ Object
Returns the value of attribute hot_votes.
-
#other_votes ⇒ Object
Returns the value of attribute other_votes.
-
#percentage ⇒ Object
Returns the value of attribute percentage.
-
#person1 ⇒ Object
Returns the value of attribute person1.
-
#person2 ⇒ Object
Returns the value of attribute person2.
-
#same_vote ⇒ Object
Returns the value of attribute same_vote.
-
#shared_committees ⇒ Object
Returns the value of attribute shared_committees.
-
#total_votes ⇒ Object
Returns the value of attribute total_votes.
Instance Method Summary collapse
-
#initialize(params) ⇒ VotingComparison
constructor
A new instance of VotingComparison.
- #set_people ⇒ Object
- #set_votes ⇒ Object
Methods inherited from OpenCongressObject
construct_url, hash2get, make_call, parse_supporting_results
Constructor Details
#initialize(params) ⇒ VotingComparison
Returns a new instance of VotingComparison.
9 10 11 12 13 14 15 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 9 def initialize(params) super VotingComparison, params set_people set_votes end |
Instance Attribute Details
#hot_votes ⇒ Object
Returns the value of attribute hot_votes.
6 7 8 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6 def hot_votes @hot_votes end |
#other_votes ⇒ Object
Returns the value of attribute other_votes.
6 7 8 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6 def other_votes @other_votes end |
#percentage ⇒ Object
Returns the value of attribute percentage.
6 7 8 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6 def percentage @percentage end |
#person1 ⇒ Object
Returns the value of attribute person1.
6 7 8 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6 def person1 @person1 end |
#person2 ⇒ Object
Returns the value of attribute person2.
6 7 8 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6 def person2 @person2 end |
#same_vote ⇒ Object
Returns the value of attribute same_vote.
6 7 8 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6 def same_vote @same_vote end |
#shared_committees ⇒ Object
Returns the value of attribute shared_committees.
6 7 8 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6 def shared_committees @shared_committees end |
#total_votes ⇒ Object
Returns the value of attribute total_votes.
6 7 8 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6 def total_votes @total_votes end |
Instance Method Details
#set_people ⇒ Object
17 18 19 20 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 17 def set_people self.person1 = Person.new(self.person1["person"]) self.person2 = Person.new(self.person2["person"]) end |
#set_votes ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 22 def set_votes these_hot_votes = [] hot_votes["vote"].each do |v| nv = RollCallComparison.new(v) these_hot_votes << nv end self.hot_votes = these_hot_votes these_other_votes = [] other_votes["vote"].each do |v| nv = RollCallComparison.new(v) these_other_votes << nv end self.other_votes = these_other_votes end |