Module: Irumugam::RequestMethods

Defined in:
lib/irumugam/spec_writer.rb

Instance Method Summary collapse

Instance Method Details

#perform_request(options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/irumugam/spec_writer.rb', line 5

def perform_request(options)
  path_object = options.delete(:path_object)
  if(path_object)
    path_object.each do |k,v|
      self.path.gsub!(":#{k}",v.to_s)
    end
  end
  options[:query]=self.params if self.params
  if self.request_body
    if self.request_type == :json
      options[:body]=self.request_body.to_json
      options[:headers]={"Content-Type"=>"application/json"}
    else
      options[:body]=self.request_body
    end
  end
  response = HTTParty.send(self.method.downcase.to_sym,self.test_host + self.path, options) 
end