Class: YubiOATH::Put
- Inherits:
-
Object
- Object
- YubiOATH::Put
- Defined in:
- lib/yubioath/put.rb
Defined Under Namespace
Classes: Request
Instance Method Summary collapse
- #call(name:, secret:, algorithm:, type:, digits:) ⇒ Object
-
#initialize(card) ⇒ Put
constructor
A new instance of Put.
Constructor Details
#initialize(card) ⇒ Put
Returns a new instance of Put.
8 9 10 |
# File 'lib/yubioath/put.rb', line 8 def initialize(card) @card = card end |
Instance Method Details
#call(name:, secret:, algorithm:, type:, digits:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/yubioath/put.rb', line 12 def call(name:, secret:, algorithm:, type:, digits:) data = Request::Data.new( name: name, oath_type: TYPES.fetch(type), algorithm: ALGORITHMS.fetch(algorithm), digits: digits, secret: secret, ) request = Request.new(data: data.to_binary_s) bytes = @card.transmit(request.to_binary_s) Response.read(bytes).success? end |