class EASY_HTTP

Public Class Methods

get(url, options = {}) click to toggle source

attr_accessor :url

# File lib/easy_http.rb, line 14
def self.get(url, options = {})
   puts 'hello'
   self.request_type Net::HTTP::Get, url, options
end
patch(url, options = {}) click to toggle source
# File lib/easy_http.rb, line 27
def self.patch(url, options = {})
   self.request_type Net::HTTP::Patch, url, options
end
post(url, options = {}) click to toggle source
# File lib/easy_http.rb, line 19
def self.post(url, options = {})
   self.request_type Net::HTTP::Post, url, options
end
put(url, options = {}) click to toggle source
# File lib/easy_http.rb, line 23
def self.put(url, options = {})
   self.request_type Net::HTTP::Put, url, options
end
request_type(http_method, url, option) click to toggle source
# File lib/easy_http.rb, line 49
def self.request_type http_method, url, option
  response =  Easy_http_Request::Request.new(http_method, url, option).connect()
end

Public Instance Methods

body_parse() click to toggle source
# File lib/easy_http.rb, line 36
def body_parse
   body_parser(self.params['body'])
end
body_parser(body ={}) click to toggle source
# File lib/easy_http.rb, line 45
def body_parser body ={}
  body.to_json
end
header_parse(header = {}) click to toggle source
# File lib/easy_http.rb, line 40
def header_parse header = {}
  raise ArgumentError, 'Headers must be an object which responds to #to_hash' unless header.respond_to?(:to_hash)
  default_options[:headers].merge!(h.to_hash)
end
params_paser() click to toggle source
# File lib/easy_http.rb, line 32
def params_paser
   header_parse(self.params['headers'])
end