Skip to content

Instantly share code, notes, and snippets.

View zackchandler's full-sized avatar

Zack Chandler zackchandler

  • Urbandoor
  • San Francisco Bay Area
View GitHub Profile
require 'garb'
username = 'foo'
password = 'bar'
Garb::Session.login(username, password)
profile = Garb::Profile.all.select{ |p| p.title == 'foobar' }.first
options = {
:metrics => [ :visits ],
:dimensions => [ :date ]
}
report = Garb::Report.new(profile, options)
<?php
// Loosely based on the Jason Levitt PHP Proxy example for Yahoo! Web services.
define ('HOSTNAME', 'https://myapp.servicesidekick.com/');
$path = ($_POST['api_path']) ? $_POST['api_path'] : $_GET['api_path'];
// Build url and add any parameters
$url = HOSTNAME.$path.'?';
<?xml version="1.0"?>
<InvoiceRet>
<TxnID>87</TxnID>
<TimeCreated>2009-08-07T09:25:27</TimeCreated>
<TimeModified>2009-08-07T09:28:19</TimeModified>
<EditSequence>1</EditSequence>
<TxnNumber>87</TxnNumber>
<CustomerRef>
<ListID>27</ListID>
<FullName>Benny Jenkins</FullName>
<?xml version="1.0"?>
<!DOCTYPE QBXML PUBLIC "-//INTUIT//DTD QBXML QBO 6.0//EN" "http://webapps.quickbooks.com/dtds/qbxmlops60.dtd">
<QBXML>
<SignonMsgsRq>
<SignonTicketRq>
<ClientDateTime>2009-07-31</ClientDateTime>
<SessionTicket>abc123:123456789</SessionTicket>
<Language>English</Language>
<AppID>108096790</AppID>
<AppVer>1</AppVer>
var proxy = 'http://localhost/foobar/proxy.php';
$('form#new_customer').submit(function(){
data = '<customer>';
data += '<name>' + $('#customer_name').val() +'</name>';
data += '</customer>';
$.ajax({
url: proxy + '?api_path=customers.xml',
contentType: 'application/xml',
type: 'POST',
<QBWCXML>
<AppName>My app</AppName>
<AppID></AppID>
<AppURL>http://localhost:3000/api</AppURL>
<AppDescription></AppDescription>
<AppSupport>http://localhost:3000/api</AppSupport>
<UserName>foobar</UserName>
<OwnerID>{12F9B9B2-88F1-4fcc-B1EE-566DE1812D20}</OwnerID>
<FileID>{67F6B9B3-36F1-4fcc-B1EE-566DE1815D20}</FileID>
<QBType>QBFS</QBType>
class QbwcController < ApplicationController
session :off
def api
# respond successfully to a GET which some versions of the Web Connector send to verify the url
if request.get?
render :nothing => true
return
end
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<authenticateResponse xmlns="http://developer.intuit.com/">
<authenticateResult>
<string><%= @token.fast_xs %></string>
<string><%= @message.fast_xs %></string>
<string><%= @seconds_until_next_update %></string>
<string><%= @seconds_between_runs %></string>
</authenticateResult>
# works
require 'rest_client'
# broken
dependency 'rest-client'
# broken
dependency 'rest_client'
# broken
<VirtualHost *:80>
ServerName www.myproject.com
DocumentRoot /var/www/apps/myproject/current
</VirtualHost>