This file contains 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
require 'nokogiri' | |
require 'rubygems' | |
require 'sequel' | |
#Connect to DB | |
DB = Sequel.connect(:adapter=>'mysql', :host=>'127.0.0.1', :database=>'zd_name', :user=>'root', :password=>'') | |
user_table = DB[:zd_users] | |
tickets_table = DB[:zd_tickets] | |
comments_table = DB[:zd_comments] |
This file contains 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
# http://sequel.rubyforge.org/rdoc/files/doc/cheat_sheet_rdoc.html | |
require 'rubygems' | |
require 'json' | |
require 'sequel' | |
require 'oauth' | |
require 'yajl' | |
require 'yaml' | |
SITE_URL = "https://XXXX.desk.com" | |
API_CONSUMER_KEY = "" |
This file contains 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
1. Create Table to Import Users | |
CREATE TABLE `zd_users` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`zd_id` int(11) DEFAULT NULL, | |
`desk_id` int(11) DEFAULT NULL, | |
`name` varchar(255) DEFAULT NULL, | |
`email` varchar(255) DEFAULT NULL, | |
`role` varchar(255) DEFAULT NULL, | |
`phone` varchar(255) DEFAULT NULL, |
This file contains 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
url = "/api/v2/customers" | |
begin | |
response = JSON.parse desk_client.get url | |
response['_embedded']['entries'].each do |customer| | |
desk_client.patch customer['_links']['self']['href'], { | |
custom_fields: { | |
some_field: 'Some Value' | |
} | |
} |
This file contains 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
url = "/api/v2/customers" | |
begin | |
response = JSON.parse desk_client.get url | |
response['_embedded']['entries'].each do |customer| | |
desk_client.patch customer['_links']['self']['href'], { | |
custom_fields: { | |
some_field: 'Some Value' | |
} | |
} |
This file contains 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 UserData | |
Public uid As String | |
Public expires As String = DateTime.Now.AddDays(1).ToString("s", | |
System.Globalization.CultureInfo.InvariantCulture) | |
Public customer_email As String | |
Public customer_name As String | |
End Class | |
Public Class MultiPass | |
Public status As Boolean = False |
This file contains 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() { | |
(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|j |
This file contains 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
package com.meetup.util.desk; | |
import org.joda.time.DateTime; | |
import org.joda.time.format.ISODateTimeFormat; | |
import com.google.common.collect.ImmutableMap; | |
import com.google.common.collect.ImmutableSet; | |
import com.meetup.util.MeetupLogger; | |
import com.meetup.base.util.U; |
This file contains 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
// run as soon as we have input in the subject field | |
$(‘#subject_input’).on(‘keyup’, function() { | |
// get the subject | |
var term = $(this).val(); | |
// run the request – make sure to url encode the subject | |
$.getJSON(‘https://site.desk.com/customer/portal/articles/autocomplete?term=’ + encodeURIComponent(term), function(response) { | |
// empty the previous list | |
$(‘#thelist’).empty(); | |
// for each article returned from the request | |
$.each(response, function(index, article) { |
This file contains 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 type="text/javascript"> | |
$(function(){ | |
$("#rate_article div:nth-child(1) a").click(function(){ | |
$("#rate_article").css("visibility", "hidden"); | |
window.setTimeout(showHello, 1000); | |
}).next().text("Thumbs Up text"); | |
$("#rate_article div:nth-child(2) a").click(function(){ | |
$("#rate_article").css("visibility", "hidden"); | |
window.setTimeout(showHello, 1000); |
OlderNewer