You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Seahorse::Client::Plugin

Inherits:
Object
  • Object
show all
Extended by:
HandlerBuilder
Defined in:
gems/aws-sdk-core/lib/seahorse/client/plugin.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HandlerBuilder

handle, handle_request, handle_response

Class Method Details

.after_initialize(&block) ⇒ Object



69
70
71
# File 'gems/aws-sdk-core/lib/seahorse/client/plugin.rb', line 69

def after_initialize(&block)
  after_initialize_hooks << block
end

.before_initialize(&block) ⇒ Object



65
66
67
# File 'gems/aws-sdk-core/lib/seahorse/client/plugin.rb', line 65

def before_initialize(&block)
  before_initialize_hooks << block
end

.option(name, options = {}, &block) ⇒ void

This method returns an undefined value.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :default (Object)

    Can also be set by passing a block.

  • :doc_default (String)
  • :required (Boolean)
  • :doc_type (String)
  • :docs (String)


52
53
54
55
56
57
58
59
60
61
62
63
# File 'gems/aws-sdk-core/lib/seahorse/client/plugin.rb', line 52

def option(name, default = nil, options = {}, &block)
  # For backwards-compat reasons, the default value can be passed as 2nd
  # positional argument (before the options hash) or as the `:default` option
  # in the options hash.
  if Hash === default
    options = default
  else
    options[:default] = default
  end
  options[:default_block] = Proc.new if block_given?
  self.options << PluginOption.new(name, options)
end

Instance Method Details

#add_handlers(handlers, config) ⇒ void

This method returns an undefined value.

Parameters:



22
23
24
# File 'gems/aws-sdk-core/lib/seahorse/client/plugin.rb', line 22

def add_handlers(handlers, config)
  handlers.copy_from(self.class.handlers)
end

#add_options(config) ⇒ void

This method returns an undefined value.

Parameters:



9
10
11
12
13
14
15
16
17
# File 'gems/aws-sdk-core/lib/seahorse/client/plugin.rb', line 9

def add_options(config)
  self.class.options.each do |option|
    if option.default_block
      config.add_option(option.name, &option.default_block)
    else
      config.add_option(option.name, option.default)
    end
  end
end

#after_initialize(client) ⇒ void

This method returns an undefined value.

Parameters:



37
38
39
40
41
# File 'gems/aws-sdk-core/lib/seahorse/client/plugin.rb', line 37

def after_initialize(client)
  self.class.after_initialize_hooks.each do |block|
    block.call(client)
  end
end

#before_initialize(client_class, options) ⇒ void

This method returns an undefined value.

Parameters:



29
30
31
32
33
# File 'gems/aws-sdk-core/lib/seahorse/client/plugin.rb', line 29

def before_initialize(client_class, options)
  self.class.before_initialize_hooks.each do |block|
    block.call(client_class, options)
  end
end