Sha256: 010dbba84f5b8722404e3978acfc56f2529ea1de8d2a32c3df723ea1f2b47cb1

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

class CongressV3::Legislator
  def self.all(params={})
    CongressV3::Request.legislators(params)
  end

  def initialize(params)
    params.each do |key, value|
      instance_variable_set("@#{key}", value)
      self.class.send(:attr_reader, key)
    end
  end

  def full_name
    if middle_name
      "#{first_name} #{middle_name} #{last_name}"
    else
      "#{first_name} #{last_name}"
    end
  end

  def term
    Time.parse(term_start)...Time.parse(term_end)
  end

  def votes(params={})
    @votes ||= CongressV3::Request.legislator_votes(bioguide_id, params)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
congress_v3-0.2.0 lib/congress_v3/legislator.rb
congress_v3-0.1.2 lib/congress_v3/legislator.rb