View implementation.html
<script> | |
function callback() { | |
$.widget('desk.contact', $.ui.autocomplete, require('contact')); | |
$('.salesforce input').contact({ | |
category: 'company', | |
username: 'username', | |
password: 'password', | |
clientId: 'SalesforceClientId', | |
clientSecret: 'SalesforceClientSecret', | |
mapping: { |
View gist:4132052
public class SSEGeoService | |
{ | |
class GeoException extends Exception {} | |
@future (callout=true) | |
static public void setLocation(String sobj, String field, String id, String address) | |
{ | |
if (String.isBlank(address)) { | |
throw new SSEGeoService.GeoException('Address can not be blank.'); | |
} |
View SSO.java
import org.json.JSONObject; | |
import org.apache.commons.codec.binary.Base64; | |
import java.util.Arrays; | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.net.URLEncoder; | |
import java.security.MessageDigest; |
View DeskSample.java
public class DeskSample | |
{ | |
private static String OAUTH_KEY = 'youroauthkey'; | |
private static String OAUTH_SECRET = 'youroauthsecret'; | |
private static String ACCESS_TOKEN = 'youraccesstoken'; | |
private static String ACCESS_TOKEN_SECRET = 'youraccesstokensecret'; | |
public static String DESK_SITENAME = 'yoursite'; | |
public static Void doRequest() |
View oauth.php
<?php | |
$subdomain = 'your-sitename'; | |
$req_url = 'https://'.$subdomain.'.desk.com/oauth/request_token'; | |
$authurl = 'https://'.$subdomain.'.desk.com/oauth/authorize'; | |
$acc_url = 'https://'.$subdomain.'.desk.com/oauth/access_token'; | |
$api_url = 'https://'.$subdomain.'.desk.com/api/v2'; | |
// SET YOUR CALLBACK URL | |
$callback = 'http://localhost:3000/auth/desk/callback'; | |
View create_customer.ps1
function createCustomer($first_name, $last_name, $title, $background, $email) { | |
$subdomain = "your-site-subdomain" | |
$username = "your@username.com" | |
$password = "YoUrPaSsWoRd" | |
$body = @" | |
{ | |
"first_name": "$first_name", | |
"last_name": "$last_name", | |
"title": "$title", | |
"background": "$background", |
View api_content_type.rb
module Rack | |
class ApiContentType | |
def initialize(app, methods = [:post, :patch], path = /^\/api\/v2+/, content_type = 'application/json') | |
@app = app | |
@methods = (methods.is_a?(Array) ? methods : [methods]).map{ |item| item.to_s.upcase } | |
@path = path | |
@content_type = content_type | |
end | |
def call(env) |
View mongoid_encrypted.rb
class Mongoid::Fields::Standard | |
# Is the field encrypted or not? | |
# | |
# @example Is the field encrypted? | |
# field.encrypted? | |
# | |
# @return [ true, false ] If the field is encrypted. | |
# | |
# @since 4.0.0 | |
def encrypted? |
View google_apps_post_request.js
var url = "https://yoursitename.desk.com/api/v2/cases"; | |
var options = { | |
"method": "post", | |
"headers": { | |
"Authorization": "Basic " + Utilities.base64Encode("you@example.com:yourpassword") | |
}, | |
"payload": { | |
"type": "email", | |
"subject": "Email Case Subject", | |
"priority": 4, |
View multipass.py
from Crypto import Random | |
from Crypto.Cipher import AES | |
from datetime import datetime, timedelta | |
from isodate import datetime_isoformat | |
import base64 | |
import hashlib | |
import hmac | |
import urllib | |
import json |