Sha256: e12377ffa496d986cf783dfd18f5555cdb62f9d9dd3fa4187dc27e595557c051

Contents?: true

Size: 480 Bytes

Versions: 2

Compression:

Stored size: 480 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
congress_v3-0.1.1 lib/congress_v3/legislator.rb
congress_v3-0.1.0 lib/congress_v3/legislator.rb