class Roar::Transport::Faraday
Advanced implementation of the HTTP verbs with the Faraday
HTTP library (which can, in turn, use adapters based on Net::HTTP or libcurl)
Depending on how the Faraday
middleware stack is configured, this Transport
can support features such as HTTP error code handling, redirects, etc.
@see rubydoc.info/gems/faraday/file/README.md Faraday
README
Public Instance Methods
delete_uri(options)
click to toggle source
# File lib/roar/transport/faraday.rb, line 32 def delete_uri(options) build_connection(options[:uri], options[:as]).delete end
get_uri(options)
click to toggle source
# File lib/roar/transport/faraday.rb, line 16 def get_uri(options) build_connection(options[:uri], options[:as]).get end
patch_uri(options)
click to toggle source
# File lib/roar/transport/faraday.rb, line 28 def patch_uri(options) build_connection(options[:uri], options[:as]).patch(nil, options[:body]) end
post_uri(options)
click to toggle source
# File lib/roar/transport/faraday.rb, line 20 def post_uri(options) build_connection(options[:uri], options[:as]).post(nil, options[:body]) end
put_uri(options)
click to toggle source
# File lib/roar/transport/faraday.rb, line 24 def put_uri(options) build_connection(options[:uri], options[:as]).put(nil, options[:body]) end
Private Instance Methods
build_connection(uri, as)
click to toggle source
# File lib/roar/transport/faraday.rb, line 38 def build_connection(uri, as) ::Faraday::Connection.new( :url => uri, :headers => { :accept => as, :content_type => as } ) do |builder| builder.use ::Faraday::Response::RaiseError builder.adapter ::Faraday.default_adapter end end