Class: Nucleus::Vendor

Inherits:
AbstractModel show all
Defined in:
lib/nucleus/core/models/vendor.rb

Overview

The Vendor model will initially be imported from .yaml description files and shall be persisted in the store. The vendor has the following properties:

  • id (String)

  • name (String)

  • providers (Array<Nucleus::Provider>)

Author:

Since:

  • 0.1.0

Instance Attribute Summary collapse

Attributes inherited from AbstractModel

#created_at, #id, #name, #updated_at

Instance Method Summary collapse

Methods inherited from AbstractModel

#inspect, #to_s

Constructor Details

#initialize(hash = nil) ⇒ Vendor

Returns a new instance of Vendor.

Since:

  • 0.1.0



13
14
15
16
17
18
19
20
# File 'lib/nucleus/core/models/vendor.rb', line 13

def initialize(hash = nil)
  super(hash)
  @providers = []
  return if hash.nil?

  return unless hash.key?('providers')
  @providers = hash['providers'].map! { |e| e.is_a?(Nucleus::Provider) ? e : Nucleus::Provider.new(e) }
end

Instance Attribute Details

#providersObject

seq

Since:

  • 0.1.0



11
12
13
# File 'lib/nucleus/core/models/vendor.rb', line 11

def providers
  @providers
end