Class: YubiOATH::List

Inherits:
Object
  • Object
show all
Defined in:
lib/yubioath/list.rb

Defined Under Namespace

Classes: Request, Response

Instance Method Summary collapse

Constructor Details

#initialize(card) ⇒ List

Returns a new instance of List.



7
8
9
# File 'lib/yubioath/list.rb', line 7

def initialize(card)
  @card = card
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/yubioath/list.rb', line 11

def call
  request = Request.new
  bytes = @card.transmit(request.to_binary_s)
  response = Response.read(bytes)

  response[:codes].map do |code|
    [code.name, {
      type: TYPES.key(code.oath_type),
      algorithm: ALGORITHMS.key(code.algorithm),
    }]
  end.to_h
end