Class: ApnsGatling::Token
- Inherits:
-
Object
- Object
- ApnsGatling::Token
- Defined in:
- lib/apns_gatling/jwt_token.rb
Instance Attribute Summary collapse
-
#auth_key_id ⇒ Object
readonly
Returns the value of attribute auth_key_id.
-
#ecdsa_key ⇒ Object
readonly
Returns the value of attribute ecdsa_key.
-
#team_id ⇒ Object
readonly
Returns the value of attribute team_id.
Instance Method Summary collapse
-
#initialize(team_id, auth_key_id, ecdsa_key) ⇒ Token
constructor
A new instance of Token.
- #new_token ⇒ Object
Constructor Details
#initialize(team_id, auth_key_id, ecdsa_key) ⇒ Token
Returns a new instance of Token.
7 8 9 10 11 |
# File 'lib/apns_gatling/jwt_token.rb', line 7 def initialize(team_id, auth_key_id, ecdsa_key) @team_id = team_id @auth_key_id = auth_key_id @ecdsa_key = ecdsa_key end |
Instance Attribute Details
#auth_key_id ⇒ Object (readonly)
Returns the value of attribute auth_key_id.
5 6 7 |
# File 'lib/apns_gatling/jwt_token.rb', line 5 def auth_key_id @auth_key_id end |
#ecdsa_key ⇒ Object (readonly)
Returns the value of attribute ecdsa_key.
5 6 7 |
# File 'lib/apns_gatling/jwt_token.rb', line 5 def ecdsa_key @ecdsa_key end |
#team_id ⇒ Object (readonly)
Returns the value of attribute team_id.
5 6 7 |
# File 'lib/apns_gatling/jwt_token.rb', line 5 def team_id @team_id end |
Instance Method Details
#new_token ⇒ Object
13 14 15 16 17 |
# File 'lib/apns_gatling/jwt_token.rb', line 13 def new_token payload = {iss: @team_id, iat: Time.now.to_i} header = {kid: @auth_key_id} JWT.encode payload, @ecdsa_key, 'ES256', header end |