This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
function callback() { | |
$.widget('desk.contact', $.ui.autocomplete, require('contact')); | |
$('.salesforce input').contact({ | |
category: 'company', | |
username: 'username', | |
password: 'password', | |
clientId: 'SalesforceClientId', | |
clientSecret: 'SalesforceClientSecret', | |
mapping: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createCustomer($first_name, $last_name, $title, $background, $email) { | |
$subdomain = "your-site-subdomain" | |
$username = "[email protected]" | |
$password = "YoUrPaSsWoRd" | |
$body = @" | |
{ | |
"first_name": "$first_name", | |
"last_name": "$last_name", | |
"title": "$title", | |
"background": "$background", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "https://yoursitename.desk.com/api/v2/cases"; | |
var options = { | |
"method": "post", | |
"headers": { | |
"Authorization": "Basic " + Utilities.base64Encode("[email protected]:yourpassword") | |
}, | |
"payload": { | |
"type": "email", | |
"subject": "Email Case Subject", | |
"priority": 4, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |