Class: AtreaControl::Duplex::Request

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/atrea_control/duplex/request.rb

Overview

Process request with duplex unit itself. Handle response

Instance Method Summary collapse

Methods included from Logger

#logger

Constructor Details

#initialize(user_id:, unit_id:, sid:) ⇒ Request

Note:

‘ver` is done by atrea server

Returns a new instance of Request.

Parameters:

  • user_id (String, Integer)
  • unit_id (String, Integer)
  • sid (String, Integer)


15
16
17
18
19
20
21
22
# File 'lib/atrea_control/duplex/request.rb', line 15

def initialize(user_id:, unit_id:, sid:)
  @params = {
    _user: user_id.to_i,
    _unit: unit_id,
    auth: sid,
    ver: AtreaControl::Duplex::CONTROL_VERSION,
  }
end

Instance Method Details

#call(params) ⇒ Object

Parameters:

  • params (Hash)

Options Hash (params):

  • :_t (String) — default: "config/xml.xml"

    file name



26
27
28
# File 'lib/atrea_control/duplex/request.rb', line 26

def call(params)
  RestClient.get "#{AtreaControl::Duplex::CONTROL_URI}/comm/sw/unit.php", params: @params.merge(params)
end