Class: TinyAppstoreConnect::Token
- Inherits:
-
Object
- Object
- TinyAppstoreConnect::Token
- Defined in:
- lib/tiny_appstore_connect/token.rb
Constant Summary collapse
- DEFAULT_TOKEN_DURATION =
maximum expiration supported by AppStore (20 minutes) detail: developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests
10 * 60
- AUDIENCE =
'appstoreconnect-v1'
- ALGORITHM =
'ES256'
Instance Attribute Summary collapse
-
#issuer_id ⇒ Object
readonly
Returns the value of attribute issuer_id.
-
#key_id ⇒ Object
readonly
Returns the value of attribute key_id.
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
Instance Method Summary collapse
-
#initialize(**kargs) ⇒ Token
constructor
A new instance of Token.
- #token ⇒ Object
Constructor Details
#initialize(**kargs) ⇒ Token
Returns a new instance of Token.
19 20 21 22 23 24 |
# File 'lib/tiny_appstore_connect/token.rb', line 19 def initialize(**kargs) @duration = kargs[:duration] || DEFAULT_TOKEN_DURATION @issuer_id = kargs[:issuer_id] @key_id = kargs[:key_id] @private_key = handle_private_key(kargs[:private_key]) end |
Instance Attribute Details
#issuer_id ⇒ Object (readonly)
Returns the value of attribute issuer_id.
17 18 19 |
# File 'lib/tiny_appstore_connect/token.rb', line 17 def issuer_id @issuer_id end |
#key_id ⇒ Object (readonly)
Returns the value of attribute key_id.
17 18 19 |
# File 'lib/tiny_appstore_connect/token.rb', line 17 def key_id @key_id end |
#private_key ⇒ Object (readonly)
Returns the value of attribute private_key.
17 18 19 |
# File 'lib/tiny_appstore_connect/token.rb', line 17 def private_key @private_key end |
Instance Method Details
#token ⇒ Object
26 27 28 |
# File 'lib/tiny_appstore_connect/token.rb', line 26 def token JWT.encode(payload, private_key, ALGORITHM, header_fields) end |