Module: DotNetServices::HTTPRequests
- Included in:
- MessageBuffer, SamlTokenProvider, SimpleWebTokenProvider, TokenProvider
- Defined in:
- lib/service_bus/requests.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ToHash
Instance Method Summary collapse
- #delete(url, options = {}) ⇒ Object
- #get(url, options = {}) ⇒ Object
- #post(url, data, options = {}) {|req, http| ... } ⇒ Object
- #proxy ⇒ Object
- #put(url, data, options = {}) {|req, http| ... } ⇒ Object
Instance Method Details
#delete(url, options = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/service_bus/requests.rb', line 58 def delete(url, = {}) header = [:header] if [:header] url = URI.parse(url) url_path = (url.query && url.query != '') ? (url.path + '?' + url.query) : url.path req = Net::HTTP::Delete.new(url_path, header) req.basic_auth [:http_username], [:http_password] if [:http_username] && [:http_password] res = proxy.start(url.host, url.port) do |http| yield(req, http) if block_given? http.request(req) end res end |
#get(url, options = {}) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/service_bus/requests.rb', line 46 def get(url, = {}) header = [:header] if [:header] url = URI.parse(url) req = Net::HTTP::Get.new(url.path, header) req.basic_auth [:http_username], [:http_password] if [:http_username] && [:http_password] res = proxy.start(url.host, url.port) do |http| yield(req, http) if block_given? http.request(req) end res end |
#post(url, data, options = {}) {|req, http| ... } ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/service_bus/requests.rb', line 71 def post(url, data, = {}) header = [:header] if [:header] url = URI.parse(url) url_path = (url.query && url.query != '') ? (url.path + '?' + url.query) : url.path http = proxy.new(url.host, url.port) http.use_ssl = true if [:use_ssl] http = http.start yield(req, http) if block_given? res = http.post(url_path, data, header) res end |
#proxy ⇒ Object
40 41 42 43 44 |
# File 'lib/service_bus/requests.rb', line 40 def proxy #TODO Uncomment the following line of code and comment the next line of code BEFORE RELEASE # @http_web_proxy || Net::HTTP @http_web_proxy || Net::HTTP::Proxy('itgproxy.redmond.corp.microsoft.com', '80') end |
#put(url, data, options = {}) {|req, http| ... } ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/service_bus/requests.rb', line 83 def put(url , data, = {}) header = [:header] if [:header] url = URI.parse(url) url_path = (url.query && url.query != '') ? (url.path + '?' + url.query) : url.path http = proxy.new(url.host, url.port) yield(req, http) if block_given? http = http.start res = http.put(url_path, data, header) res end |