Class: GistDoIt::NetHTTPAdapter
- Inherits:
-
Object
- Object
- GistDoIt::NetHTTPAdapter
- Defined in:
- lib/gistdoit/net_http_adapter.rb
Instance Method Summary collapse
Instance Method Details
#post_with_token(token, uri, data) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/gistdoit/net_http_adapter.rb', line 5 def post_with_token(token, uri, data) request = Net::HTTP::Post.new(uri.to_s) add_headers_to_request!(request, {"content-type" => "application/json", "Authorization" => "token #{token}"}) add_body_to_request!(request, data) Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http| @response = http.request(request).body end @response end |