Class: Teems::Models::Account
- Inherits:
-
Data
- Object
- Data
- Teems::Models::Account
- Defined in:
- lib/teems/models/account.rb
Overview
Represents a Teams account with authentication tokens
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
readonly
Returns the value of attribute auth_token.
-
#chatsvc_token ⇒ Object
readonly
Returns the value of attribute chatsvc_token.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#presence_token ⇒ Object
readonly
Returns the value of attribute presence_token.
-
#skype_token ⇒ Object
readonly
Returns the value of attribute skype_token.
Instance Method Summary collapse
-
#chatsvc_auth_header ⇒ Object
Authorization header for chatsvcagg endpoints.
-
#initialize(name:, auth_token:, skype_token:, chatsvc_token: nil, presence_token: nil) ⇒ Account
constructor
A new instance of Account.
-
#skype_auth_header ⇒ Object
Authorization header for Skype/chat API endpoints.
-
#skype_headers ⇒ Object
Headers for Skype API requests.
-
#teams_auth_header ⇒ Object
Authorization header for Teams API endpoints.
-
#teams_headers ⇒ Object
Headers for Teams API requests.
Constructor Details
#initialize(name:, auth_token:, skype_token:, chatsvc_token: nil, presence_token: nil) ⇒ Account
Returns a new instance of Account.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/teems/models/account.rb', line 7 def initialize(name:, auth_token:, skype_token:, chatsvc_token: nil, presence_token: nil) validate_tokens!(auth_token, skype_token) super( name: name.to_s.freeze, auth_token: auth_token.to_s.freeze, skype_token: skype_token.to_s.freeze, chatsvc_token: chatsvc_token&.to_s&.freeze, presence_token: presence_token&.to_s&.freeze ) end |
Instance Attribute Details
#auth_token ⇒ Object (readonly)
Returns the value of attribute auth_token
6 7 8 |
# File 'lib/teems/models/account.rb', line 6 def auth_token @auth_token end |
#chatsvc_token ⇒ Object (readonly)
Returns the value of attribute chatsvc_token
6 7 8 |
# File 'lib/teems/models/account.rb', line 6 def chatsvc_token @chatsvc_token end |
#name ⇒ Object (readonly)
Returns the value of attribute name
6 7 8 |
# File 'lib/teems/models/account.rb', line 6 def name @name end |
#presence_token ⇒ Object (readonly)
Returns the value of attribute presence_token
6 7 8 |
# File 'lib/teems/models/account.rb', line 6 def presence_token @presence_token end |
#skype_token ⇒ Object (readonly)
Returns the value of attribute skype_token
6 7 8 |
# File 'lib/teems/models/account.rb', line 6 def skype_token @skype_token end |
Instance Method Details
#chatsvc_auth_header ⇒ Object
Authorization header for chatsvcagg endpoints
29 30 31 32 33 |
# File 'lib/teems/models/account.rb', line 29 def chatsvc_auth_header return nil unless chatsvc_token "Bearer #{chatsvc_token}" end |
#skype_auth_header ⇒ Object
Authorization header for Skype/chat API endpoints
24 25 26 |
# File 'lib/teems/models/account.rb', line 24 def skype_auth_header "skypetoken=#{skype_token}" end |
#skype_headers ⇒ Object
Headers for Skype API requests
44 45 46 47 48 49 |
# File 'lib/teems/models/account.rb', line 44 def skype_headers { 'Authentication' => skype_auth_header, 'Content-Type' => 'application/json' } end |
#teams_auth_header ⇒ Object
Authorization header for Teams API endpoints
19 20 21 |
# File 'lib/teems/models/account.rb', line 19 def teams_auth_header "Bearer #{auth_token}" end |
#teams_headers ⇒ Object
Headers for Teams API requests
36 37 38 39 40 41 |
# File 'lib/teems/models/account.rb', line 36 def teams_headers { 'Authorization' => teams_auth_header, 'Content-Type' => 'application/json' } end |