Sha256: 159f5393d77feb8620d9e8a240ab06bbc957564e6c0740fa70a49720b698f32e

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

module NYTimes
	module Congress
		class Nomination < Base
		  include AttributeTransformation
		  
      ATTRIBUTE_MAP = { 
			  :date_for       =>  [:latest_action_date, :date_received],
        :integer_for    =>  [:congress],
        :string_for     =>  [:nominee_state, :status, :uri, :id, :description],
      }
		  
		  attr_reader :nominee_state, :description, :latest_action_date, :status, :committee, :id, :uri, :date_received
		  alias state nominee_state
		  
		  def initialize(nominee_state, description, latest_action_date, status, id, date_received, committee = nil)
		    @nominee_state = nominee_state
		    @description = description
		    @latest_action_date = latest_action_date
		    @status = status
		    @id = id
		    @date_received = date_received
		    @committee = committee
		  end
		  
      def self.find(congress, id)
        response = invoke("#{congress}/nominees/detail/#{id}.json")
				new(response['results'].first)
      end
		  
		  def to_s
		    id +': ' + description
		  end
		  
		  
		  
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nytimes-congress-1.4.1 lib/ny-times/congress/nomination.rb
nytimes-congress-1.4.0 lib/ny-times/congress/nomination.rb