Class: Osso::GraphQL::Mutations::RegenerateOauthCredentials

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

Instance Method Summary collapse

Methods inherited from BaseMutation

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

Instance Method Details

#ready?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/osso/graphql/mutations/regenerate_oauth_credentials.rb', line 23

def ready?(*)
  admin_ready?
end

#resolve(id:) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/osso/graphql/mutations/regenerate_oauth_credentials.rb', line 14

def resolve(id:)
  oauth_client = Osso::Models::OauthClient.find(id)
  oauth_client.regenerate_secrets!

  return response_data(oauth_client: oauth_client) if oauth_client.save

  response_error(oauth_client.errors)
end