mockserver-client-ruby/lib/cli.rb
# Process a block using options extracted into a struct
# @param mockserver [Boolean] true to use mockserver, false to use proxy
# @yieldparam [AbstractClient] a mockserver or a proxy client
# @yieldparam [Struct] a struct created from options hash
Process a block using options extracted into a struct
Process a block using options extracted into a struct
def execute_command(mockserver = false, data_required = false, error_msg = '--data option must be provided', &_)
    print_parameters(options)
    struct_options = to_struct({ data: nil }.merge(options))
    if data_required && !options['data']
      error(error_msg)
    else
      client = mockserver ? mockserver_client(struct_options) : proxy_client(struct_options)
      yield client, struct_options if block_given?
    end
  end
def execute_command ( mockserver = false , data_required = false , error_msg = '--data option must be provided' , & _ ) print_parameters ( options ) struct_options = to_struct ( { data : nil } . merge ( options ) ) if data_required && ! options [ 'data' ] error ( error_msg ) else client = mockserver ? mockserver_client ( struct_options ) : proxy_client ( struct_options ) yield client , struct_options if block_given? end end
Process a block using options extracted into a struct
Process a block using options extracted into a struct
mockserver
true to use mockserver, false to use proxy
true to use mockserver false to use proxy
data_required
<not_specific>
error_msg
<not_specific>
_
<not_specific>
<not_specific>
a struct created from options hash
a struct created from options hash