class Sip2::Messages::Login
Request message 93
* UID algorithm - 1 char, fixed-length required field; the algorithm used to encrypt the user id * PWD algorithm - 1 char, fixed-length required field; the algorithm used to encrypt the password * login user id - CN - variable-length required field * login password - CO - variable-length required field * location code - CP - variable-length required field
Response message 94
* ok - 1 char, fixed-length required field: 0 or 1
Private Instance Methods
build_message(username:, password:, location_code: nil)
click to toggle source
# File lib/sip2/messages/login.rb, line 25 def build_message(username:, password:, location_code: nil) code = '93' # Login uid_algorithm = pw_algorithm = '0' # Plain text username_field = "CN#{username}" password_field = "CO#{password}" location_code = location_code.strip if location_code.is_a? String location_field = location_code ? "|CP#{location_code}" : '' [ code, uid_algorithm, pw_algorithm, username_field, '|', password_field, location_field ].join end
handle_response(response)
click to toggle source
# File lib/sip2/messages/login.rb, line 38 def handle_response(response) response[/\A94([01])AY/, 1] == '1' end