Class: Http
- Inherits:
-
Object
- Object
- Http
- Defined in:
- lib/vmfloaty/http.rb
Class Method Summary collapse
Class Method Details
.get_conn(verbose, url) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/vmfloaty/http.rb', line 4 def self.get_conn(verbose, url) if url.nil? raise "Did not provide a url to connect to" end conn = Faraday.new(:url => url, :ssl => {:verify => false}) do |faraday| faraday.request :url_encoded faraday.response :logger if verbose faraday.adapter Faraday.default_adapter end return conn end |
.get_conn_with_auth(verbose, url, user, password) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vmfloaty/http.rb', line 18 def self.get_conn_with_auth(verbose, url, user, password) if url.nil? raise "Did not provide a url to connect to" end if user.nil? raise "You did not provide a user to authenticate with" end conn = Faraday.new(:url => url, :ssl => {:verify => false}) do |faraday| faraday.request :url_encoded faraday.request :basic_auth, user, password faraday.response :logger if verbose faraday.adapter Faraday.default_adapter end return conn end |