Class: VertxWebGraphql::GraphiQLHandler

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb

Overview

A VertxWeb::Route handler for GraphiQL resources.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)

19
20
21
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb', line 19

def @@j_api_type.accept?(obj)
  obj.class == GraphiQLHandler
end

+ (::VertxWebGraphql::GraphiQLHandler) create(options = nil)

Create a new VertxWebGraphql::GraphiQLHandler.

The handler will be configured with the given options.

Parameters:

Returns:

Raises:

  • (ArgumentError)

48
49
50
51
52
53
54
55
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb', line 48

def self.create(options=nil)
  if !block_given? && options == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandlerGraphql::GraphiQLHandler.java_method(:create, []).call(),::VertxWebGraphql::GraphiQLHandler)
  elsif options.class == Hash && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtWebHandlerGraphql::GraphiQLHandler.java_method(:create, [Java::IoVertxExtWebHandlerGraphql::GraphiQLHandlerOptions.java_class]).call(Java::IoVertxExtWebHandlerGraphql::GraphiQLHandlerOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxWebGraphql::GraphiQLHandler)
  end
  raise ArgumentError, "Invalid arguments when calling create(#{options})"
end

+ (Object) j_api_type


28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb', line 28

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class


31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb', line 31

def self.j_class
  Java::IoVertxExtWebHandlerGraphql::GraphiQLHandler.java_class
end

+ (Object) unwrap(obj)


25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb', line 25

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)


22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb', line 22

def @@j_api_type.wrap(obj)
  GraphiQLHandler.new(obj)
end

Instance Method Details

- (self) graphi_ql_request_headers(factory = nil) { ... }

Customize the HTTP headers to add to GraphQL requests sent by the GraphiQL user interface. The result will be applied on top of the fixed set of headers specified in Hash#get_headers.

This can be useful if, for example, the server is protected by authentication.

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

62
63
64
65
66
67
68
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb', line 62

def graphi_ql_request_headers(factory=nil)
  if block_given? && factory == nil
    @j_del.java_method(:graphiQLRequestHeaders, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::RoutingContext)).j_del }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling graphi_ql_request_headers(#{factory})"
end

- (void) handle(event = nil)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:

Raises:

  • (ArgumentError)

37
38
39
40
41
42
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graphi_ql_handler.rb', line 37

def handle(event=nil)
  if event.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:handle, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(event.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling handle(#{event})"
end