Sha256: d4de84ca2f2cb54fe10f9b2fa6078edcf0500d53c0c7116665c1b9b26c1a6707

Contents?: true

Size: 927 Bytes

Versions: 20

Compression:

Stored size: 927 Bytes

Contents

class Ppl::Entity::Contact

  attr_accessor :id
  attr_accessor :name
  attr_accessor :nicknames
  attr_accessor :email_addresses
  attr_accessor :birthday
  attr_accessor :phone_numbers
  attr_accessor :organizations
  attr_accessor :postal_address
  attr_accessor :urls

  def initialize
    @email_addresses = []
    @nicknames = []
    @organizations = []
    @phone_numbers = []
    @urls = []
  end

  def set_postal_address
    if @postal_address.nil?
      @postal_address = Ppl::Entity::PostalAddress.new
    end
    yield @postal_address
  end

  def has_email_address?(email_address)
    @email_addresses.include? email_address
  end

  def age(on_date)
    if @birthday.nil?
      nil
    else
      # From http://stackoverflow.com/a/2357790
      on_date.year - @birthday.year - ((on_date.month > @birthday.month || (on_date.month == @birthday.month && on_date.day >= @birthday.day)) ? 0 : 1)
    end
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ppl-1.25.0 lib/ppl/entity/contact.rb
ppl-1.24.0 lib/ppl/entity/contact.rb
ppl-1.23.0 lib/ppl/entity/contact.rb
ppl-1.22.2 lib/ppl/entity/contact.rb
ppl-1.22.1 lib/ppl/entity/contact.rb
ppl-1.22.0 lib/ppl/entity/contact.rb
ppl-1.21.0 lib/ppl/entity/contact.rb
ppl-1.20.0 lib/ppl/entity/contact.rb
ppl-1.19.0 lib/ppl/entity/contact.rb
ppl-1.18.0 lib/ppl/entity/contact.rb
ppl-1.17.2 lib/ppl/entity/contact.rb
ppl-1.17.1 lib/ppl/entity/contact.rb
ppl-1.17.0 lib/ppl/entity/contact.rb
ppl-1.16.0 lib/ppl/entity/contact.rb
ppl-1.15.1 lib/ppl/entity/contact.rb
ppl-1.15.0 lib/ppl/entity/contact.rb
ppl-1.14.1 lib/ppl/entity/contact.rb
ppl-1.14.0 lib/ppl/entity/contact.rb
ppl-1.13.0 lib/ppl/entity/contact.rb
ppl-1.12.0 lib/ppl/entity/contact.rb