Module: Parliament::Decorators::ContactPoint

Defined in:
lib/parliament/decorators/contact_point.rb

Overview

Decorator namespace for Grom::Node instances with type: id.ukpds.org/schema/ContactPoint

Instance Method Summary collapse

Instance Method Details

#emailString

Alias email with fallback.

Returns:

  • (String, String)

    the email of the Grom::Node or an empty string.


15
16
17
# File 'lib/parliament/decorators/contact_point.rb', line 15

def email
  instance_variable_get('@email'.to_sym).nil? ? '' : instance_variable_get('@email'.to_sym)
end

#fax_numberString

Alias faxNumber with fallback.

Returns:

  • (String, String)

    the fax number of the Grom::Node or an empty string.


29
30
31
# File 'lib/parliament/decorators/contact_point.rb', line 29

def fax_number
  respond_to?(:faxNumber) ? faxNumber : ''
end

#incumbencyGrom::Node?

Alias contactPointHasIncumbency with fallback.

Returns:

  • (Grom::Node, nil)

    the incumbency of the Grom::Node or nil.


43
44
45
# File 'lib/parliament/decorators/contact_point.rb', line 43

def incumbency
  respond_to?(:contactPointHasIncumbency) ? contactPointHasIncumbency.first : nil
end

#personArray

Alias contactPointHasPerson with fallback.

Returns:

  • (Array, Array)

    the person connected to the Grom::Node or an empty array.


36
37
38
# File 'lib/parliament/decorators/contact_point.rb', line 36

def person
  respond_to?(:contactPointHasPerson) ? contactPointHasPerson : []
end

#phone_numberString

Alias phoneNumber with fallback.

Returns:

  • (String, String)

    the phone number of the Grom::Node or an empty string.


22
23
24
# File 'lib/parliament/decorators/contact_point.rb', line 22

def phone_number
  respond_to?(:phoneNumber) ? phoneNumber : ''
end

#postal_addressesArray

Alias contactPointHasPostalAddress with fallback.

Returns:

  • (Array, Array)

    an array of the postal addresses for the Grom::Node or an empty array.


8
9
10
# File 'lib/parliament/decorators/contact_point.rb', line 8

def postal_addresses
  respond_to?(:contactPointHasPostalAddress) ? contactPointHasPostalAddress : []
end