Class: Rapid::Baps::Service

Inherits:
Services::NetworkService show all
Extended by:
Forwardable
Defined in:
lib/ury_rapid/baps/service.rb

Overview

The top-level service interface for the BAPS Rapid service

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Services::NetworkService

#host

Constructor Details

#initialize(*_) ⇒ Service

Initialise the service given its service configuration

Examples:

Create a new BAPS service

service = Service.new(environment)

20
21
22
23
24
25
26
# File 'lib/ury_rapid/baps/service.rb', line 20

def initialize(*_)
  super

  @username = ''
  @password = ''
  @channel_ids = []
end

Instance Attribute Details

#password=(value) ⇒ Object (writeonly) Also known as: password

password [String] - sets the BAPS login password (cleartext).


37
38
39
# File 'lib/ury_rapid/baps/service.rb', line 37

def password=(value)
  @password = value
end

#username=(value) ⇒ Object (writeonly) Also known as: username

username [String] - sets the BAPS login username.


33
34
35
# File 'lib/ury_rapid/baps/service.rb', line 33

def username=(value)
  @username = value
end

Instance Method Details

#num_channels(channels) ⇒ Object

num_channels [Integer] - sets the channel count of the BAPS server. This should agree with the number of channels configured in BAPS.


42
43
44
# File 'lib/ury_rapid/baps/service.rb', line 42

def num_channels(channels)
  @channel_ids = (0...channels).to_a
end

#runObject

End configuration DSL


50
51
52
53
54
55
56
# File 'lib/ury_rapid/baps/service.rb', line 50

def run
  environment.log(:info, 'BAPS service launching.')
  environment.log(:info, "BAPS server: #{@host}:#{@port}")

  initialise_model
  super
end