class Representative

Stores rep info in key/value pairs, and makes values accessible by instance method.

Public Instance Methods

address_1() click to toggle source

Get the :address_1 value.

# File lib/get-your-rep/representative.rb, line 81
def address_1
  @address_1 = self[:address_1]
end
address_1=(value) click to toggle source

Set the :address_1 value.

# File lib/get-your-rep/representative.rb, line 86
def address_1=(value)
  @address_1 = value
  self[:address_1] = @address_1
end
address_2() click to toggle source

Get the :address_2 value.

# File lib/get-your-rep/representative.rb, line 92
def address_2
  @address_2 = self[:address_2]
end
address_2=(value) click to toggle source

Set the :address_2 value.

# File lib/get-your-rep/representative.rb, line 97
def address_2=(value)
  @address_2 = value
  self[:address_2] = @address_2
end
address_3() click to toggle source

Get the :address_3 value.

# File lib/get-your-rep/representative.rb, line 103
def address_3
  @address_3 = self[:address_3]
end
address_3=(value) click to toggle source

Set the :address_3 value.

# File lib/get-your-rep/representative.rb, line 108
def address_3=(value)
  @address_3 = value
  self[:address_3] = @address_3
end
business_card() click to toggle source

Maps attributes to a simple array for easy printing, iteration, and display. It uses each rather than map so it can skip over nil values without mapping them.

# File lib/get-your-rep/representative.rb, line 23
def business_card
  card = []
  self.each do |key, value|
    next if value.nil?
    if key == :facebook || key == :twitter || key == :youtube || key == :googleplus
      card << "#{key.to_s.capitalize}: #{value}"
    else
      card << "#{value}"
    end
  end
  card
end
email() click to toggle source

Get the :email value.

# File lib/get-your-rep/representative.rb, line 114
def email
  @email = self[:email]
end
email=(value) click to toggle source

Set the :email value.

# File lib/get-your-rep/representative.rb, line 119
def email=(value)
  @email = value
  self[:email] = @email
end
facebook() click to toggle source

Get the :facebook value.

# File lib/get-your-rep/representative.rb, line 158
def facebook
  @facebook = self[:facebook]
end
facebook=(value) click to toggle source

Set the :facebook value.

# File lib/get-your-rep/representative.rb, line 163
def facebook=(value)
  @facebook = value
  self[:facebook] = @facebook
end
first_name() click to toggle source

Strips the first name out of the full name.

# File lib/get-your-rep/representative.rb, line 5
def first_name
  if (name.split.count > 3) || (name.split[-2].downcase == name.split[-2])
    name.split[0..-3].join(' ')
  else
    name.split[0..-2].join(' ')
  end
end
googleplus() click to toggle source

Get the :googleplus value.

# File lib/get-your-rep/representative.rb, line 180
def googleplus
  @googleplus = self[:googleplus]
end
googleplus=(value) click to toggle source

Set the :googleplus value.

# File lib/get-your-rep/representative.rb, line 185
def googleplus=(value)
  @googleplus = value
  self[:googleplus] = @googleplus
end
last_name() click to toggle source

Strips the surname out of the full name.

# File lib/get-your-rep/representative.rb, line 14
def last_name
  if (name.split.count > 3) || (name.split[-2].downcase == name.split[-2])
    name.split[-2..-1].join(' ')
  else
    name.split.last
  end
end
name() click to toggle source

Get the :name value.

# File lib/get-your-rep/representative.rb, line 37
def name
  @name = self[:name]
end
name=(value) click to toggle source

Set the :name value.

# File lib/get-your-rep/representative.rb, line 42
def name=(value)
  @name = value
  self[:name] = @name
end
office() click to toggle source

Get the :office value.

# File lib/get-your-rep/representative.rb, line 48
def office
  @office = self[:office]
end
office=(value) click to toggle source

Set the :office value.

# File lib/get-your-rep/representative.rb, line 53
def office=(value)
  @office = value
  self[:office] = @office
end
party() click to toggle source

Get the :party value.

# File lib/get-your-rep/representative.rb, line 59
def party
  @party = self[:party]
end
party=(value) click to toggle source

Set the :party value.

# File lib/get-your-rep/representative.rb, line 64
def party=(value)
  @party = value
  self[:party] = @party
end
phone() click to toggle source

Get the :phone value.

# File lib/get-your-rep/representative.rb, line 70
def phone
  @phone = self[:phone]
end
phone=(value) click to toggle source

Set the :phone value.

# File lib/get-your-rep/representative.rb, line 75
def phone=(value)
  @phone = value
  self[:phone] = @phone
end
photo() click to toggle source

Get the :photo value.

# File lib/get-your-rep/representative.rb, line 136
def photo
  @photo = self[:photo]
end
photo=(value) click to toggle source

Set the :photo value.

# File lib/get-your-rep/representative.rb, line 141
def photo=(value)
  @photo = value
  self[:photo] = @photo
end
twitter() click to toggle source

Get the :twitter value.

# File lib/get-your-rep/representative.rb, line 147
def twitter
  @twitter = self[:twitter]
end
twitter=(value) click to toggle source

Set the :twitter value.

# File lib/get-your-rep/representative.rb, line 152
def twitter=(value)
  @twitter = value
  self[:twitter] = @twitter
end
url() click to toggle source

Get the :url value.

# File lib/get-your-rep/representative.rb, line 125
def url
  @url = self[:url]
end
url=(value) click to toggle source

Set the :url value.

# File lib/get-your-rep/representative.rb, line 130
def url=(value)
  @url = value
  self[:url] = @url
end
youtube() click to toggle source

Get the :youtube value.

# File lib/get-your-rep/representative.rb, line 169
def youtube
  @youtube = self[:youtube]
end
youtube=(value) click to toggle source

Set the :youtube value.

# File lib/get-your-rep/representative.rb, line 174
def youtube=(value)
  @youtube = value
  self[:youtube] = @youtube
end