Module: Koala::NetHTTPService
- Includes:
- HTTPService
- Defined in:
- lib/koala/http_services/net_http_service.rb
Class Attribute Summary collapse
-
.ca_file ⇒ Object
Returns the value of attribute ca_file.
-
.ca_path ⇒ Object
Returns the value of attribute ca_path.
-
.verify_mode ⇒ Object
Returns the value of attribute verify_mode.
Class Method Summary collapse
Methods included from HTTPService
Class Attribute Details
.ca_file ⇒ Object
Returns the value of attribute ca_file.
12 13 14 |
# File 'lib/koala/http_services/net_http_service.rb', line 12 def ca_file @ca_file end |
.ca_path ⇒ Object
Returns the value of attribute ca_path.
12 13 14 |
# File 'lib/koala/http_services/net_http_service.rb', line 12 def ca_path @ca_path end |
.verify_mode ⇒ Object
Returns the value of attribute verify_mode.
12 13 14 |
# File 'lib/koala/http_services/net_http_service.rb', line 12 def verify_mode @verify_mode end |
Class Method Details
.make_request(path, args, verb, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/koala/http_services/net_http_service.rb', line 15 def self.make_request(path, args, verb, = {}) # We translate args to a valid query string. If post is specified, # we send a POST request to the given path with the given arguments. # by default, we use SSL only for private requests # this makes public requests faster private_request = args["access_token"] || @always_use_ssl || [:use_ssl] # if the verb isn't get or post, send it as a post argument args.merge!({:method => verb}) && verb = "post" if verb != "get" && verb != "post" http = create_http(server(), private_request, ) response = http.start do |http| if verb == "post" if params_require_multipart? args http.request Net::HTTP::Post::Multipart.new path, encode_multipart_params(args) else http.post(path, encode_params(args)) end else http.get("#{path}?#{encode_params(args)}") end end Koala::Response.new(response.code.to_i, response.body, response) end |