forked from opengovernment/govkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Person abstraction now initializes from OpenCongress and pulls contri…
…butions from TransparencyData
- Loading branch information
1 parent
041ad2a
commit 0a0cced
Showing
3 changed files
with
29 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |