Sha256: 45f57d12f167c081f1ba5e243edc1abaf81554629746847424a0b249949b85fe

Contents?: true

Size: 776 Bytes

Versions: 6

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true

module Ibrain::Mutations
  class GenerateFirebaseTokenMutation < AuthMutation
    field :result, Boolean, null: true
    field :token, String, null: true

    argument :attributes, ::Ibrain::Types::Input::GenerateFirebaseTokenInput, required: true

    def resolve(_args)
      token = repo.generate_custom_token!

      graphql_returning(token)
    end

    private

    def normalize_parameters
      attribute_params.permit(:code, :redirect_uri, :access_token)
    rescue StandardError
      ActionController::Parameters.new({})
    end

    def repo
      ::FirebaseRepository.new(nil, normalize_parameters)
    end

    def graphql_returning(token)
      OpenStruct.new(
        token: token,
        result: true
      )
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
its-ruby-auth-0.0.1 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.20 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.19 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.18 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.17 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb
ibrain-auth-0.3.16 app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb