Sha256: 5e39e4884077bdd0dbdcdb900753e896cd24d37f5330ebd2bb5a6485890792ee

Contents?: true

Size: 755 Bytes

Versions: 3

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

module Osso
  module GraphQL
    module Mutations
      class CreateOauthClient < BaseMutation
        null false

        argument :name, String, required: true

        field :oauth_client, Types::OauthClient, null: false
        field :errors, [String], null: false

        def resolve(**args)
          oauth_client = Osso::Models::OauthClient.new(args)

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

          response_error(oauth_client.errors)
        end

        def ready?(*)
          admin_ready?
        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/create_oauth_client.rb
osso-0.1.1 lib/osso/graphql/mutations/create_oauth_client.rb
osso-0.1.0 lib/osso/graphql/mutations/create_oauth_client.rb