class Hulse::Communication
Attributes
committee[R]
date[R]
id[R]
text[R]
url[R]
Public Class Methods
create(row)
click to toggle source
# File lib/hulse/communication.rb, line 36 def self.create(row) self.new(id: row.children[3].children[0].text, date: Date.strptime(row.children[3].children[1].text.split[1], "%m/%d/%Y"), committee: row.children[3].children[1].text.split[3] + ' ' + row.children[3].children[1].text.split[4], url: (row/:h2).first.children.find(:a).first['href'], text: row.children[4].text.strip ) end
executive()
click to toggle source
# File lib/hulse/communication.rb, line 26 def self.executive comms = [] doc = HTTParty.get("https://www.congress.gov/communications?q=%7B%22communication-code%22%3A%22EC%22%7D&pageSize=250") html = Nokogiri::HTML(doc.parsed_response) (html/:ol/:li).each do |row| comms << create(row) end comms end
new(params={})
click to toggle source
# File lib/hulse/communication.rb, line 6 def initialize(params={}) params.each_pair do |k,v| instance_variable_set("@#{k}", v) end end
presidential()
click to toggle source
# File lib/hulse/communication.rb, line 16 def self.presidential comms = [] doc = HTTParty.get("https://www.congress.gov/communications?q=%7B%22communication-code%22%3A%22PM%22%7D&pageSize=250") html = Nokogiri::HTML(doc.parsed_response) (html/:ol/:li).each do |row| comms << create(row) end comms end
Public Instance Methods
to_s()
click to toggle source
# File lib/hulse/communication.rb, line 12 def to_s id end