Fog::Core::Connection
# File lib/fog/brightbox/storage/connection.rb, line 60 def authenticated_headers default_headers.merge({ "X-Auth-Token" => @config.latest_access_token }) end
# File lib/fog/brightbox/storage/connection.rb, line 77 def connection_options @config.storage_connection_options end
# File lib/fog/brightbox/storage/connection.rb, line 66 def default_headers { "Content-Type" => "application/json", "Accept" => "application/json" } end
# File lib/fog/brightbox/storage/connection.rb, line 40 def management_url @config.storage_management_url end
# File lib/fog/brightbox/storage/connection.rb, line 44 def path_in_params(params) if params.respond_to?(:key?) && params.key?(:path) URI.join(@config.storage_management_url.to_s + "/", params[:path]).path else @config.storage_management_url.path end end
# File lib/fog/brightbox/storage/connection.rb, line 73 def persistent? @config.connection_persistent? end
# File lib/fog/brightbox/storage/connection.rb, line 18 def request(params, parse_json = true) begin raise ArgumentError if params.nil? request_params = params.merge({ :headers => request_headers(params), :path => path_in_params(params) }) response = @connection.request(request_params) rescue Excon::Errors::Unauthorized => error raise AuthenticationRequired.slurp(error) rescue Excon::Errors::NotFound => error raise Fog::Storage::Brightbox::NotFound.slurp(error) rescue Excon::Errors::HTTPStatusError => error raise error end if !response.body.empty? && parse_json && response.get_header("Content-Type") =~ %{application/json} response.body = Fog::JSON.decode(response.body) end response end
Generated with the Darkfish Rdoc Generator 2.