Class: Slk::Models::Workspace
- Inherits:
-
Data
- Object
- Data
- Slk::Models::Workspace
- Defined in:
- lib/slk/models/workspace.rb
Instance Attribute Summary collapse
-
#cookie ⇒ Object
readonly
Returns the value of attribute cookie.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(name:, token:, cookie: nil) ⇒ Workspace
constructor
A new instance of Workspace.
- #to_s ⇒ Object
- #xoxb? ⇒ Boolean
- #xoxc? ⇒ Boolean
- #xoxp? ⇒ Boolean
Constructor Details
#initialize(name:, token:, cookie: nil) ⇒ Workspace
Returns a new instance of Workspace.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/slk/models/workspace.rb', line 9 def initialize(name:, token:, cookie: nil) name_str = name.to_s.strip token_str = token.to_s = &.to_s validate_name!(name_str) validate_token!(token_str) (token_str, ) super(name: name_str.freeze, token: token_str.freeze, cookie: &.freeze) end |
Instance Attribute Details
#cookie ⇒ Object (readonly)
Returns the value of attribute cookie
8 9 10 |
# File 'lib/slk/models/workspace.rb', line 8 def @cookie end |
#name ⇒ Object (readonly)
Returns the value of attribute name
8 9 10 |
# File 'lib/slk/models/workspace.rb', line 8 def name @name end |
#token ⇒ Object (readonly)
Returns the value of attribute token
8 9 10 |
# File 'lib/slk/models/workspace.rb', line 8 def token @token end |
Instance Method Details
#headers ⇒ Object
27 28 29 30 31 |
# File 'lib/slk/models/workspace.rb', line 27 def headers h = { 'Authorization' => "Bearer #{token}", 'Content-Type' => 'application/json; charset=utf-8' } h['Cookie'] = "d=#{}" if h end |
#to_s ⇒ Object
25 |
# File 'lib/slk/models/workspace.rb', line 25 def to_s = name |
#xoxb? ⇒ Boolean
22 |
# File 'lib/slk/models/workspace.rb', line 22 def xoxb? = token.start_with?('xoxb-') |
#xoxc? ⇒ Boolean
21 |
# File 'lib/slk/models/workspace.rb', line 21 def xoxc? = token.start_with?('xoxc-') |
#xoxp? ⇒ Boolean
23 |
# File 'lib/slk/models/workspace.rb', line 23 def xoxp? = token.start_with?('xoxp-') |