Class: DmtdVbmappData::Protocol

Inherits:
Object
  • Object
show all
Defined in:
lib/dmtd_vbmapp_data/protocol.rb

Overview

Provides for the retrieving the Protocol content from the VB-MAPP Data Server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Protocol

Note:

This method does not block, simply creates an accessor and returns

Creates an accessor for the VB-MAPP content on the VB-MAPP Data Server

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • :client (Client)

    A client instance



15
16
17
# File 'lib/dmtd_vbmapp_data/protocol.rb', line 15

def initialize(opts)
  @client = opts.fetch(:client)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/dmtd_vbmapp_data/protocol.rb', line 8

def client
  @client
end

Instance Method Details

#areasArray<ProtocolArea>

Note:

The first call to this method with an expired cache will block until the cache is populated. All subsequent calls will load from the cache.

Note:

The cache is an in-memory cache (not on-disc). Thus, if the process is restarted, the cache will be dropped. Additionally this cache expires once a day at midnight UTC.

Returns The entire set of DmtdVbmappData::ProtocolArea instances.

Returns:



27
28
29
30
31
32
33
34
35
# File 'lib/dmtd_vbmapp_data/protocol.rb', line 27

def areas
  index_array = index

  @areas = index_array.map do |area_index_json|
    ProtocolArea.new(client: client, area_index_json: area_index_json)
  end if @areas.nil? && index_array.is_a?(Array)

  @areas
end