class YubiOATH::Calculate

Public Class Methods

new(card) click to toggle source
# File lib/yubioath/calculate.rb, line 5
def initialize(card)
  @card = card
end

Public Instance Methods

call(name:, timestamp:) click to toggle source
# File lib/yubioath/calculate.rb, line 9
def call(name:, timestamp:)
  data = Request::Data.new(name: name, timestamp: timestamp.to_i / 30)
  request = Request.new(data: data.to_binary_s)
  bytes = @card.transmit(request.to_binary_s)
  response = Response.read(bytes)
  response.code.to_s
end