Class: CTAPI::Response

Inherits:
APDU
  • Object
show all
Defined in:
lib/ctapi.rb

Overview

A response received from the cardterminal.

Instance Attribute Summary

Attributes inherited from APDU

#data

Instance Method Summary collapse

Methods inherited from APDU

#[], #initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from CTAPI::APDU

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


445
446
447
# File 'lib/ctapi.rb', line 445

def changed?
  @data[-2, 2] == "\x62\x00" ? true : false
end

#not_changed?Boolean

Returns:

  • (Boolean)


449
450
451
# File 'lib/ctapi.rb', line 449

def not_changed?
  @data[-2, 2] == "\x62\x01" ? true : false
end

#successful?Boolean

If this response was successful true is returned, false otherwise. A response is successful if the last two bytes are ‘90:00’.

Returns:

  • (Boolean)


439
440
441
442
443
# File 'lib/ctapi.rb', line 439

def successful?
  return false if @data.size < 2
  return true if @data[-2, 2] == "\x90\x00"
  false
end