Class: Company::Customer

Inherits:
Resource show all
Defined in:
lib/company/resources/customer.rb

Overview

A person the business works for.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#id, #initialize, keys, node_keys

Constructor Details

This class inherits a constructor from Company::Resource

Class Method Details

.attributes ⇒ Object

What every customer reads, by the vocabulary's names.



5
# File 'lib/company/resources/customer.rb', line 5

def self.attributes = %i[id name surname email phone]

Instance Method Details

#email ⇒ String?

Returns address they are written to.

Returns:

  • (String, nil) —

    address they are written to.



14
# File 'lib/company/resources/customer.rb', line 14

def email = attribute :email

#name ⇒ String?

Returns what they go by: a given name, or a business's where a person has none.

Returns:

  • (String, nil) —

    what they go by: a given name, or a business's where a person has none.



8
# File 'lib/company/resources/customer.rb', line 8

def name = attribute :name

#phone ⇒ String?

Returns ten digits they are reached on, nil where none can be dialed.

Returns:

  • (String, nil) —

    ten digits they are reached on, nil where none can be dialed.



17
# File 'lib/company/resources/customer.rb', line 17

def phone = Phone.from attribute(:phone)

#surname ⇒ String?

Returns their surname.

Returns:

  • (String, nil) —

    their surname.



11
# File 'lib/company/resources/customer.rb', line 11

def surname = attribute :surname