Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I am running this code from the govkit gem
- #govkit / lib / gov_kit / open_congress / bill.rb
- 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
- def self.parse_results(result)
- bills = []
- result["bills"].each do |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
- bills
- end
- getting a good result that has an array of bills, each bill is a Hash (27 element(s))
- but parse results turns result into an array of #<GovKit::OpenCongress::Bill:0x000001055496a0> with no values.
Advertisement
Add Comment
Please, Sign In to add comment