Module: Parliament::Grom::Decorator::ContactPoint

Defined in:
lib/parliament/grom/decorator/contact_point.rb

Overview

Decorator namespace for Grom::Node instances with type: id.parliament.uk/schema/ContactPoint

Since:

  • 0.1.0

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.

Since:

  • 0.1.0



16
17
18
# File 'lib/parliament/grom/decorator/contact_point.rb', line 16

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.

Since:

  • 0.1.0



30
31
32
# File 'lib/parliament/grom/decorator/contact_point.rb', line 30

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

#parliamentary_incumbencyGrom::Node?

Alias contactPointHasParliamentaryIncumbency with fallback.

Returns:

  • (Grom::Node, nil)

    the parliamentary incumbency of the Grom::Node or nil.

Since:

  • 0.1.0



44
45
46
# File 'lib/parliament/grom/decorator/contact_point.rb', line 44

def parliamentary_incumbency
  respond_to?(:contactPointHasParliamentaryIncumbency) ? contactPointHasParliamentaryIncumbency.first : nil
end

#personArray

Alias contactPointHasPerson with fallback.

Returns:

  • (Array, Array)

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

Since:

  • 0.1.0



37
38
39
# File 'lib/parliament/grom/decorator/contact_point.rb', line 37

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.

Since:

  • 0.1.0



23
24
25
# File 'lib/parliament/grom/decorator/contact_point.rb', line 23

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.

Since:

  • 0.1.0



9
10
11
# File 'lib/parliament/grom/decorator/contact_point.rb', line 9

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