Skip to content

Commit

Permalink
Person abstraction now initializes from OpenCongress and pulls contri…
Browse files Browse the repository at this point in the history
…butions from TransparencyData
  • Loading branch information
NateBarnes committed May 6, 2012
1 parent 041ad2a commit 0a0cced
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
1 change: 1 addition & 0 deletions lib/gov_kit.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module GovKit
autoload :FollowTheMoney, 'gov_kit/follow_the_money' autoload :FollowTheMoney, 'gov_kit/follow_the_money'
autoload :OpenCongress, 'gov_kit/open_congress' autoload :OpenCongress, 'gov_kit/open_congress'
autoload :SearchEngines, 'gov_kit/search_engines' autoload :SearchEngines, 'gov_kit/search_engines'
autoload :Person, "gov_kit/person"


# Convenience class to represent a news story or blog post. # Convenience class to represent a news story or blog post.
# Used by GovKit::SearchEngines classes. # Used by GovKit::SearchEngines classes.
Expand Down
16 changes: 9 additions & 7 deletions lib/gov_kit/bill.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,11 +1,13 @@
class Bill module GovKit
attr_accessor :bill_type, :id, :introduced, :last_speech, :last_vote_date, :last_vote_roll, :last_vote_where, :last_action, :number, :plain_language_summary, :session, :sponsor, :co_sponsors, :title_full_common, :status, :most_recent_actions, :bill_titles, :recent_blogs, :recent_news, :ident class Bill
attr_accessor :bill_type, :id, :introduced, :last_speech, :last_vote_date, :last_vote_roll, :last_vote_where, :last_action, :number, :plain_language_summary, :session, :sponsor, :co_sponsors, :title_full_common, :status, :most_recent_actions, :bill_titles, :recent_blogs, :recent_news, :ident


def initialize def initialize


end end


def self.find def self.find opts

GovKit::OpenCongress::Bill.find opts
end
end end
end end
32 changes: 19 additions & 13 deletions lib/gov_kit/person.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,18 +1,24 @@
class Person module GovKit
attr_accessor :firstname, :lastname, :bioguideid, :birthday, :district, :email, :gender, :id, :metavid_id, :middlename, class Person
:name, :nickname, :osid, :party, :religion, :state, :title, :unaccented_name, :url, :user_approval, attr_accessor :firstname, :lastname, :bioguideid, :birthday, :district, :email, :gender, :id, :metavid_id, :middlename,
:youtube_id, :oc_user_comments, :oc_users_tracking, :abstains_percentage, :with_party_percentage, :recent_news, :name, :nickname, :osid, :party, :religion, :state, :title, :unaccented_name, :url, :user_approval,
:recent_blogs, :person_stats, :contributions :youtube_id, :oc_user_comments, :oc_users_tracking, :abstains_percentage, :with_party_percentage, :recent_news,
:recent_blogs, :person_stats, :contributions


def initialize def initialize


end end


def self.find def self.find opts

s = self.new
end oc_person = GovKit::OpenCongress::Person.find(opts).first
oc_person.instance_variables.each { |var| s.instance_variable_set(var, oc_person.send(var.to_s.delete "@")) }
s
end


def contributions def contributions

@contributions = GovKit::TransparencyData::Contribution.search( :recipient_ft => "#{firstname} #{lastname}" ) if @contributions.nil?
@contributions
end
end end
end end

0 comments on commit 0a0cced

Please sign in to comment.