zendesk 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +25 -0
- data/VERSION +1 -0
- data/lib/zendesk.rb +22 -0
- data/lib/zendesk/comment.rb +29 -0
- data/lib/zendesk/lib/constants.rb +55 -0
- data/lib/zendesk/lib/properties.rb +100 -0
- data/lib/zendesk/lib/rest_object.rb +71 -0
- data/lib/zendesk/resource.rb +15 -0
- data/lib/zendesk/ticket.rb +90 -0
- data/lib/zendesk/user.rb +19 -0
- data/lib/zendesk/version.rb +3 -0
- data/spec/comment_spec.rb +16 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/ticket_spec.rb +29 -0
- data/zendesk.gemspec +60 -0
- metadata +114 -0
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.6.0"
|
11
|
+
# gem "rcov", ">= 0"
|
12
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Andrey Deryabin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= zendesk
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to zendesk
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Andrey Deryabin. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "zendesk"
|
18
|
+
gem.homepage = "http://github.com/aderyabin/zendesk"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Ruby wrapper around the Zendesk API}
|
21
|
+
gem.description = %Q{Ruby wrapper around the Zendesk API}
|
22
|
+
gem.email = "deriabin@gmail.com"
|
23
|
+
gem.authors = ["Andrey Deryabin"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/zendesk.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Zendesk
|
2
|
+
require 'rubygems'
|
3
|
+
require 'active_support'
|
4
|
+
require 'rest_client'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module Zendesk
|
8
|
+
|
9
|
+
CONFIG = YAML.load_file('zendesk.yml')
|
10
|
+
RESOURCE = RestClient::Resource.new CONFIG['host'], :user => CONFIG['user'], :password => CONFIG['password'], :timeout => 20, :open_timeout => 1
|
11
|
+
|
12
|
+
# TODO: Make load file as optional
|
13
|
+
|
14
|
+
autoload :Resource, File.dirname(__FILE__) + '/zendesk/resource.rb'
|
15
|
+
autoload :Comment, File.dirname(__FILE__) + '/zendesk/comment.rb'
|
16
|
+
autoload :Ticket, File.dirname(__FILE__) + '/zendesk/ticket.rb'
|
17
|
+
autoload :User, File.dirname(__FILE__) + '/zendesk/user.rb'
|
18
|
+
|
19
|
+
autoload :Constants, File.dirname(__FILE__) + '/zendesk/lib/constants.rb'
|
20
|
+
autoload :RestObject, File.dirname(__FILE__) + '/zendesk/lib/rest_object.rb'
|
21
|
+
autoload :Properties, File.dirname(__FILE__) + '/zendesk/lib/properties.rb'
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Zendesk::Comment < Zendesk::Resource
|
2
|
+
include Zendesk::Constants
|
3
|
+
|
4
|
+
properties :via
|
5
|
+
datetimes :created_at
|
6
|
+
attributes :value, :type, :is_public, :author_id, :attachments
|
7
|
+
protected_attributes :ticket_id
|
8
|
+
|
9
|
+
def initialize(attrs = {})
|
10
|
+
@ticket_id ||= attrs[:ticket_id] || attrs['ticket_id']
|
11
|
+
@is_public ||= false
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_xml
|
16
|
+
{ :value => value, :is_public => is_public }.to_xml(:skip_instruct => true, :root=>:comment)
|
17
|
+
end
|
18
|
+
|
19
|
+
def save
|
20
|
+
begin
|
21
|
+
response = RESOURCE["tickets/#{ticket_id}.xml"].put self.to_xml, :content_type => 'application/xml'
|
22
|
+
return (200..300).include?(response.headers[:status].to_i)
|
23
|
+
rescue Exception => e
|
24
|
+
puts e.message
|
25
|
+
return false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Zendesk::Constants
|
2
|
+
STATUS = {
|
3
|
+
0 => :new,
|
4
|
+
1 => :open,
|
5
|
+
2 => :pending,
|
6
|
+
3 => :solved,
|
7
|
+
4 => :closed
|
8
|
+
}
|
9
|
+
|
10
|
+
TICKET_TYPE = {
|
11
|
+
0 => :no_type_set,
|
12
|
+
1 => :question,
|
13
|
+
2 => :incident,
|
14
|
+
3 => :problem,
|
15
|
+
4 => :task
|
16
|
+
}
|
17
|
+
|
18
|
+
PRIORITY = {
|
19
|
+
0 => :no_priority_set,
|
20
|
+
1=>:low,
|
21
|
+
2 => :normal,
|
22
|
+
3 => :high,
|
23
|
+
4 => :urgent
|
24
|
+
}
|
25
|
+
|
26
|
+
VIA = {
|
27
|
+
0 => :web_form,
|
28
|
+
4 => :mail,
|
29
|
+
5 => :web_service,
|
30
|
+
16 => :get_satisfaction,
|
31
|
+
17 => :dropbox,
|
32
|
+
19 => :ticket_merge,
|
33
|
+
21 => :recovered_from_suspended_tickets,
|
34
|
+
23 => :twitter_favorite,
|
35
|
+
24 => :forum_topic,
|
36
|
+
26 => :twitter_direct_message,
|
37
|
+
27 => :closed_ticket,
|
38
|
+
29 => :chat,
|
39
|
+
30 => :twitter_public_mention
|
40
|
+
}
|
41
|
+
|
42
|
+
RESTRICTION = {
|
43
|
+
0 => :all_tickets,
|
44
|
+
1 => :group_tickets,
|
45
|
+
2 => :organization_tickers,
|
46
|
+
3 => :assigned_tickets,
|
47
|
+
4 => :user_tickets
|
48
|
+
}
|
49
|
+
|
50
|
+
ROLE = {
|
51
|
+
0 => :end_user,
|
52
|
+
2 => :administrator,
|
53
|
+
4 => :agent
|
54
|
+
}
|
55
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module Zendesk::Properties
|
2
|
+
module ClassMethods
|
3
|
+
|
4
|
+
mattr_accessor :_attributes, :_protected_attributes, :_properties, :_datetimes
|
5
|
+
|
6
|
+
@@_attributes = []
|
7
|
+
@@_protected_attributes = []
|
8
|
+
@@_properties = []
|
9
|
+
@@_datetimes = []
|
10
|
+
|
11
|
+
def attributes(*vars)
|
12
|
+
@@_attributes.concat vars
|
13
|
+
attr_accessor *vars
|
14
|
+
end
|
15
|
+
|
16
|
+
def protected_attributes(*vars)
|
17
|
+
@@_protected_attributes.concat vars
|
18
|
+
attr_reader *vars
|
19
|
+
end
|
20
|
+
|
21
|
+
def datetimes(*vars)
|
22
|
+
protected_attributes *vars
|
23
|
+
|
24
|
+
vars.each do |mn|
|
25
|
+
method_name = mn.to_s
|
26
|
+
class_eval <<-END
|
27
|
+
def #{method_name}
|
28
|
+
DateTime.parse @#{method_name}
|
29
|
+
end
|
30
|
+
END
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def properties(*vars)
|
35
|
+
@@_properties.concat vars
|
36
|
+
attr_accessor *vars
|
37
|
+
|
38
|
+
vars.each do |property|
|
39
|
+
attributes "#{property.to_s}_id".to_sym
|
40
|
+
method_name = property.to_s
|
41
|
+
class_eval <<-END
|
42
|
+
def #{method_name}
|
43
|
+
#{method_name.upcase}[@#{method_name}_id.to_i]
|
44
|
+
end
|
45
|
+
END
|
46
|
+
|
47
|
+
class_eval <<-END
|
48
|
+
def #{method_name}=(value)
|
49
|
+
@#{method_name}_id = #{method_name.upcase}.index(value)
|
50
|
+
end
|
51
|
+
END
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
module InstanceMethods
|
57
|
+
def attributes
|
58
|
+
self.class._attributes
|
59
|
+
end
|
60
|
+
|
61
|
+
def properties
|
62
|
+
self.class._properties
|
63
|
+
end
|
64
|
+
|
65
|
+
def protected_attributes
|
66
|
+
self.class._protected_attributes
|
67
|
+
end
|
68
|
+
|
69
|
+
def load_attributes(attrs = {})
|
70
|
+
attributes.each do |attr|
|
71
|
+
if val = (attrs[attr.to_s] || attrs[attr.to_sym])
|
72
|
+
instance_variable_set :"@#{attr.to_s}", val
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def load_protected_attributes(attrs = {})
|
78
|
+
protected_attributes.each do |attr|
|
79
|
+
if val = (attrs[attr.to_s] || attrs[attr.to_sym])
|
80
|
+
instance_variable_set :"@#{attr.to_s}", val
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
def load_properties(attrs = {})
|
87
|
+
properties.each do |mn|
|
88
|
+
method_name = mn.to_s
|
89
|
+
if val = (attrs[method_name] || attrs[method_name.to_sym])
|
90
|
+
send(:"#{method_name}=", val)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.included(receiver)
|
97
|
+
receiver.extend ClassMethods
|
98
|
+
receiver.send :include, InstanceMethods
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Zendesk::RestObject
|
2
|
+
module ClassMethods
|
3
|
+
def create(attrs = {})
|
4
|
+
instance = new(attrs)
|
5
|
+
instance.save
|
6
|
+
end
|
7
|
+
|
8
|
+
def find(id)
|
9
|
+
begin
|
10
|
+
new().load(id)
|
11
|
+
rescue Exception => e
|
12
|
+
puts e.message
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module InstanceMethods
|
19
|
+
def path
|
20
|
+
self.class.to_s.demodulize.downcase.pluralize
|
21
|
+
end
|
22
|
+
|
23
|
+
def save
|
24
|
+
begin
|
25
|
+
response = if self.id
|
26
|
+
Zendesk::RESOURCE["#{path}/#{id}.xml"].put self.to_xml, :content_type => 'application/xml'
|
27
|
+
else
|
28
|
+
Zendesk::RESOURCE["#{path}.xml"].post self.to_xml, :content_type => 'application/xml'
|
29
|
+
end
|
30
|
+
if (200..300).include?(response.headers[:status].to_i)
|
31
|
+
load(id || response.headers[:location].scan(/\d+/).first.to_i)
|
32
|
+
return true
|
33
|
+
else
|
34
|
+
return false
|
35
|
+
end
|
36
|
+
rescue Exception => e
|
37
|
+
puts e.message
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def reload
|
43
|
+
return false unless id
|
44
|
+
begin
|
45
|
+
load(id)
|
46
|
+
rescue Exception => e
|
47
|
+
puts e.message
|
48
|
+
nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def load(id)
|
53
|
+
begin
|
54
|
+
data = load_data(Zendesk::RESOURCE["#{path}/#{id}.xml"].get)[path.singularize]
|
55
|
+
load_attributes(data)
|
56
|
+
load_protected_attributes(data)
|
57
|
+
load_field_entries(data) if respond_to?(:load_field_entries)
|
58
|
+
load_comments(data) if respond_to?(:load_comments)
|
59
|
+
self
|
60
|
+
rescue Exception => e
|
61
|
+
puts e.message
|
62
|
+
nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.included(receiver)
|
68
|
+
receiver.extend ClassMethods
|
69
|
+
receiver.send :include, InstanceMethods
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Zendesk::Resource
|
2
|
+
include Zendesk::Properties
|
3
|
+
include Zendesk::Constants
|
4
|
+
|
5
|
+
# TODO: Make load file as optional
|
6
|
+
|
7
|
+
def initialize(attrs = {})
|
8
|
+
load_attributes(attrs)
|
9
|
+
load_properties(attrs)
|
10
|
+
end
|
11
|
+
|
12
|
+
def load_data(xml_stream)
|
13
|
+
Hash.from_xml(xml_stream)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
class Zendesk::Ticket < Zendesk::Resource
|
2
|
+
include Zendesk::Constants
|
3
|
+
include Zendesk::RestObject
|
4
|
+
|
5
|
+
datetimes :created_at, :updated_at
|
6
|
+
attributes :subject, :description, :status, :assignee_id, :requester_name, :requester_email
|
7
|
+
protected_attributes :nice_id, :priority_id, :status_id, :via_id, :ticket_type_id, :current_tags, :comments
|
8
|
+
properties :status, :ticket_type, :priority, :via
|
9
|
+
|
10
|
+
|
11
|
+
alias_attribute :id, :nice_id
|
12
|
+
alias_attribute :set_tags, :current_tags
|
13
|
+
|
14
|
+
def initialize(attrs = {})
|
15
|
+
@comments = []
|
16
|
+
load_fields
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_field_entries(data)
|
21
|
+
data['ticket_field_entries'].each do |field_entry|
|
22
|
+
method_name = @field_ids.index(field_entry['ticket_field_id'])
|
23
|
+
send("#{method_name}=", field_entry['value'])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def load_comments(data)
|
28
|
+
@comments = []
|
29
|
+
data['comments'].each do |comment|
|
30
|
+
@comments << Zendesk::Comment.new(comment)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def user
|
35
|
+
if assignee_id
|
36
|
+
@user ||= Zendesk::User.find(assignee_id)
|
37
|
+
else
|
38
|
+
@user = nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_comment(value, is_public = true)
|
43
|
+
if Zendesk::Comment.create(:ticket_id => self.id, :value => value, :is_public => is_public)
|
44
|
+
reload
|
45
|
+
else
|
46
|
+
false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_xml
|
51
|
+
result = {}
|
52
|
+
(attributes - @field_ids.keys).each do |obj|
|
53
|
+
if instance_variable_get(:"@#{obj.to_s}").present?
|
54
|
+
result[obj.to_s.downcase] = instance_variable_get(:"@#{obj.to_s}")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
result[:ticket_field_entries] = []
|
59
|
+
@field_ids.each_pair do |key, value|
|
60
|
+
if instance_variable_get(:"@#{key.to_s}").present?
|
61
|
+
result[:ticket_field_entries] << {:ticket_field_id => value, :value => instance_variable_get(:"@#{key.to_s}").to_s}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
result[:set_tags] = current_tags
|
66
|
+
result.to_xml(:skip_instruct => true, :root=>:ticket)
|
67
|
+
end
|
68
|
+
|
69
|
+
def tags
|
70
|
+
@current_tags.split()
|
71
|
+
end
|
72
|
+
|
73
|
+
def tags=(tags)
|
74
|
+
@current_tags = tags.to_a.join(' ')
|
75
|
+
end
|
76
|
+
|
77
|
+
def load_fields
|
78
|
+
attr_keys = Zendesk::CONFIG['ticket'] || {}
|
79
|
+
@field_ids = {}
|
80
|
+
field_names = attr_keys.keys
|
81
|
+
unless field_names.blank?
|
82
|
+
field_names = field_names.map(&:to_sym)
|
83
|
+
attr_keys.keys.each do |attr_name|
|
84
|
+
@field_ids[attr_name.to_sym] = attr_keys[attr_name]
|
85
|
+
end
|
86
|
+
field_names.each{ |field_name| self.class.attributes field_name.to_sym }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
data/lib/zendesk/user.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
class Zendesk::User < Zendesk::Resource
|
2
|
+
include Zendesk::RestObject
|
3
|
+
|
4
|
+
datetimes :created_at, :updated_at
|
5
|
+
properties :restriction
|
6
|
+
attributes :name, :is_active, :is_verified, :locale_id, :time_zone, :details, :last_login, :notes, :external_id, :phone, :uses_12_hour_clock
|
7
|
+
protected_attributes :id, :email, :photo_url
|
8
|
+
|
9
|
+
|
10
|
+
def initialize(attrs = {})
|
11
|
+
@email = attrs[:email] || attrs['email']
|
12
|
+
super
|
13
|
+
end
|
14
|
+
def to_xml
|
15
|
+
result = {}
|
16
|
+
attributes.each{|attr| result[attr] = instance_variable_get(:"@#{attr.to_s}") }
|
17
|
+
result.to_xml(:skip_instruct => true, :root=>:user)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/zendesk'
|
3
|
+
|
4
|
+
describe "Comment" do
|
5
|
+
it "should create class instance" do
|
6
|
+
Zendesk::Comment.new.class.should == Zendesk::Comment
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should parse attrubutes on initialize' do
|
10
|
+
comment = Zendesk::Comment.new(:ticket_id => 30, :value => 'ticket_comment', :is_public => true)
|
11
|
+
comment.ticket_id.should == 30
|
12
|
+
comment.value.should == 'ticket_comment'
|
13
|
+
comment.is_public.should == true
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/spec/ticket_spec.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/zendesk'
|
3
|
+
|
4
|
+
describe "Ticket" do
|
5
|
+
it "should create class instance" do
|
6
|
+
Zendesk::Ticket.new.class.should == Zendesk::Ticket
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should parse params on initialize' do
|
10
|
+
description = 'ticket description'
|
11
|
+
ticket = Zendesk::Ticket.new( :description => description )
|
12
|
+
ticket.description.should == description
|
13
|
+
ticket = Zendesk::Ticket.new( 'description' => description )
|
14
|
+
ticket.description.should == description
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should parse fields on initialize' do
|
18
|
+
city = 'New York'
|
19
|
+
ticket = Zendesk::Ticket.new( :city => city )
|
20
|
+
ticket.city.should == city
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should parse properties on initialize' do
|
24
|
+
ticket = Zendesk::Ticket.new( :ticket_type => :problem )
|
25
|
+
ticket.ticket_type.should == :problem
|
26
|
+
ticket.ticket_type_id.should == 3
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/zendesk.gemspec
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{zendesk}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = [%q{Andrey Deryabin}]
|
12
|
+
s.date = %q{2011-05-18}
|
13
|
+
s.description = %q{Ruby wrapper around the Zendesk API}
|
14
|
+
s.email = %q{deriabin@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"Gemfile",
|
21
|
+
"LICENSE.txt",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"lib/zendesk.rb",
|
26
|
+
"lib/zendesk/comment.rb",
|
27
|
+
"lib/zendesk/lib/constants.rb",
|
28
|
+
"lib/zendesk/lib/properties.rb",
|
29
|
+
"lib/zendesk/lib/rest_object.rb",
|
30
|
+
"lib/zendesk/resource.rb",
|
31
|
+
"lib/zendesk/ticket.rb",
|
32
|
+
"lib/zendesk/user.rb",
|
33
|
+
"lib/zendesk/version.rb",
|
34
|
+
"spec/comment_spec.rb",
|
35
|
+
"spec/spec_helper.rb",
|
36
|
+
"spec/ticket_spec.rb",
|
37
|
+
"zendesk.gemspec"
|
38
|
+
]
|
39
|
+
s.homepage = %q{http://github.com/aderyabin/zendesk}
|
40
|
+
s.licenses = [%q{MIT}]
|
41
|
+
s.require_paths = [%q{lib}]
|
42
|
+
s.rubygems_version = %q{1.8.2}
|
43
|
+
s.summary = %q{Ruby wrapper around the Zendesk API}
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
57
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zendesk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Andrey Deryabin
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-05-18 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
none: false
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 23
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 0
|
30
|
+
- 0
|
31
|
+
version: 1.0.0
|
32
|
+
version_requirements: *id001
|
33
|
+
type: :development
|
34
|
+
name: bundler
|
35
|
+
prerelease: false
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 15
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 6
|
46
|
+
- 0
|
47
|
+
version: 1.6.0
|
48
|
+
version_requirements: *id002
|
49
|
+
type: :development
|
50
|
+
name: jeweler
|
51
|
+
prerelease: false
|
52
|
+
description: Ruby wrapper around the Zendesk API
|
53
|
+
email: deriabin@gmail.com
|
54
|
+
executables: []
|
55
|
+
|
56
|
+
extensions: []
|
57
|
+
|
58
|
+
extra_rdoc_files:
|
59
|
+
- LICENSE.txt
|
60
|
+
- README.rdoc
|
61
|
+
files:
|
62
|
+
- Gemfile
|
63
|
+
- LICENSE.txt
|
64
|
+
- README.rdoc
|
65
|
+
- Rakefile
|
66
|
+
- VERSION
|
67
|
+
- lib/zendesk.rb
|
68
|
+
- lib/zendesk/comment.rb
|
69
|
+
- lib/zendesk/lib/constants.rb
|
70
|
+
- lib/zendesk/lib/properties.rb
|
71
|
+
- lib/zendesk/lib/rest_object.rb
|
72
|
+
- lib/zendesk/resource.rb
|
73
|
+
- lib/zendesk/ticket.rb
|
74
|
+
- lib/zendesk/user.rb
|
75
|
+
- lib/zendesk/version.rb
|
76
|
+
- spec/comment_spec.rb
|
77
|
+
- spec/spec_helper.rb
|
78
|
+
- spec/ticket_spec.rb
|
79
|
+
- zendesk.gemspec
|
80
|
+
homepage: http://github.com/aderyabin/zendesk
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
requirements: []
|
107
|
+
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 1.8.2
|
110
|
+
signing_key:
|
111
|
+
specification_version: 3
|
112
|
+
summary: Ruby wrapper around the Zendesk API
|
113
|
+
test_files: []
|
114
|
+
|