Method: Confidence::Vote.fetch

Defined in:
lib/confidence.rb

.fetch(attrs = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/confidence.rb', line 7

def self.fetch(attrs={})
  vote = new(attrs)

  # Parl= and FltrParl= are redundant. Contact your local mp to complain if you care.
  doc = HTTParty.get(
    "http://www2.parl.gc.ca/HouseChamberBusiness/Chambervotedetail.aspx?Language=E&Mode=1&Parl=#{vote.parliament}&Ses=#{vote.session}&FltrParl=#{vote.parliament}&FltrSes=#{vote.session}&vote=#{vote.number}&xml=True"
  )

  vote.doc = doc['Vote']
  vote
end