Class: GovKit::OpenCongress::VotingComparison

Inherits:
OpenCongressObject show all
Defined in:
lib/gov_kit/open_congress/voting_comparison.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_votesObject

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_votesObject

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

#percentageObject

Returns the value of attribute percentage.



6
7
8
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6

def percentage
  @percentage
end

#person1Object

Returns the value of attribute person1.



6
7
8
# File 'lib/gov_kit/open_congress/voting_comparison.rb', line 6

def person1
  @person1
end

#person2Object

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_voteObject

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_committeesObject

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_votesObject

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_peopleObject



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_votesObject



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