Class: BunnyApp::PortalSession

Inherits:
Object
  • Object
show all
Defined in:
lib/bunny_app/portal_session.rb

Class Method Summary collapse

Class Method Details

.create(tenant_code:, expiry_hours: 24, return_url: nil) ⇒ Object

Raises:



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bunny_app/portal_session.rb', line 12

def self.create(tenant_code:, expiry_hours: 24, return_url: nil)
  variables = {
    tenantCode: tenant_code,
    returnUrl: return_url,
    expiry: expiry_hours
  }

  res = Client.new.query(@portal_session_create_mutation, variables)
  raise ResponseError, res['data']['portalSessionCreate']['errors'].join(',') if res['data']['portalSessionCreate']['errors']

  res['data']['portalSessionCreate']['token']
end