Class: Company::Business
- Defined in:
- lib/company/resources/business.rb
Overview
Who the account belongs to: the one business behind a set of credentials.
Class Method Summary collapse
-
.attributes ⇒ Object
What every business reads, by the vocabulary's names.
Instance Method Summary collapse
-
#name ⇒ String
Business name.
-
#phone ⇒ String?
Ten digits the business is reached on, nil where none can be dialed.
-
#subsidiaries ⇒ Array<Business>
Itself first, then every business under it at any depth, in the order the platform lists them: a business on its own is its own one subsidiary, and a franchise reads flat.
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 business reads, by the vocabulary's names.
5 |
# File 'lib/company/resources/business.rb', line 5 def self.attributes = %i[id name phone] |
Instance Method Details
#name ⇒ String
Returns business name.
8 |
# File 'lib/company/resources/business.rb', line 8 def name = attribute :name |
#phone ⇒ String?
Returns ten digits the business is reached on, nil where none can be dialed.
11 |
# File 'lib/company/resources/business.rb', line 11 def phone = Phone.from attribute(:phone) |
#subsidiaries ⇒ Array<Business>
Itself first, then every business under it at any depth, in the order the platform lists
them: a business on its own is its own one subsidiary, and a franchise reads flat. A gem
whose platform nests businesses answers the ones directly under this one from the private
below; the rest inherit none.
18 |
# File 'lib/company/resources/business.rb', line 18 def subsidiaries = [ self, *below.flat_map(&:subsidiaries) ] |