Class: Osso::GraphQL::Mutations::CreateIdentityProvider

Inherits:
BaseMutation
  • Object
show all
Defined in:
lib/osso/graphql/mutations/create_identity_provider.rb

Instance Method Summary collapse

Methods inherited from BaseMutation

#account_domain, #admin_ready?, #domain_ready?, #field_errors, #internal_ready?, #provider_domain, #ready?, #response_data, #response_error

Instance Method Details

#domain(enterprise_account_id:, **args) ⇒ Object



30
31
32
# File 'lib/osso/graphql/mutations/create_identity_provider.rb', line 30

def domain(enterprise_account_id:, **args)
  (enterprise_account_id: )&.domain
end

#enterprise_account(enterprise_account_id:) ⇒ Object



34
35
36
# File 'lib/osso/graphql/mutations/create_identity_provider.rb', line 34

def (enterprise_account_id:)
  @enterprise_account ||= Osso::Models::EnterpriseAccount.find()
end

#resolve(service: nil, enterprise_account_id:, oauth_client_id:) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/osso/graphql/mutations/create_identity_provider.rb', line 16

def resolve(service: nil, enterprise_account_id:, oauth_client_id:)
  customer = (enterprise_account_id: )

  identity_provider = customer.identity_providers.build(
    service: service,
    domain: customer.domain,
    oauth_client_id: oauth_client_id,
  )

  return response_data(identity_provider: identity_provider) if identity_provider.save

  response_error(identity_provider.errors)
end