Class: Cronofy::Credentials
- Inherits:
-
Object
- Object
- Cronofy::Credentials
- Defined in:
- lib/cronofy/types.rb
Defined Under Namespace
Classes: LinkingProfile
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#application_calendar_id ⇒ Object
readonly
Returns the value of attribute application_calendar_id.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#expires_in ⇒ Object
readonly
Returns the value of attribute expires_in.
-
#linking_profile ⇒ Object
readonly
Returns the value of attribute linking_profile.
-
#refresh_token ⇒ Object
readonly
Returns the value of attribute refresh_token.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#sub ⇒ Object
readonly
Returns the value of attribute sub.
Instance Method Summary collapse
-
#initialize(oauth_token) ⇒ Credentials
constructor
A new instance of Credentials.
- #to_h ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(oauth_token) ⇒ Credentials
Returns a new instance of Credentials.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cronofy/types.rb', line 46 def initialize(oauth_token) @access_token = oauth_token.token @account_id = oauth_token.params['account_id'] @application_calendar_id = oauth_token.params['application_calendar_id'] @sub = oauth_token.params['sub'] @expires_at = oauth_token.expires_at @expires_in = oauth_token.expires_in @refresh_token = oauth_token.refresh_token @scope = oauth_token.params['scope'] if details = oauth_token.params['linking_profile'] @linking_profile = LinkingProfile.new(details) end end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
36 37 38 |
# File 'lib/cronofy/types.rb', line 36 def access_token @access_token end |
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
37 38 39 |
# File 'lib/cronofy/types.rb', line 37 def account_id @account_id end |
#application_calendar_id ⇒ Object (readonly)
Returns the value of attribute application_calendar_id.
38 39 40 |
# File 'lib/cronofy/types.rb', line 38 def application_calendar_id @application_calendar_id end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
40 41 42 |
# File 'lib/cronofy/types.rb', line 40 def expires_at @expires_at end |
#expires_in ⇒ Object (readonly)
Returns the value of attribute expires_in.
41 42 43 |
# File 'lib/cronofy/types.rb', line 41 def expires_in @expires_in end |
#linking_profile ⇒ Object (readonly)
Returns the value of attribute linking_profile.
42 43 44 |
# File 'lib/cronofy/types.rb', line 42 def linking_profile @linking_profile end |
#refresh_token ⇒ Object (readonly)
Returns the value of attribute refresh_token.
43 44 45 |
# File 'lib/cronofy/types.rb', line 43 def refresh_token @refresh_token end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
44 45 46 |
# File 'lib/cronofy/types.rb', line 44 def scope @scope end |
#sub ⇒ Object (readonly)
Returns the value of attribute sub.
39 40 41 |
# File 'lib/cronofy/types.rb', line 39 def sub @sub end |
Instance Method Details
#to_h ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/cronofy/types.rb', line 61 def to_h hash = { access_token: access_token, expires_at: expires_at, expires_in: expires_in, refresh_token: refresh_token, scope: scope, } if account_id hash[:account_id] = account_id end if application_calendar_id hash[:application_calendar_id] = application_calendar_id end if sub hash[:sub] = sub end if linking_profile hash[:linking_profile] = linking_profile.to_h end hash end |
#to_hash ⇒ Object
89 90 91 92 |
# File 'lib/cronofy/types.rb', line 89 def to_hash warn "#to_hash has been deprecated, use #to_h instead" to_h end |