Class: Nucleus::Provider

Inherits:
AbstractModel show all
Includes:
Kwalify::Util::HashLike
Defined in:
lib/nucleus/core/models/provider.rb

Overview

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

  • id (String)

  • name (String)

  • vendor (Nucleus::Vendor)

  • endpoints (Array<Nucleus::Endpoint>)

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) ⇒ Provider

Returns a new instance of Provider.

Since:

  • 0.1.0



17
18
19
20
21
22
23
24
# File 'lib/nucleus/core/models/provider.rb', line 17

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

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

Instance Attribute Details

#endpointsObject

seq

Since:

  • 0.1.0



15
16
17
# File 'lib/nucleus/core/models/provider.rb', line 15

def endpoints
  @endpoints
end

#vendorObject

Since:

  • 0.1.0



14
15
16
# File 'lib/nucleus/core/models/provider.rb', line 14

def vendor
  @vendor
end