Class: CodinRep::GetTime
Constant Summary
collapse
- COMMAND_CODE =
"009b".freeze
'REP008b'.freeze
Constants inherited
from Command
Command::COMMAND_PREFIX
Instance Method Summary
collapse
Methods inherited from Command
#execute, #generate_header, #get_max_attempts, #get_timeout_time, #initialize, #should_close_connection?
Instance Method Details
37
38
39
40
41
|
# File 'lib/codin_rep/get_time.rb', line 37
def
unless @response.match(/^#{EXPECTED_HEADER}/)
raise .new @response[0..6], 'get time',
end
end
|
#generate_command_payload ⇒ Object
29
30
31
|
# File 'lib/codin_rep/get_time.rb', line 29
def generate_command_payload
""
end
|
#get_data_from_response_payload ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/codin_rep/get_time.rb', line 47
def get_data_from_response_payload
@time = nil
begin
@time = CodinRep::TimeUtil.unpack @response_payload
rescue ArgumentError
raise MalformedResponsePayload.new 'get time'
end
return @time
end
|
#get_expected_response_size ⇒ Object
33
34
35
|
# File 'lib/codin_rep/get_time.rb', line 33
def get_expected_response_size
14
end
|
#get_response_payload ⇒ Object
43
44
45
|
# File 'lib/codin_rep/get_time.rb', line 43
def get_response_payload
@response_payload = @response[7..-1]
end
|