Class: GovTrack::VoteVoter

Inherits:
Base show all
Defined in:
lib/govtrack/vote_voter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, #eql?, find_by_id, find_by_uri, method_missing

Constructor Details

#initialize(attributes = {}) ⇒ VoteVoter

Returns a new instance of VoteVoter.



4
5
6
7
# File 'lib/govtrack/vote_voter.rb', line 4

def initialize(attributes={})
  super
  @created = DateTime.parse(@created) if @created
end

Class Method Details

.find(args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/govtrack/vote_voter.rb', line 9

def self.find(args)
  #allows searching with Person and Vote objects
  args.each { |k,v|
    args[k] = v.id  if v.class == GovTrack::Person || v.class == GovTrack::Vote || v.class == GovTrack::PaginatedList
  }
  super
end

Instance Method Details

#personObject



17
18
19
# File 'lib/govtrack/vote_voter.rb', line 17

def person
  @person.class == GovTrack::Person ? @person : @person = GovTrack::Person.find_by_uri(@person)
end

#voteObject



21
22
23
# File 'lib/govtrack/vote_voter.rb', line 21

def vote
  @vote.class == GovTrack::Vote ? @vote : @vote = GovTrack::Vote.find_by_uri(@vote)
end