<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
connection = Faraday::Connection.new('http://example.com') do |builder| | |
builder.request :url_encoded # for POST/PUT params | |
builder.adapter :net_http | |
end | |
# same as above, short form: | |
connection = Faraday.new 'http://example.com' | |
# GET | |
connection.get '/posts' |
# I'm starting with a .pfx, so the first step is to get it to a .pem caintaining the cert and key | |
# This can be done using the following command | |
# | |
# openssl pkcs12 -in certs/mycert.pfx -out certs/mycert.pem -nodes | |
# | |
require 'faraday' | |
require 'openssl' | |
# create an x509 certificate |
# To enable SSL in Rails you could now simply use *force_ssl* in your | |
# ApplicationController but there is two more things to think about: | |
# In development our SSL webserver is running on port 3001 so we would | |
# actually need to use *force_ssl port: 3001* but then this wouldn't | |
# work for production. | |
# Also there is a good chance you might not always want to use SSL in development | |
# so it would be nice if we could just enable or disable SSL in the config. | |
# To make all this work first copy the file *ssl_with_configured_port.rb* to | |
# your *lib* directory. Second to enable SSL add *config.use_ssl = true* |
# As used with CanCan and Devise | |
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
include ErrorResponseActions | |
rescue_from CanCan::AccessDenied, :with => :authorization_error | |
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found | |
before_filter :authenticate! |