Class: Gmail::Authenticator::ImapBackupToken
- Inherits:
-
Object
- Object
- Gmail::Authenticator::ImapBackupToken
- Defined in:
- lib/gmail/authenticator.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
- #access_token ⇒ Object
- #client_id ⇒ Object
- #client_secret ⇒ Object
- #expiration_time_millis ⇒ Object
-
#initialize(token) ⇒ ImapBackupToken
constructor
A new instance of ImapBackupToken.
- #refresh_token ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(token) ⇒ ImapBackupToken
Returns a new instance of ImapBackupToken.
28 29 30 |
# File 'lib/gmail/authenticator.rb', line 28 def initialize(token) @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
10 11 12 |
# File 'lib/gmail/authenticator.rb', line 10 def token @token end |
Class Method Details
.from(access_token:, client_id:, client_secret:, expiration_time_millis:, refresh_token:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gmail/authenticator.rb', line 12 def self.from( access_token:, client_id:, client_secret:, expiration_time_millis:, refresh_token: ) { access_token: access_token, client_id: client_id, client_secret: client_secret, expiration_time_millis: expiration_time_millis, refresh_token: refresh_token }.to_json end |
Instance Method Details
#access_token ⇒ Object
43 44 45 |
# File 'lib/gmail/authenticator.rb', line 43 def access_token body["access_token"] end |
#client_id ⇒ Object
47 48 49 |
# File 'lib/gmail/authenticator.rb', line 47 def client_id body["client_id"] end |
#client_secret ⇒ Object
51 52 53 |
# File 'lib/gmail/authenticator.rb', line 51 def client_secret body["client_secret"] end |
#expiration_time_millis ⇒ Object
55 56 57 |
# File 'lib/gmail/authenticator.rb', line 55 def expiration_time_millis body["expiration_time_millis"] end |
#refresh_token ⇒ Object
59 60 61 |
# File 'lib/gmail/authenticator.rb', line 59 def refresh_token body["refresh_token"] end |
#valid? ⇒ Boolean
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gmail/authenticator.rb', line 32 def valid? return false if !body return false if !access_token return false if !client_id return false if !client_secret return false if !expiration_time_millis return false if !refresh_token true end |