Sha256: 6ef7f287df94646aa427ede44077e31488a69b94c1c45a6f084c906e8605f3a0

Contents?: true

Size: 593 Bytes

Versions: 3

Compression:

Stored size: 593 Bytes

Contents

module BunnyApp
  class PortalSession
    @portal_session_create_mutation = <<-'GRAPHQL'
    mutation portalSessionCreate ($tenantCode: String!) {
      portalSessionCreate (tenantCode: $tenantCode) {
          token
          errors
      }
    }
    GRAPHQL

    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)
      res['data']['portalSessionCreate']['token']
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bunny_app-2.0.4 lib/bunny_app/portal_session.rb
bunny_app-2.0.1 lib/bunny_app/portal_session.rb
bunny_app-2.0.0 lib/bunny_app/portal_session.rb