Sha256: bd96ecc241910e2228674808931c5fe3fdcb8296aa97f5a2f2816197e18dac07

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Osso
  module GraphQL
    module Mutations
      class ConfigureIdentityProvider < BaseMutation
        null false
        argument :id, ID, required: true
        argument :service, Types::IdentityProviderService, required: false
        argument :sso_url, String, required: false
        argument :sso_cert, String, required: false

        field :identity_provider, Types::IdentityProvider, null: true

        def resolve(**args)
          provider = identity_provider(**args)

          if provider.update(args)
            Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: args)
            return response_data(identity_provider: provider)
          end

          response_error(provider.errors)
        end

        def domain(**args)
          identity_provider(**args)&.domain
        end

        def identity_provider(id:, **_args)
          @identity_provider ||= Osso::Models::IdentityProvider.find(id)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
osso-0.1.2 lib/osso/graphql/mutations/configure_identity_provider.rb
osso-0.1.1 lib/osso/graphql/mutations/configure_identity_provider.rb
osso-0.1.0 lib/osso/graphql/mutations/configure_identity_provider.rb