Class: Gillbus::V2::Structs::AccessToken

Inherits:
Base
  • Object
show all
Defined in:
lib/gillbus/v2/structs/access_token.rb

Instance Attribute Summary

Attributes inherited from Base

#raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

field, from_raw_data, #initialize

Constructor Details

This class inherits a constructor from Gillbus::V2::Structs::Base

Class Method Details

.from_token_string(token) ⇒ Object



8
9
10
11
# File 'lib/gillbus/v2/structs/access_token.rb', line 8

def self.from_token_string(token)
  raw_data = { "access_token" => token }
  from_raw_data(raw_data)
end

Instance Method Details

#auth_headerObject



21
22
23
# File 'lib/gillbus/v2/structs/access_token.rb', line 21

def auth_header
  "#{token_type} #{access_token}"
end

#expired?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/gillbus/v2/structs/access_token.rb', line 13

def expired?
  !expires_on.nil? && expires_on <= DateTime.now.new_offset(0)
end

#to_sObject



17
18
19
# File 'lib/gillbus/v2/structs/access_token.rb', line 17

def to_s
  access_token
end