class Geminabox::TemplateFaradayAdapter
Public Instance Methods
adapter()
click to toggle source
# File lib/geminabox/http_adapter/template_faraday_adapter.rb, line 32 def adapter @adapter ||= Faraday.new do |faraday| faraday.adapter http_engine faraday.proxy(ENV['http_proxy']) if ENV['http_proxy'] end end
get(*args)
click to toggle source
# File lib/geminabox/http_adapter/template_faraday_adapter.rb, line 7 def get(*args) adapter.get(*args) end
get_content(*args)
click to toggle source
# File lib/geminabox/http_adapter/template_faraday_adapter.rb, line 11 def get_content(*args) response = adapter.get(*args) response.body end
http_engine()
click to toggle source
# File lib/geminabox/http_adapter/template_faraday_adapter.rb, line 39 def http_engine :net_http # make requests with Net::HTTP end
options()
click to toggle source
# File lib/geminabox/http_adapter/template_faraday_adapter.rb, line 43 def options lambda {|faraday| faraday.adapter http_engine faraday.proxy(ENV['http_proxy']) if ENV['http_proxy'] } end
post(*args)
click to toggle source
# File lib/geminabox/http_adapter/template_faraday_adapter.rb, line 16 def post(*args) adapter.post(*args) end
set_auth(uri, username = nil, password = nil)
click to toggle source
Note that this configuration turns SSL certificate verification off. To set up the adapter for your environment see: github.com/lostisland/faraday/wiki/Setting-up-SSL-certificates
# File lib/geminabox/http_adapter/template_faraday_adapter.rb, line 23 def set_auth(uri, username = nil, password = nil) connection = Faraday.new url: uri, ssl: {verify: false} do |faraday| faraday.adapter http_engine faraday.proxy(ENV['http_proxy']) if ENV['http_proxy'] end connection.basic_auth username, password if username connection end