class Seahorse::Client::Plugins::OperationMethods
resp = client.api_operation_name(request_params)
# using the helper method defined by OperationMethods
resp = req.send_request
req = client.build_request(:api_operation_name, request_params)
# without OperationMethods plugin
handles building and sending the appropriate {Request}.
Additionally, it adds a helper method for each operation. This helper
#=> [:api_operation_name1, :api_operation_name2, …]
client.operation_names
operations.
This plugin adds a helper method that lists the available API
# Helper Methods
sends the named request.
Defines a helper method for each API operation that builds and
def add_operation_helpers(client, operations)
def add_operation_helpers(client, operations) operations.each do |name| client.class.send(:define_method, name) do |*args, &block| params = args[0] || {} send_options = args[1] || {} build_request(name, params).send_request(send_options, &block) end end client.class.send(:define_method, :operation_names) { operations } end
def after_initialize(client)
def after_initialize(client) unless client.respond_to?(:operation_names) client.class.mutex.synchronize do unless client.respond_to?(:operation_names) add_operation_helpers(client, client.config.api.operation_names) end end end end