class Lobbyliste::Address
This class represents addresses found in the lobbylist.
Attributes
address[R]
@return [String] Everything that is not part of the name or any other field
city[R]
@return [String] City
country[R]
@return [String] the country, default: “Germany”
email[R]
@return [String] contact email address
fax[R]
@return [String] the fax number if given (german numbers are automatically prefixed with +49)
name[R]
@return [String] organisation name (the bold part)
postcode[R]
@return [String] Postcode
tel[R]
@return [String] the telephone number if given (german numbers are automatically prefixed with +49)
type[R]
@return [Symbol] address type, :primary for 1. address, :secondary for all others
website[R]
@return [String] website url
Public Class Methods
new(name, address, postcode, city, country, tel, fax, website, email, type)
click to toggle source
# File lib/lobbyliste/address.rb, line 35 def initialize(name, address, postcode, city, country, tel, fax, website, email, type) @name = name @address = address @postcode = postcode @city = city @country = country @tel = tel @fax = fax @website = website @email = email @type=type end
Public Instance Methods
full_address()
click to toggle source
@return String pretty formated address of all existing address fields
# File lib/lobbyliste/address.rb, line 49 def full_address full_address = [ @name, @address, [@postcode,@city].reject(&:nil?).join(" "), @country, ] full_address << "Tel: #{@tel}" if @tel full_address << "Fax: #{@fax}" if @fax full_address << "Email: #{@email}" if @email full_address << @website if @website full_address.reject(&:nil?).join("\n") end
to_json(*a)
click to toggle source
# File lib/lobbyliste/address.rb, line 64 def to_json(*a) { name: name, address: address, postcode: postcode, city: city, country: country, tel: tel, fax: fax, email: email, website: website, type: type.to_s }.to_json(*a) end