Skip to content

Instantly share code, notes, and snippets.

%body
.container
- flash.each do |key, value|
= content_tag(:div, value, :class => "flash #{key}")
= yield
= debug(params) if Rails.env.development?
api_data_authenticate_user looks like...
def api_data_authenticate_user(username, password)
# Authenticates a user account in Infusionsoft
Thread.current[:api_conn].api_perform('DataService', 'authenticateUser', username, password)
end
and [the relevant lines from] api_perform look like...
def api_perform(class_type, method, *args)
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_api_connection
def set_api_connection
ApiInfusionsoft.set_account_apiconn("nimacus.infusionsoft.com", "MY_API_KEY")
end
end
require "xmlrpc/client"
class InfusionsoftApiConnection
attr_accessor :api_url, :api_key, :retry_count
def initialize(url, key)
@api_url = url
@api_key = key
@retry_count = 1
end
@petedickson
petedickson / sessions_controller.rb
Created March 9, 2011 15:21
Authenticate users via Infusionsoft
class SessionsController < ApplicationController
include ApiInfusionsoft
def new
end
def numeric?(object)
true if Float(object) rescue false
end
@petedickson
petedickson / Rspec 'have_selector' failure
Created March 2, 2011 18:45
Rspec 'have_selector' test fails despite correctly rendered page
Failure/Error: response.should have_selector('title', :content => "About")
expected following output to contain a <title>About</title> tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
# ./spec/requests/layout_links_spec.rb:33:in `block (2 levels) in <top (required)>'