class Osso::GraphQL::Schema

Public Class Methods

id_from_object(object, _type_definition = nil, _query_ctx = nil) click to toggle source
# File lib/osso/graphql/schema.rb, line 20
def self.id_from_object(object, _type_definition = nil, _query_ctx = nil)
  GraphQL::Schema::UniqueWithinType.encode(object.class.name, object.id)
end
object_from_id(id, _query_ctx = nil) click to toggle source
# File lib/osso/graphql/schema.rb, line 24
def self.object_from_id(id, _query_ctx = nil)
  class_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
  Object.const_get(class_name).find(item_id)
end
resolve_type(_type, obj, _ctx) click to toggle source
# File lib/osso/graphql/schema.rb, line 29
def self.resolve_type(_type, obj, _ctx)
  case obj
  when Osso::Models::EnterpriseAccount
    Types::EnterpriseAccount
  when Osso::Models::IdentityProvider
    Types::IdentityProvider
  else
    raise("Unexpected object: #{obj}")
  end
end
unauthorized_object(error) click to toggle source
# File lib/osso/graphql/schema.rb, line 40
def self.unauthorized_object(error)
  raise ::GraphQL::ExecutionError, "An object of type #{error.type.graphql_name} was hidden due to permissions"
end