Class: Ksef::Auth::OperationStatus
- Inherits:
-
Data
- Object
- Data
- Ksef::Auth::OperationStatus
- Defined in:
- lib/ksef/auth/operation_status.rb
Overview
The response to GET /auth/{referenceNumber} — the contract's
AuthenticationOperationStatusResponse.
Instance Attribute Summary collapse
-
#authentication_method ⇒ Object
readonly
Returns the value of attribute authentication_method.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#last_refresh_at ⇒ Object
readonly
Returns the value of attribute last_refresh_at.
-
#refresh_token_valid_until ⇒ Object
readonly
Returns the value of attribute refresh_token_valid_until.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#token_redeemed ⇒ Object
readonly
Returns the value of attribute token_redeemed.
Class Method Summary collapse
Instance Method Summary collapse
-
#explain ⇒ Object
Prefers the server's own wording; falls back to our table when it sends none.
- #in_progress? ⇒ Boolean
- #retryable? ⇒ Boolean
- #success? ⇒ Boolean
- #terminal? ⇒ Boolean
Instance Attribute Details
#authentication_method ⇒ Object (readonly)
Returns the value of attribute authentication_method
7 8 9 |
# File 'lib/ksef/auth/operation_status.rb', line 7 def authentication_method @authentication_method end |
#code ⇒ Object (readonly)
Returns the value of attribute code
7 8 9 |
# File 'lib/ksef/auth/operation_status.rb', line 7 def code @code end |
#description ⇒ Object (readonly)
Returns the value of attribute description
7 8 9 |
# File 'lib/ksef/auth/operation_status.rb', line 7 def description @description end |
#details ⇒ Object (readonly)
Returns the value of attribute details
7 8 9 |
# File 'lib/ksef/auth/operation_status.rb', line 7 def details @details end |
#last_refresh_at ⇒ Object (readonly)
Returns the value of attribute last_refresh_at
7 8 9 |
# File 'lib/ksef/auth/operation_status.rb', line 7 def last_refresh_at @last_refresh_at end |
#refresh_token_valid_until ⇒ Object (readonly)
Returns the value of attribute refresh_token_valid_until
7 8 9 |
# File 'lib/ksef/auth/operation_status.rb', line 7 def refresh_token_valid_until @refresh_token_valid_until end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at
7 8 9 |
# File 'lib/ksef/auth/operation_status.rb', line 7 def started_at @started_at end |
#token_redeemed ⇒ Object (readonly)
Returns the value of attribute token_redeemed
7 8 9 |
# File 'lib/ksef/auth/operation_status.rb', line 7 def token_redeemed @token_redeemed end |
Class Method Details
.from(payload) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ksef/auth/operation_status.rb', line 11 def self.from(payload) status = payload["status"] || {} new( code: status["code"], description: status["description"], details: Array(status["details"]).freeze, authentication_method: payload["authenticationMethod"], started_at: Ksef::Auth.time(payload["startDate"]), token_redeemed: payload["isTokenRedeemed"], last_refresh_at: Ksef::Auth.time(payload["lastTokenRefreshDate"]), refresh_token_valid_until: Ksef::Auth.time(payload["refreshTokenValidUntil"]) ) end |
Instance Method Details
#explain ⇒ Object
Prefers the server's own wording; falls back to our table when it sends none.
31 |
# File 'lib/ksef/auth/operation_status.rb', line 31 def explain = description.to_s.empty? ? Status.describe(code) : description |
#in_progress? ⇒ Boolean
25 |
# File 'lib/ksef/auth/operation_status.rb', line 25 def in_progress? = Status.in_progress?(code) |
#retryable? ⇒ Boolean
28 |
# File 'lib/ksef/auth/operation_status.rb', line 28 def retryable? = Status.retryable?(code) |