Sha256: 18fb7abb88d5ce289de30c42e4736bd084de44d141dd2a194cf310b78aff4fee

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module NYTimes
	module Congress
		class RollCallVote < Base
      include AttributeTransformation

			ATTRIBUTE_MAP = { 
			  :date_for       =>  [:date],
        :integer_for    =>  [:session_number, :congress, :roll_call],
        :string_for     =>  [:bill_number, :question, :vote_type, :time, :result, :description, :chamber],
        :positions_for  =>  [:positions],
      }
      attr_reader :vacant_seats, :democratic_majority_position, :republican_majority_position, *ATTRIBUTE_MAP.values.flatten

			def initialize(args={})
  			transformed_values = self.transform(args['vote'], ATTRIBUTE_MAP)
				transformed_values.each_pair do |attribute, value|
					instance_variable_set("@#{attribute}", value)
				end
				@democratic_majority_position, @republican_majority_position = string_for(args['vote']['democratic']['majority_position']), string_for(args['vote']['republican']['majority_position'])
				@vacant_seats = vacant_seats_for(args['vacant_seats'])
			end
		
		  def get_congress
		    Congress.new(congress, chamber)
		  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/roll_call_vote.rb
nytimes-congress-1.4.0 lib/ny-times/congress/roll_call_vote.rb