Class: NRB::BreweryControlSystem::API

Inherits:
Object
  • Object
show all
Defined in:
lib/brewery_control_system/api.rb,
lib/brewery_control_system/api/device.rb,
lib/brewery_control_system/api/3.7.0/temps.rb,
lib/brewery_control_system/api/3.7.0/ultemp.rb,
lib/brewery_control_system/api/3.7.0/bcs_sys.rb,
lib/brewery_control_system/api/3.7.0/sysname.rb,
lib/brewery_control_system/api/version_check.rb,
lib/brewery_control_system/api/3.7.0/endpoint.rb,
lib/brewery_control_system/api/server_version.rb,
lib/brewery_control_system/api/3.7.0/setpoints.rb,
lib/brewery_control_system/api/3.7.0/device_endpoint.rb,
lib/brewery_control_system/api/3.7.0/temperature_probes_endpoint.rb,
lib/brewery_control_system/api/3.7.0/temperature_probe_names_endpoint.rb

Defined Under Namespace

Modules: ServerVersion Classes: BCSSys, Device, DeviceEndpoint, Endpoint, Setpoints, Sysname, TemperatureProbeNamesEndpoint, TemperatureProbesEndpoint, Temps, Ultemp, VersionCheck

Instance Method Summary collapse

Constructor Details

#initialize(api_version: '3.7.0', base_url: nil, bcs: nil) ⇒ API

Processes

name            string
running         boolean
paused          boolean
run_on_startup  boolean
current_state   state
                  name   string
                  state  integer


65
66
67
68
69
70
71
# File 'lib/brewery_control_system/api.rb', line 65

def initialize(api_version: '3.7.0', base_url: nil, bcs: nil)
  self.base_url = base_url
  self.bcs = bcs
  self.api_version = api_version

  require_endpoints
end

Instance Method Details

#deviceObject

Device

name     string
type     string
version  string
build    string

3.x

/bcs_sys.cfg

4.x

/device


17
18
19
20
21
22
# File 'lib/brewery_control_system/api.rb', line 17

def device
  @device_response ||= http_service do |b|
                         b.response DeviceEndpoint
                       end.get(DeviceEndpoint.endpoint).body
  Device.new *@device_response
end

#http_service {|service| ... } ⇒ Object

Yields:

  • (service)


25
26
27
28
29
30
31
# File 'lib/brewery_control_system/api.rb', line 25

def http_service
  service = bcs.http_service do |b|
              b.response VersionCheck, api_version
            end
  yield service if block_given?
  service
end

#temperature_probesObject

Temperature Probes

name          string
temp          integer
setpoint      integer
resistance    integer
enabled       boolean
coefficients  array


41
42
43
# File 'lib/brewery_control_system/api.rb', line 41

def temperature_probes
  TemperatureProbesEndpoint.fetch api: self
end