module SchoolLoop::Connection

Public Instance Methods

connection() click to toggle source
# File lib/school_loop/connection.rb, line 12
def connection
  @connection ||= Faraday.new({url: "#{secure ? 'https' : 'http'}://#{subdomain}.schoolloop.com"}.merge(connection_options)) do |faraday|
    faraday.request :basic_auth, username, password
    faraday.headers[:user_agent] = user_agent

    if debug
      faraday.response :logger
    end

    faraday.use SchoolLoop::Response::Xmlize,  :content_type => /\bxml$/
    faraday.use SchoolLoop::Response::RaiseError
    faraday.adapter adapter
  end
end