Class: Hoth::Transport::Https
- Defined in:
- lib/hoth/transport/https.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Http
#call_remote_with, #handle_response
Methods inherited from Base
Constructor Details
This class inherits a constructor from Hoth::Transport::Base
Instance Method Details
#post_payload(payload) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hoth/transport/https.rb', line 7 def post_payload(payload) uri = URI.parse(self.endpoint.to_url) post = Net::HTTP::Post.new(uri.path) post.set_form_data({ 'name' => self.name.to_s, 'params' => encoder.encode(payload) }, ';') request = Net::HTTP.new(uri.host, uri.port) request.use_ssl = true response = request.start {|http| http.request(post) } case response when Net::HTTPSuccess, Net::HTTPRedirection response else response.error! end end |