zendesk_api 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/Readme.md +1 -0
- data/lib/zendesk_api/associations.rb +3 -3
- data/lib/zendesk_api/resources.rb +7 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/live/ticket_spec.rb +6 -4
- data/spec/live/user_spec.rb +38 -0
- data/spec/macros/resource_macros.rb +1 -1
- metadata +187 -185
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
zendesk_api (0.3.
|
10
|
+
zendesk_api (0.3.4)
|
11
11
|
faraday (>= 0.8.0)
|
12
12
|
faraday_middleware (>= 0.8.7)
|
13
13
|
hashie (~> 2.0.0)
|
@@ -55,7 +55,7 @@ GEM
|
|
55
55
|
fssm (0.2.10)
|
56
56
|
haml (4.0.1)
|
57
57
|
tilt
|
58
|
-
hashie (2.0.
|
58
|
+
hashie (2.0.3)
|
59
59
|
i18n (0.6.1)
|
60
60
|
inflection (1.0.0)
|
61
61
|
jruby-openssl (0.8.7)
|
data/Readme.md
CHANGED
@@ -12,6 +12,7 @@ Additional documentation can be found on our [documentation site](https://zendes
|
|
12
12
|
|
13
13
|
* Version 0.0.5 brings with it a change to the top-level namespace. All references to Zendesk should now use ZendeskAPI.
|
14
14
|
* Version 0.3.0 changed the license from MIT to Apache Version 2.
|
15
|
+
* Version 0.3.2 introduced a regression when side-loading roles on users. This was fixed in 0.3.4.
|
15
16
|
|
16
17
|
## Installation
|
17
18
|
|
@@ -13,7 +13,7 @@ module ZendeskAPI
|
|
13
13
|
base.extend ClassMethods
|
14
14
|
end
|
15
15
|
|
16
|
-
def wrap_resource(resource, class_level_association)
|
16
|
+
def wrap_resource(resource, class_level_association, options = {})
|
17
17
|
instance_association = Association.new(class_level_association.merge(:parent => self))
|
18
18
|
klass = class_level_association[:class]
|
19
19
|
|
@@ -21,7 +21,7 @@ module ZendeskAPI
|
|
21
21
|
when Hash
|
22
22
|
klass.new(@client, resource.merge(:association => instance_association))
|
23
23
|
when String, Fixnum
|
24
|
-
klass.new(@client, :id => resource, :association => instance_association)
|
24
|
+
klass.new(@client, (options[:include_key] || :id) => resource, :association => instance_association)
|
25
25
|
else
|
26
26
|
resource.association = instance_association
|
27
27
|
resource
|
@@ -110,7 +110,7 @@ module ZendeskAPI
|
|
110
110
|
resource = if klass.respond_to?(:find) && resource_id = method_missing(association[:id_column])
|
111
111
|
klass.find(@client, :id => resource_id, :association => instance_association)
|
112
112
|
elsif found = method_missing(association[:name].to_sym)
|
113
|
-
wrap_resource(found, association)
|
113
|
+
wrap_resource(found, association, :include_key => association[:include_key])
|
114
114
|
elsif klass.superclass == DataResource && !association[:inline]
|
115
115
|
rescue_client_error do
|
116
116
|
response = @client.connection.get(instance_association.generate_path(:with_parent => true))
|
@@ -331,6 +331,13 @@ module ZendeskAPI
|
|
331
331
|
put :request_verification
|
332
332
|
end
|
333
333
|
|
334
|
+
def initialize(*)
|
335
|
+
super
|
336
|
+
|
337
|
+
# Needed for proper Role sideloading
|
338
|
+
self.role_id = role.name if key?(:role)
|
339
|
+
end
|
340
|
+
|
334
341
|
has Organization
|
335
342
|
|
336
343
|
has CustomRole, :inline => true, :include => :roles
|
data/lib/zendesk_api/version.rb
CHANGED
data/spec/live/ticket_spec.rb
CHANGED
@@ -34,14 +34,16 @@ describe ZendeskAPI::Ticket do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe ".incremental_export" do
|
37
|
-
let(:results){ ZendeskAPI::Ticket.incremental_export(client, Time.at(1023059503)) } # ~ 10 years ago
|
37
|
+
let(:results) { ZendeskAPI::Ticket.incremental_export(client, Time.at(1023059503)) } # ~ 10 years ago
|
38
38
|
|
39
39
|
around do |example|
|
40
40
|
# 1 request every 5 minutes allowed <-> you can only test 1 call ...
|
41
41
|
VCR.use_cassette("incremental_export") do
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
client.config.retry = false
|
43
|
+
|
44
|
+
example.call
|
45
|
+
|
46
|
+
client.config.retry = true
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
data/spec/live/user_spec.rb
CHANGED
@@ -16,4 +16,42 @@ describe ZendeskAPI::User, :delete_after do
|
|
16
16
|
client.users.search(:query => current_user.email).to_a.should == [current_user]
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
context "side-loading" do
|
21
|
+
context "no permission set" do
|
22
|
+
subject do
|
23
|
+
VCR.use_cassette("user_admin_role") { client.users.find(:id => 20014182, :include => :roles) }
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should include role" do
|
27
|
+
if subject
|
28
|
+
subject.role.should_not be_nil
|
29
|
+
subject.role.id.should be_nil
|
30
|
+
subject.role.name.should == "admin"
|
31
|
+
subject.role.configuration.should_not be_nil
|
32
|
+
|
33
|
+
subject.custom_role.should be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "permission set" do
|
39
|
+
subject do
|
40
|
+
VCR.use_cassette("user_permission_set") { client.users.find(:id => 20014327, :include => :roles) }
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should include role" do
|
44
|
+
if subject
|
45
|
+
subject.role.should_not be_nil
|
46
|
+
subject.role.id.should be_nil
|
47
|
+
subject.role.name.should == "agent"
|
48
|
+
|
49
|
+
subject.custom_role.should_not be_nil
|
50
|
+
subject.custom_role.id.should == 3692
|
51
|
+
subject.custom_role.name.should == "Staff"
|
52
|
+
subject.custom_role.configuration.should_not be_nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
19
57
|
end
|
metadata
CHANGED
@@ -1,233 +1,223 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_api
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Steven Davidovitz
|
9
14
|
- Michael Grosser
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
|
19
|
+
date: 2013-04-04 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
16
22
|
name: bump
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ! '>='
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '0'
|
23
|
-
type: :development
|
24
23
|
prerelease: false
|
25
|
-
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ! '>='
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '0'
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: rake
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
34
25
|
none: false
|
35
|
-
requirements:
|
36
|
-
- -
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
39
33
|
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rake
|
40
37
|
prerelease: false
|
41
|
-
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ! '>='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: rspec
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
55
47
|
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
56
51
|
prerelease: false
|
57
|
-
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ! '>='
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: vcr
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
66
53
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
71
61
|
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: vcr
|
72
65
|
prerelease: false
|
73
|
-
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
67
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
none: false
|
83
|
-
requirements:
|
84
|
-
- - ~>
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 1.9.0
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
87
75
|
type: :development
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: webmock
|
88
79
|
prerelease: false
|
89
|
-
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
90
81
|
none: false
|
91
|
-
requirements:
|
82
|
+
requirements:
|
92
83
|
- - ~>
|
93
|
-
- !ruby/object:Gem::Version
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 51
|
86
|
+
segments:
|
87
|
+
- 1
|
88
|
+
- 9
|
89
|
+
- 0
|
94
90
|
version: 1.9.0
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: yard
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
|
-
requirements:
|
100
|
-
- - ! '>='
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
91
|
type: :development
|
92
|
+
version_requirements: *id005
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: yard
|
104
95
|
prerelease: false
|
105
|
-
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
106
97
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
type: :development
|
106
|
+
version_requirements: *id006
|
107
|
+
- !ruby/object:Gem::Dependency
|
112
108
|
name: faraday
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
|
-
requirements:
|
116
|
-
- - ! '>='
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: 0.8.0
|
119
|
-
type: :runtime
|
120
109
|
prerelease: false
|
121
|
-
|
110
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
122
111
|
none: false
|
123
|
-
requirements:
|
124
|
-
- -
|
125
|
-
- !ruby/object:Gem::Version
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 63
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
- 8
|
119
|
+
- 0
|
126
120
|
version: 0.8.0
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: faraday_middleware
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
|
-
requirements:
|
132
|
-
- - ! '>='
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: 0.8.7
|
135
121
|
type: :runtime
|
122
|
+
version_requirements: *id007
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: faraday_middleware
|
136
125
|
prerelease: false
|
137
|
-
|
126
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
138
127
|
none: false
|
139
|
-
requirements:
|
140
|
-
- -
|
141
|
-
- !ruby/object:Gem::Version
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 49
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
- 8
|
135
|
+
- 7
|
142
136
|
version: 0.8.7
|
143
|
-
- !ruby/object:Gem::Dependency
|
144
|
-
name: hashie
|
145
|
-
requirement: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
|
-
requirements:
|
148
|
-
- - ~>
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
version: 2.0.0
|
151
137
|
type: :runtime
|
138
|
+
version_requirements: *id008
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: hashie
|
152
141
|
prerelease: false
|
153
|
-
|
142
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
154
143
|
none: false
|
155
|
-
requirements:
|
144
|
+
requirements:
|
156
145
|
- - ~>
|
157
|
-
- !ruby/object:Gem::Version
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
hash: 15
|
148
|
+
segments:
|
149
|
+
- 2
|
150
|
+
- 0
|
151
|
+
- 0
|
158
152
|
version: 2.0.0
|
159
|
-
- !ruby/object:Gem::Dependency
|
160
|
-
name: inflection
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
162
|
-
none: false
|
163
|
-
requirements:
|
164
|
-
- - ! '>='
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
153
|
type: :runtime
|
154
|
+
version_requirements: *id009
|
155
|
+
- !ruby/object:Gem::Dependency
|
156
|
+
name: inflection
|
168
157
|
prerelease: false
|
169
|
-
|
170
|
-
none: false
|
171
|
-
requirements:
|
172
|
-
- - ! '>='
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '0'
|
175
|
-
- !ruby/object:Gem::Dependency
|
176
|
-
name: json
|
177
|
-
requirement: !ruby/object:Gem::Requirement
|
158
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
178
159
|
none: false
|
179
|
-
requirements:
|
180
|
-
- -
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
hash: 3
|
164
|
+
segments:
|
165
|
+
- 0
|
166
|
+
version: "0"
|
183
167
|
type: :runtime
|
168
|
+
version_requirements: *id010
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: json
|
184
171
|
prerelease: false
|
185
|
-
|
186
|
-
none: false
|
187
|
-
requirements:
|
188
|
-
- - ! '>='
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
version: '0'
|
191
|
-
- !ruby/object:Gem::Dependency
|
192
|
-
name: mime-types
|
193
|
-
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
194
173
|
none: false
|
195
|
-
requirements:
|
196
|
-
- -
|
197
|
-
- !ruby/object:Gem::Version
|
198
|
-
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
hash: 3
|
178
|
+
segments:
|
179
|
+
- 0
|
180
|
+
version: "0"
|
199
181
|
type: :runtime
|
182
|
+
version_requirements: *id011
|
183
|
+
- !ruby/object:Gem::Dependency
|
184
|
+
name: mime-types
|
200
185
|
prerelease: false
|
201
|
-
|
202
|
-
none: false
|
203
|
-
requirements:
|
204
|
-
- - ! '>='
|
205
|
-
- !ruby/object:Gem::Version
|
206
|
-
version: '0'
|
207
|
-
- !ruby/object:Gem::Dependency
|
208
|
-
name: multipart-post
|
209
|
-
requirement: !ruby/object:Gem::Requirement
|
186
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
210
187
|
none: false
|
211
|
-
requirements:
|
212
|
-
- -
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
hash: 3
|
192
|
+
segments:
|
193
|
+
- 0
|
194
|
+
version: "0"
|
215
195
|
type: :runtime
|
196
|
+
version_requirements: *id012
|
197
|
+
- !ruby/object:Gem::Dependency
|
198
|
+
name: multipart-post
|
216
199
|
prerelease: false
|
217
|
-
|
200
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
218
201
|
none: false
|
219
|
-
requirements:
|
220
|
-
- -
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
hash: 3
|
206
|
+
segments:
|
207
|
+
- 0
|
208
|
+
version: "0"
|
209
|
+
type: :runtime
|
210
|
+
version_requirements: *id013
|
211
|
+
description: Ruby wrapper for the REST API at http://www.zendesk.com. Documentation at http://developer.zendesk.com.
|
212
|
+
email:
|
226
213
|
- support@zendesk.com
|
227
214
|
executables: []
|
215
|
+
|
228
216
|
extensions: []
|
217
|
+
|
229
218
|
extra_rdoc_files: []
|
230
|
-
|
219
|
+
|
220
|
+
files:
|
231
221
|
- .gitignore
|
232
222
|
- .rspec
|
233
223
|
- .travis.yml
|
@@ -507,31 +497,43 @@ files:
|
|
507
497
|
- util/verb_handler.rb
|
508
498
|
- zendesk_api.gemspec
|
509
499
|
homepage: http://developer.zendesk.com
|
510
|
-
licenses:
|
500
|
+
licenses:
|
511
501
|
- Apache License Version 2.0
|
512
502
|
post_install_message:
|
513
503
|
rdoc_options: []
|
514
|
-
|
504
|
+
|
505
|
+
require_paths:
|
515
506
|
- lib
|
516
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
507
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
517
508
|
none: false
|
518
|
-
requirements:
|
519
|
-
- -
|
520
|
-
- !ruby/object:Gem::Version
|
509
|
+
requirements:
|
510
|
+
- - ">="
|
511
|
+
- !ruby/object:Gem::Version
|
512
|
+
hash: 57
|
513
|
+
segments:
|
514
|
+
- 1
|
515
|
+
- 8
|
516
|
+
- 7
|
521
517
|
version: 1.8.7
|
522
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
518
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
523
519
|
none: false
|
524
|
-
requirements:
|
525
|
-
- -
|
526
|
-
- !ruby/object:Gem::Version
|
520
|
+
requirements:
|
521
|
+
- - ">="
|
522
|
+
- !ruby/object:Gem::Version
|
523
|
+
hash: 23
|
524
|
+
segments:
|
525
|
+
- 1
|
526
|
+
- 3
|
527
|
+
- 6
|
527
528
|
version: 1.3.6
|
528
529
|
requirements: []
|
530
|
+
|
529
531
|
rubyforge_project:
|
530
|
-
rubygems_version: 1.8.
|
532
|
+
rubygems_version: 1.8.21
|
531
533
|
signing_key:
|
532
534
|
specification_version: 3
|
533
535
|
summary: Zendesk REST API Client
|
534
|
-
test_files:
|
536
|
+
test_files:
|
535
537
|
- spec/core/association_spec.rb
|
536
538
|
- spec/core/client_spec.rb
|
537
539
|
- spec/core/collection_spec.rb
|