zendesk_api 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/.gitignore +7 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +5 -0
  4. data/.yardopts +1 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +59 -0
  7. data/LICENSE +19 -0
  8. data/Rakefile +49 -0
  9. data/Readme.md +178 -0
  10. data/lib/zendesk_api.rb +10 -0
  11. data/lib/zendesk_api/actions.rb +176 -0
  12. data/lib/zendesk_api/association.rb +267 -0
  13. data/lib/zendesk_api/client.rb +150 -0
  14. data/lib/zendesk_api/collection.rb +233 -0
  15. data/lib/zendesk_api/configuration.rb +52 -0
  16. data/lib/zendesk_api/core_ext/inflection.rb +13 -0
  17. data/lib/zendesk_api/core_ext/modulize.rb +10 -0
  18. data/lib/zendesk_api/core_ext/snakecase.rb +12 -0
  19. data/lib/zendesk_api/lru_cache.rb +38 -0
  20. data/lib/zendesk_api/middleware/request/etag_cache.rb +38 -0
  21. data/lib/zendesk_api/middleware/request/retry.rb +39 -0
  22. data/lib/zendesk_api/middleware/request/upload.rb +32 -0
  23. data/lib/zendesk_api/middleware/response/callback.rb +19 -0
  24. data/lib/zendesk_api/middleware/response/deflate.rb +18 -0
  25. data/lib/zendesk_api/middleware/response/gzip.rb +18 -0
  26. data/lib/zendesk_api/middleware/response/parse_iso_dates.rb +29 -0
  27. data/lib/zendesk_api/rescue.rb +44 -0
  28. data/lib/zendesk_api/resource.rb +133 -0
  29. data/lib/zendesk_api/resources/forum.rb +51 -0
  30. data/lib/zendesk_api/resources/misc.rb +66 -0
  31. data/lib/zendesk_api/resources/playlist.rb +64 -0
  32. data/lib/zendesk_api/resources/ticket.rb +76 -0
  33. data/lib/zendesk_api/resources/user.rb +44 -0
  34. data/lib/zendesk_api/track_changes.rb +72 -0
  35. data/lib/zendesk_api/trackie.rb +8 -0
  36. data/lib/zendesk_api/verbs.rb +43 -0
  37. data/lib/zendesk_api/version.rb +3 -0
  38. data/live/Readme.md +4 -0
  39. data/live/activity_spec.rb +5 -0
  40. data/live/audit_spec.rb +5 -0
  41. data/live/bookmark_spec.rb +11 -0
  42. data/live/category_spec.rb +12 -0
  43. data/live/collection_spec.rb +68 -0
  44. data/live/crm_spec.rb +11 -0
  45. data/live/custom_role_spec.rb +5 -0
  46. data/live/forum_spec.rb +14 -0
  47. data/live/forum_subscription_spec.rb +12 -0
  48. data/live/group_membership_spec.rb +18 -0
  49. data/live/group_spec.rb +14 -0
  50. data/live/identity_spec.rb +14 -0
  51. data/live/locale_spec.rb +11 -0
  52. data/live/macro_spec.rb +5 -0
  53. data/live/mobile_device_spec.rb +11 -0
  54. data/live/organization_spec.rb +12 -0
  55. data/live/satisfaction_rating_spec.rb +6 -0
  56. data/live/setting_spec.rb +5 -0
  57. data/live/suspended_ticket_spec.rb +8 -0
  58. data/live/ticket_field_spec.rb +12 -0
  59. data/live/ticket_metrics_spec.rb +6 -0
  60. data/live/ticket_spec.rb +88 -0
  61. data/live/topic_comment_spec.rb +13 -0
  62. data/live/topic_spec.rb +18 -0
  63. data/live/topic_subscription_spec.rb +12 -0
  64. data/live/topic_vote_spec.rb +13 -0
  65. data/live/upload_spec.rb +9 -0
  66. data/live/user_spec.rb +13 -0
  67. data/live/view_spec.rb +6 -0
  68. data/spec/association_spec.rb +210 -0
  69. data/spec/client_spec.rb +149 -0
  70. data/spec/collection_spec.rb +302 -0
  71. data/spec/configuration_spec.rb +24 -0
  72. data/spec/create_resource_spec.rb +39 -0
  73. data/spec/data_resource_spec.rb +229 -0
  74. data/spec/fixtures/Argentina.gif +0 -0
  75. data/spec/fixtures/Argentina2.gif +0 -0
  76. data/spec/fixtures/credentials.yml.example +3 -0
  77. data/spec/fixtures/test_resources.rb +8 -0
  78. data/spec/fixtures/zendesk.rb +88 -0
  79. data/spec/lru_cache_spec.rb +26 -0
  80. data/spec/macros/resource_macros.rb +157 -0
  81. data/spec/middleware/request/etag_cache_spec.rb +17 -0
  82. data/spec/middleware/request/retry_spec.rb +47 -0
  83. data/spec/middleware/request/test.jpg +0 -0
  84. data/spec/middleware/request/upload_spec.rb +74 -0
  85. data/spec/middleware/response/callback_spec.rb +17 -0
  86. data/spec/middleware/response/deflate_spec.rb +15 -0
  87. data/spec/middleware/response/gzip_spec.rb +19 -0
  88. data/spec/middleware/response/parse_iso_dates_spec.rb +44 -0
  89. data/spec/playlist_spec.rb +95 -0
  90. data/spec/read_resource_spec.rb +37 -0
  91. data/spec/rescue_spec.rb +94 -0
  92. data/spec/resource_spec.rb +332 -0
  93. data/spec/spec_helper.rb +120 -0
  94. data/spec/string_spec.rb +7 -0
  95. data/spec/trackie_spec.rb +39 -0
  96. data/zendesk_api.gemspec +38 -0
  97. metadata +364 -0
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe String do
4
+ specify "the plural of forum if forums" do
5
+ "forum".plural.should == "forums"
6
+ end
7
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe ZendeskAPI::Trackie do
4
+ subject { ZendeskAPI::Trackie.new }
5
+ before(:each) { subject.clear_changes }
6
+
7
+ it "should not be changed" do
8
+ subject.changed?.should be_false
9
+ end
10
+
11
+ context "adding keys" do
12
+ before(:each) { subject[:key] = true }
13
+
14
+ it "should include key in changes" do
15
+ subject.changes[:key].should be_true
16
+ end
17
+
18
+ specify "key should be changed" do
19
+ subject.changed?(:key).should be_true
20
+ subject.changed?.should be_true
21
+ end
22
+ end
23
+
24
+ context "nested hashes" do
25
+ before(:each) do
26
+ subject[:key] = ZendeskAPI::Trackie.new
27
+ subject.clear_changes
28
+ subject[:key][:test] = true
29
+ end
30
+
31
+ it "should include changes from nested hash" do
32
+ subject.changes[:key][:test].should be_true
33
+ end
34
+
35
+ specify "subject should be changed" do
36
+ subject.changed?.should be_true
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'zendesk_api/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "zendesk_api"
9
+ s.version = ZendeskAPI::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ["Steven Davidovitz"]
12
+ s.email = ["sdavidovitz@zendesk.com"]
13
+ s.homepage = "http://developer.zendesk.com"
14
+ s.summary = %q{Zendesk REST API Client}
15
+ s.description = %q{Ruby wrapper for the REST API at http://www.zendesk.com. Documentation at http://developer.zendesk.com.}
16
+ s.license = 'MIT'
17
+
18
+ s.required_ruby_version = ">= 1.8.7"
19
+ s.required_rubygems_version = ">= 1.3.6"
20
+
21
+ s.add_development_dependency "rspec", ">= 2.0.0"
22
+ s.add_development_dependency "vcr"
23
+ s.add_development_dependency "webmock"
24
+ s.add_development_dependency "rake"
25
+ s.add_development_dependency "yard"
26
+
27
+ s.add_runtime_dependency "faraday", ">= 0.8.0"
28
+ s.add_runtime_dependency "faraday_middleware", ">= 0.8.7"
29
+ s.add_runtime_dependency "hashie"
30
+ s.add_runtime_dependency "json"
31
+ s.add_runtime_dependency "inflection"
32
+ s.add_runtime_dependency "mime-types"
33
+ s.add_runtime_dependency "multipart-post"
34
+
35
+ s.files = `git ls-files -x Gemfile.lock`.split("\n") rescue ''
36
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
37
+ s.require_paths = ["lib"]
38
+ end
metadata ADDED
@@ -0,0 +1,364 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zendesk_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.9
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Steven Davidovitz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: vcr
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: webmock
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: yard
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: faraday
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 0.8.0
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.8.0
110
+ - !ruby/object:Gem::Dependency
111
+ name: faraday_middleware
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.8.7
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 0.8.7
126
+ - !ruby/object:Gem::Dependency
127
+ name: hashie
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: json
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: inflection
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :runtime
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: mime-types
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :runtime
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: multipart-post
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :runtime
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ description: Ruby wrapper for the REST API at http://www.zendesk.com. Documentation
207
+ at http://developer.zendesk.com.
208
+ email:
209
+ - sdavidovitz@zendesk.com
210
+ executables: []
211
+ extensions: []
212
+ extra_rdoc_files: []
213
+ files:
214
+ - .gitignore
215
+ - .rspec
216
+ - .travis.yml
217
+ - .yardopts
218
+ - Gemfile
219
+ - Gemfile.lock
220
+ - LICENSE
221
+ - Rakefile
222
+ - Readme.md
223
+ - lib/zendesk_api.rb
224
+ - lib/zendesk_api/actions.rb
225
+ - lib/zendesk_api/association.rb
226
+ - lib/zendesk_api/client.rb
227
+ - lib/zendesk_api/collection.rb
228
+ - lib/zendesk_api/configuration.rb
229
+ - lib/zendesk_api/core_ext/inflection.rb
230
+ - lib/zendesk_api/core_ext/modulize.rb
231
+ - lib/zendesk_api/core_ext/snakecase.rb
232
+ - lib/zendesk_api/lru_cache.rb
233
+ - lib/zendesk_api/middleware/request/etag_cache.rb
234
+ - lib/zendesk_api/middleware/request/retry.rb
235
+ - lib/zendesk_api/middleware/request/upload.rb
236
+ - lib/zendesk_api/middleware/response/callback.rb
237
+ - lib/zendesk_api/middleware/response/deflate.rb
238
+ - lib/zendesk_api/middleware/response/gzip.rb
239
+ - lib/zendesk_api/middleware/response/parse_iso_dates.rb
240
+ - lib/zendesk_api/rescue.rb
241
+ - lib/zendesk_api/resource.rb
242
+ - lib/zendesk_api/resources/forum.rb
243
+ - lib/zendesk_api/resources/misc.rb
244
+ - lib/zendesk_api/resources/playlist.rb
245
+ - lib/zendesk_api/resources/ticket.rb
246
+ - lib/zendesk_api/resources/user.rb
247
+ - lib/zendesk_api/track_changes.rb
248
+ - lib/zendesk_api/trackie.rb
249
+ - lib/zendesk_api/verbs.rb
250
+ - lib/zendesk_api/version.rb
251
+ - live/Readme.md
252
+ - live/activity_spec.rb
253
+ - live/audit_spec.rb
254
+ - live/bookmark_spec.rb
255
+ - live/category_spec.rb
256
+ - live/collection_spec.rb
257
+ - live/crm_spec.rb
258
+ - live/custom_role_spec.rb
259
+ - live/forum_spec.rb
260
+ - live/forum_subscription_spec.rb
261
+ - live/group_membership_spec.rb
262
+ - live/group_spec.rb
263
+ - live/identity_spec.rb
264
+ - live/locale_spec.rb
265
+ - live/macro_spec.rb
266
+ - live/mobile_device_spec.rb
267
+ - live/organization_spec.rb
268
+ - live/satisfaction_rating_spec.rb
269
+ - live/setting_spec.rb
270
+ - live/suspended_ticket_spec.rb
271
+ - live/ticket_field_spec.rb
272
+ - live/ticket_metrics_spec.rb
273
+ - live/ticket_spec.rb
274
+ - live/topic_comment_spec.rb
275
+ - live/topic_spec.rb
276
+ - live/topic_subscription_spec.rb
277
+ - live/topic_vote_spec.rb
278
+ - live/upload_spec.rb
279
+ - live/user_spec.rb
280
+ - live/view_spec.rb
281
+ - spec/association_spec.rb
282
+ - spec/client_spec.rb
283
+ - spec/collection_spec.rb
284
+ - spec/configuration_spec.rb
285
+ - spec/create_resource_spec.rb
286
+ - spec/data_resource_spec.rb
287
+ - spec/fixtures/Argentina.gif
288
+ - spec/fixtures/Argentina2.gif
289
+ - spec/fixtures/credentials.yml.example
290
+ - spec/fixtures/test_resources.rb
291
+ - spec/fixtures/zendesk.rb
292
+ - spec/lru_cache_spec.rb
293
+ - spec/macros/resource_macros.rb
294
+ - spec/middleware/request/etag_cache_spec.rb
295
+ - spec/middleware/request/retry_spec.rb
296
+ - spec/middleware/request/test.jpg
297
+ - spec/middleware/request/upload_spec.rb
298
+ - spec/middleware/response/callback_spec.rb
299
+ - spec/middleware/response/deflate_spec.rb
300
+ - spec/middleware/response/gzip_spec.rb
301
+ - spec/middleware/response/parse_iso_dates_spec.rb
302
+ - spec/playlist_spec.rb
303
+ - spec/read_resource_spec.rb
304
+ - spec/rescue_spec.rb
305
+ - spec/resource_spec.rb
306
+ - spec/spec_helper.rb
307
+ - spec/string_spec.rb
308
+ - spec/trackie_spec.rb
309
+ - zendesk_api.gemspec
310
+ homepage: http://developer.zendesk.com
311
+ licenses:
312
+ - MIT
313
+ post_install_message:
314
+ rdoc_options: []
315
+ require_paths:
316
+ - lib
317
+ required_ruby_version: !ruby/object:Gem::Requirement
318
+ none: false
319
+ requirements:
320
+ - - ! '>='
321
+ - !ruby/object:Gem::Version
322
+ version: 1.8.7
323
+ required_rubygems_version: !ruby/object:Gem::Requirement
324
+ none: false
325
+ requirements:
326
+ - - ! '>='
327
+ - !ruby/object:Gem::Version
328
+ version: 1.3.6
329
+ requirements: []
330
+ rubyforge_project:
331
+ rubygems_version: 1.8.24
332
+ signing_key:
333
+ specification_version: 3
334
+ summary: Zendesk REST API Client
335
+ test_files:
336
+ - spec/association_spec.rb
337
+ - spec/client_spec.rb
338
+ - spec/collection_spec.rb
339
+ - spec/configuration_spec.rb
340
+ - spec/create_resource_spec.rb
341
+ - spec/data_resource_spec.rb
342
+ - spec/fixtures/Argentina.gif
343
+ - spec/fixtures/Argentina2.gif
344
+ - spec/fixtures/credentials.yml.example
345
+ - spec/fixtures/test_resources.rb
346
+ - spec/fixtures/zendesk.rb
347
+ - spec/lru_cache_spec.rb
348
+ - spec/macros/resource_macros.rb
349
+ - spec/middleware/request/etag_cache_spec.rb
350
+ - spec/middleware/request/retry_spec.rb
351
+ - spec/middleware/request/test.jpg
352
+ - spec/middleware/request/upload_spec.rb
353
+ - spec/middleware/response/callback_spec.rb
354
+ - spec/middleware/response/deflate_spec.rb
355
+ - spec/middleware/response/gzip_spec.rb
356
+ - spec/middleware/response/parse_iso_dates_spec.rb
357
+ - spec/playlist_spec.rb
358
+ - spec/read_resource_spec.rb
359
+ - spec/rescue_spec.rb
360
+ - spec/resource_spec.rb
361
+ - spec/spec_helper.rb
362
+ - spec/string_spec.rb
363
+ - spec/trackie_spec.rb
364
+ has_rdoc: