class HelperModule::RichBodyContent
Public Instance Methods
add_parameters(params = {}, type = 'json')
click to toggle source
# File lib/helpers/simple_http_helper.rb, line 143 def add_parameters(params = {}, type = 'json') if type == 'json' @body = params.to_json @content_type = 'application/json' @type = type else raise NotImplementedError, "only support json, #{type} is not supported" end end
add_url_parameters(params = {})
click to toggle source
# File lib/helpers/simple_http_helper.rb, line 153 def add_url_parameters(params = {}) @uri.query = URI.encode_www_form(params) end
get_request()
click to toggle source
# File lib/helpers/simple_http_helper.rb, line 131 def get_request _request = self.get_request_klass.new(@uri) _request.body = @body if @body _request.content_type = @content_type if @content_type @headers.each_pair do |key, value| _request.add_field(key, value) end _request end