Class: Tripletexer::Endpoints::Token::Session
Constant Summary
collapse
- DAY_IN_SECONDS =
24 * 60 * 60
Instance Method Summary
collapse
#initialize
#format_date, #normalize_body
Instance Method Details
#create(consumer_token, employee_token, expiration_date: Time.now.utc + DAY_IN_SECONDS) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/tripletexer/endpoints/token/session.rb', line 8
def create(consumer_token, employee_token, expiration_date: Time.now.utc + DAY_IN_SECONDS)
response = put('/v2/token/session/:create') do |req|
req.params = {
'consumerToken' => consumer_token,
'employeeToken' => employee_token,
'expirationDate' => format_date(expiration_date)
}
end
connection.token = response.dig('value', 'token')
response
end
|
#destroy(token = connection.token) ⇒ Object
26
27
28
29
30
|
# File 'lib/tripletexer/endpoints/token/session.rb', line 26
def destroy(token = connection.token)
response = delete("/v2/token/session/#{token}")
connection.reset
response
end
|
#whoami ⇒ Object
21
22
23
|
# File 'lib/tripletexer/endpoints/token/session.rb', line 21
def whoami
find_entity('/v2/token/session/>whoAmI')
end
|