Class: Seahorse::Client::AsyncBase

Inherits:
Base
  • Object
show all
Defined in:
lib/seahorse/client/async_base.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#config, #handlers

Instance Method Summary collapse

Methods inherited from Base

add_plugin, api, #build_request, clear_plugins, define, #inspect, new, plugins, remove_plugin, set_api, set_plugins

Methods included from HandlerBuilder

#handle, #handle_request, #handle_response, #handler_for, #new_handler

Constructor Details

#initialize(plugins, options) ⇒ AsyncBase

Returns a new instance of AsyncBase.



14
15
16
17
18
# File 'lib/seahorse/client/async_base.rb', line 14

def initialize(plugins, options)
  super
  @connection = H2::Connection.new(options)
  @options = options
end

Instance Attribute Details

#connectionH2::Connection (readonly)

Returns:



21
22
23
# File 'lib/seahorse/client/async_base.rb', line 21

def connection
  @connection
end

Instance Method Details

#close_connectionSymbol

Closes the underlying HTTP2 Connection for the client

Returns:

  • (Symbol)

    Returns the status of the connection (:closed)



31
32
33
# File 'lib/seahorse/client/async_base.rb', line 31

def close_connection
  @connection.close!
end

#connection_errorsObject



45
46
47
# File 'lib/seahorse/client/async_base.rb', line 45

def connection_errors
  @connection.errors
end

#new_connectionSeahorse::Client::H2::Connection

Creates a new HTTP2 Connection for the client



37
38
39
40
41
42
43
# File 'lib/seahorse/client/async_base.rb', line 37

def new_connection
  if @connection.closed?
    @connection = H2::Connection.new(@options)
  else
    @connection
  end
end

#operation_namesArray<Symbol>

Returns a list of valid async request operation names.

Returns:

  • (Array<Symbol>)

    Returns a list of valid async request operation names.



25
26
27
# File 'lib/seahorse/client/async_base.rb', line 25

def operation_names
  self.class.api.async_operation_names
end