Class: AWS::Core::Client::ClientRequestMethodBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/core/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client_class, method_name, &block) ⇒ ClientRequestMethodBuilder

Returns a new instance of ClientRequestMethodBuilder.



504
505
506
507
508
509
510
511
# File 'lib/aws/core/client.rb', line 504

def initialize client_class, method_name, &block
  @client_class = client_class
  @method_name = method_name
  configure_request {|request, options|}
  process_response {|response|}
  simulate_response {|response|}
  instance_eval(&block)
end

Instance Method Details

#configure_request(options = {}, &block) ⇒ Object



513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/aws/core/client.rb', line 513

def configure_request options = {}, &block
  name = "configure_#{@method_name}_request"
  MetaUtils.class_extend_method(@client_class, name, &block)
  if block.arity == 3
    m = Module.new
    m.module_eval(<<-END)
      def #{name}(req, options, &block)
        super(req, options, block)
      end
    END
    @client_class.send(:include, m)
  end
end

#process_response(&block) ⇒ Object



527
528
529
530
# File 'lib/aws/core/client.rb', line 527

def process_response &block
  name = "process_#{@method_name}_response"
  MetaUtils.class_extend_method(@client_class, name, &block)
end

#simulate_response(&block) ⇒ Object



532
533
534
535
# File 'lib/aws/core/client.rb', line 532

def simulate_response &block
  name = "simulate_#{@method_name}_response"
  MetaUtils.class_extend_method(@client_class, name, &block)
end