Class: GovKit::OpenCongress::Bill
- Inherits:
-
OpenCongressObject
- Object
- OpenCongressObject
- GovKit::OpenCongress::Bill
- Defined in:
- lib/gov_kit/open_congress/bill.rb
Instance Attribute Summary collapse
-
#bill_titles ⇒ Object
Returns the value of attribute bill_titles.
-
#bill_type ⇒ Object
Returns the value of attribute bill_type.
-
#co_sponsors ⇒ Object
Returns the value of attribute co_sponsors.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ident ⇒ Object
Returns the value of attribute ident.
-
#introduced ⇒ Object
Returns the value of attribute introduced.
-
#last_action ⇒ Object
Returns the value of attribute last_action.
-
#last_speech ⇒ Object
Returns the value of attribute last_speech.
-
#last_vote_date ⇒ Object
Returns the value of attribute last_vote_date.
-
#last_vote_roll ⇒ Object
Returns the value of attribute last_vote_roll.
-
#last_vote_where ⇒ Object
Returns the value of attribute last_vote_where.
-
#most_recent_actions ⇒ Object
Returns the value of attribute most_recent_actions.
-
#number ⇒ Object
Returns the value of attribute number.
-
#plain_language_summary ⇒ Object
Returns the value of attribute plain_language_summary.
-
#recent_blogs ⇒ Object
Returns the value of attribute recent_blogs.
-
#recent_news ⇒ Object
Returns the value of attribute recent_news.
-
#session ⇒ Object
Returns the value of attribute session.
-
#sponsor ⇒ Object
Returns the value of attribute sponsor.
-
#status ⇒ Object
Returns the value of attribute status.
-
#title_full_common ⇒ Object
Returns the value of attribute title_full_common.
Class Method Summary collapse
- .bills_in_the_news_this_week ⇒ Object
- .find(params) ⇒ Object
- .find_by_idents(idents) ⇒ Object
- .find_by_query(q) ⇒ Object
- .most_blogged_bills_this_week ⇒ Object
- .most_opposed_bills_this_week ⇒ Object
- .most_supported_bills_this_week ⇒ Object
- .most_tracked_bills_this_week ⇒ Object
- .parse_results(result) ⇒ Object
Instance Method Summary collapse
-
#initialize(params) ⇒ Bill
constructor
A new instance of Bill.
- #opencongress_users_opposing_bill_are_also ⇒ Object
- #opencongress_users_supporting_bill_are_also ⇒ Object
Methods inherited from OpenCongressObject
construct_url, hash2get, make_call, parse_supporting_results
Constructor Details
Instance Attribute Details
#bill_titles ⇒ Object
Returns the value of attribute bill_titles.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def bill_titles @bill_titles end |
#bill_type ⇒ Object
Returns the value of attribute bill_type.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def bill_type @bill_type end |
#co_sponsors ⇒ Object
Returns the value of attribute co_sponsors.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def co_sponsors @co_sponsors end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def id @id end |
#ident ⇒ Object
Returns the value of attribute ident.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def ident @ident end |
#introduced ⇒ Object
Returns the value of attribute introduced.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def introduced @introduced end |
#last_action ⇒ Object
Returns the value of attribute last_action.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def last_action @last_action end |
#last_speech ⇒ Object
Returns the value of attribute last_speech.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def last_speech @last_speech end |
#last_vote_date ⇒ Object
Returns the value of attribute last_vote_date.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def last_vote_date @last_vote_date end |
#last_vote_roll ⇒ Object
Returns the value of attribute last_vote_roll.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def last_vote_roll @last_vote_roll end |
#last_vote_where ⇒ Object
Returns the value of attribute last_vote_where.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def last_vote_where @last_vote_where end |
#most_recent_actions ⇒ Object
Returns the value of attribute most_recent_actions.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def most_recent_actions @most_recent_actions end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def number @number end |
#plain_language_summary ⇒ Object
Returns the value of attribute plain_language_summary.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def plain_language_summary @plain_language_summary end |
#recent_blogs ⇒ Object
Returns the value of attribute recent_blogs.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def recent_blogs @recent_blogs end |
#recent_news ⇒ Object
Returns the value of attribute recent_news.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def recent_news @recent_news end |
#session ⇒ Object
Returns the value of attribute session.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def session @session end |
#sponsor ⇒ Object
Returns the value of attribute sponsor.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def sponsor @sponsor end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def status @status end |
#title_full_common ⇒ Object
Returns the value of attribute title_full_common.
4 5 6 |
# File 'lib/gov_kit/open_congress/bill.rb', line 4 def title_full_common @title_full_common end |
Class Method Details
.bills_in_the_news_this_week ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/gov_kit/open_congress/bill.rb', line 36 def self.bills_in_the_news_this_week url = construct_url("bills_in_the_news_this_week", {}) if (result = make_call(url)) bills = parse_results(result) return bills else nil end end |
.find(params) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gov_kit/open_congress/bill.rb', line 14 def self.find(params) url = construct_url("bills", params) if (result = make_call(url)) parse_results(result) else nil end end |
.find_by_idents(idents) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/gov_kit/open_congress/bill.rb', line 86 def self.find_by_idents(idents) q = [] if idents.class.to_s == "Array" q = idents else q = idents.split(',') end url = Bill.construct_url("bills_by_ident", {:ident => q.join(',')}) if (result = make_call(url)) bills = parse_results(result) else nil end end |
.find_by_query(q) ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/gov_kit/open_congress/bill.rb', line 76 def self.find_by_query(q) url = Bill.construct_url("bills_by_query", {:q => q}) if (result = make_call(url)) bills = parse_results(result) else nil end end |
.most_blogged_bills_this_week ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/gov_kit/open_congress/bill.rb', line 26 def self.most_blogged_bills_this_week url = construct_url("most_blogged_bills_this_week", {}) if (result = make_call(url)) bills = parse_results(result) return bills else nil end end |
.most_opposed_bills_this_week ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/gov_kit/open_congress/bill.rb', line 66 def self.most_opposed_bills_this_week url = construct_url("most_opposed_bills_this_week", {}) if (result = make_call(url)) bills = parse_results(result) return bills else nil end end |
.most_supported_bills_this_week ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/gov_kit/open_congress/bill.rb', line 56 def self.most_supported_bills_this_week url = construct_url("most_supported_bills_this_week", {}) if (result = make_call(url)) bills = parse_results(result) return bills else nil end end |
.most_tracked_bills_this_week ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/gov_kit/open_congress/bill.rb', line 46 def self.most_tracked_bills_this_week url = construct_url("most_tracked_bills_this_week", {}) if (result = make_call(url)) bills = parse_results(result) return bills else nil end end |
.parse_results(result) ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/gov_kit/open_congress/bill.rb', line 123 def self.parse_results(result) bills = [] if Hash === result result["bills"].each do |bill| bill = bill['bill'] these_recent_blogs = bill["recent_blogs"] blogs = [] if these_recent_blogs these_recent_blogs.each do |trb| blogs << BlogPost.new(trb) end end bill["recent_blogs"] = blogs these_recent_news = bill["recent_news"] news = [] if these_recent_news these_recent_news.each do |trb| news << NewsPost.new(trb) end end bill["recent_news"] = news these_co_sponsors = bill["co_sponsors"] co_sponsors = [] if these_co_sponsors these_co_sponsors.each do |tcs| co_sponsors << Person.new(tcs) end end bill["co_sponsors"] = co_sponsors bill["sponsor"] = Person.new(bill["sponsor"]) if bill["sponsor"] bills << Bill.new(bill) end end bills end |
Instance Method Details
#opencongress_users_opposing_bill_are_also ⇒ Object
113 114 115 116 117 118 119 120 121 |
# File 'lib/gov_kit/open_congress/bill.rb', line 113 def opencongress_users_opposing_bill_are_also url = Bill.construct_url("opencongress_users_opposing_bill_are_also/#{ident}", {}) if (result = Bill.make_call(url)) bills = Bill.parse_supporting_results(result) return bills else nil end end |
#opencongress_users_supporting_bill_are_also ⇒ Object
103 104 105 106 107 108 109 110 111 |
# File 'lib/gov_kit/open_congress/bill.rb', line 103 def opencongress_users_supporting_bill_are_also url = Bill.construct_url("opencongress_users_supporting_bill_are_also/#{ident}", {}) if (result = Bill.make_call(url)) bills = Bill.parse_supporting_results(result) return bills else nil end end |