zendesk_api 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/zendesk_api/association.rb +3 -3
- data/lib/zendesk_api/client.rb +19 -2
- data/lib/zendesk_api/delegator.rb +4 -0
- data/lib/zendesk_api/resources.rb +7 -1
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/core/client_spec.rb +13 -2
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/creation/should_be_findable.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/deletion/should_be_destroyable.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/after_save/should_be_findable.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/after_save/should_keep_attributes.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/should_be_savable.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_create.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_create_delete.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_delete_create.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_update_create.json +1 -0
- data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_update_delete.json +1 -0
- data/spec/live/ticket_spec.rb +2 -1
- data/spec/live/voice/phone_number_spec.rb +11 -0
- metadata +25 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'zendesk_api/helpers'
|
2
2
|
|
3
3
|
module ZendeskAPI
|
4
|
-
# Represents an association between two resources
|
4
|
+
# Represents an association between two resources
|
5
5
|
# @private
|
6
6
|
class Association
|
7
7
|
# @return [Hash] Options passed into the association
|
@@ -10,7 +10,7 @@ module ZendeskAPI
|
|
10
10
|
# Options to pass in
|
11
11
|
# * class - Required
|
12
12
|
# * parent - Parent instance
|
13
|
-
# * path - Optional path instead of resource name
|
13
|
+
# * path - Optional path instead of resource name
|
14
14
|
def initialize(options = {})
|
15
15
|
@options = Hashie::Mash.new(options)
|
16
16
|
end
|
@@ -32,7 +32,7 @@ module ZendeskAPI
|
|
32
32
|
instance = args.first
|
33
33
|
|
34
34
|
namespace = @options[:class].to_s.split("::")
|
35
|
-
namespace.delete(
|
35
|
+
%w(ZendeskAPI Voice).each { |ns| namespace.delete(ns) }
|
36
36
|
has_parent = namespace.size > 1 || (options[:with_parent] && @options.parent)
|
37
37
|
|
38
38
|
if has_parent
|
data/lib/zendesk_api/client.rb
CHANGED
@@ -15,6 +15,7 @@ require 'zendesk_api/middleware/response/gzip'
|
|
15
15
|
require 'zendesk_api/middleware/response/parse_iso_dates'
|
16
16
|
require 'zendesk_api/middleware/response/raise_error'
|
17
17
|
require 'zendesk_api/middleware/response/logger'
|
18
|
+
require 'zendesk_api/delegator'
|
18
19
|
|
19
20
|
module ZendeskAPI
|
20
21
|
# The top-level class that handles configuration and connection to the Zendesk API.
|
@@ -33,11 +34,13 @@ module ZendeskAPI
|
|
33
34
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
34
35
|
|
35
36
|
@resource_cache[method] ||= { :class => nil, :cache => ZendeskAPI::LRUCache.new }
|
36
|
-
|
37
37
|
if !options.delete(:reload) && (cached = @resource_cache[method][:cache].read(options.hash))
|
38
38
|
cached
|
39
39
|
else
|
40
|
-
|
40
|
+
klass_as_const = ZendeskAPI::Helpers.modulize_string(Inflection.singular(method))
|
41
|
+
klass = class_from_namespace(klass_as_const)
|
42
|
+
|
43
|
+
@resource_cache[method][:class] ||= klass
|
41
44
|
@resource_cache[method][:cache].write(options.hash, ZendeskAPI::Collection.new(self, @resource_cache[method][:class], options))
|
42
45
|
end
|
43
46
|
end
|
@@ -109,6 +112,10 @@ module ZendeskAPI
|
|
109
112
|
end
|
110
113
|
end
|
111
114
|
|
115
|
+
def voice
|
116
|
+
Delegator.new(self)
|
117
|
+
end
|
118
|
+
|
112
119
|
protected
|
113
120
|
|
114
121
|
# Called by {#connection} to build a connection. Can be overwritten in a
|
@@ -158,6 +165,16 @@ module ZendeskAPI
|
|
158
165
|
|
159
166
|
private
|
160
167
|
|
168
|
+
def class_from_namespace(klass_as_const)
|
169
|
+
[ZendeskAPI, ZendeskAPI::Voice].each do |ns|
|
170
|
+
if ns.const_defined?(klass_as_const)
|
171
|
+
return ns.const_get(klass_as_const)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
nil
|
176
|
+
end
|
177
|
+
|
161
178
|
def check_url
|
162
179
|
if !config.allow_http && config.url !~ /^https/
|
163
180
|
raise ArgumentError, "zendesk_api is ssl only; url must begin with https://"
|
@@ -45,7 +45,7 @@ module ZendeskAPI
|
|
45
45
|
def _save(method = :save)
|
46
46
|
return self unless @resources
|
47
47
|
|
48
|
-
client.connection.post(path) do |req|
|
48
|
+
@client.connection.post(path) do |req|
|
49
49
|
req.body = { :tags => @resources.map(&:id) }
|
50
50
|
end
|
51
51
|
|
@@ -466,4 +466,10 @@ module ZendeskAPI
|
|
466
466
|
end
|
467
467
|
|
468
468
|
class Target < Resource; end
|
469
|
+
|
470
|
+
module Voice
|
471
|
+
class PhoneNumber < Resource
|
472
|
+
namespace "channels/voice"
|
473
|
+
end
|
474
|
+
end
|
469
475
|
end
|
data/lib/zendesk_api/version.rb
CHANGED
data/spec/core/client_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe ZendeskAPI::Client do
|
|
19
19
|
ZendeskAPI::Client.new do |config|
|
20
20
|
config.url = "http://www.google.com"
|
21
21
|
end
|
22
|
-
end.to raise_error(ArgumentError)
|
22
|
+
end.to raise_error(ArgumentError)
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should not raise an exception when url isn't ssl and allow_http is set to true" do
|
@@ -115,7 +115,7 @@ describe ZendeskAPI::Client do
|
|
115
115
|
|
116
116
|
context "#logger" do
|
117
117
|
before(:each) do
|
118
|
-
@client = ZendeskAPI::Client.new do |config|
|
118
|
+
@client = ZendeskAPI::Client.new do |config|
|
119
119
|
config.url = "https://example.zendesk.com/"
|
120
120
|
config.logger = subject
|
121
121
|
end
|
@@ -232,4 +232,15 @@ describe ZendeskAPI::Client do
|
|
232
232
|
client.connection.should == "FOO"
|
233
233
|
client.connection.object_id.should == client.connection.object_id # it's cached
|
234
234
|
end
|
235
|
+
|
236
|
+
context ZendeskAPI::Voice do
|
237
|
+
it "defers to voice delegator" do
|
238
|
+
ZendeskAPI::Client.any_instance.should_receive(:phone_numbers).once
|
239
|
+
subject.voice.phone_numbers
|
240
|
+
end
|
241
|
+
|
242
|
+
it "manages namespace correctly" do
|
243
|
+
ZendeskAPI::Voice::PhoneNumber.new(subject, {}).path.should match(/channels\/voice\/phone_numbers/)
|
244
|
+
end
|
245
|
+
end
|
235
246
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/61","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 08:52:34 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["201"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["154"],"Etag":["\"1e0d292a3112a5f5cfd02f8ed20ae71c\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjYxLCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDA4OjUyOjMzWiIsIm51bWJlciI6Iisx\nNzU0MzAwMjE5NCIsIm5hbWUiOiIrMSAoNzU0KSAzMDAtMjE5NCIsImRpc3Bs\nYXlfbnVtYmVyIjoiKzEgKDc1NCkgMzAwLTIxOTQiLCJsb2NhdGlvbiI6bnVs\nbCwidG9sbF9mcmVlIjpmYWxzZX19\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 08:52:34 GMT"},{"request":{"method":"get","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/47","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:00:22 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["238"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["161"],"Etag":["\"7aa1a2e5a56a8e87db32554a20f3c1ee\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjQ3LCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDE1OjAwOjIxWiIsIm51bWJlciI6Iisx\nNDg0NDk4NjU5MCIsIm5hbWUiOiIrMSAoNDg0KSA0OTgtNjU5MCIsImRpc3Bs\nYXlfbnVtYmVyIjoiKzEgKDQ4NCkgNDk4LTY1OTAiLCJsb2NhdGlvbiI6bnVs\nbCwidG9sbF9mcmVlIjpmYWxzZSwidHJhbnNjcmlwdGlvbiI6dHJ1ZSwicmVj\nb3JkZWQiOnRydWV9fQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:00:22 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"delete","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/62","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 16:25:11 GMT"],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["1"],"Connection":["keep-alive"],"Status":["200 OK"],"Cache-Control":["no-cache"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["230"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"IA==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 16:25:11 GMT"},{"request":{"method":"get","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/62","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"]}},"response":{"status":{"code":404,"message":"Not Found"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 16:25:13 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["52"],"Connection":["keep-alive"],"Status":["404 Not Found"],"Cache-Control":["no-cache"],"X-Zendesk-Api-Version":["v2"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJlcnJvciI6IlJlY29yZE5vdEZvdW5kIiwiZGVzY3JpcHRpb24iOiJOb3Qg\nZm91bmQifQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 16:25:13 GMT"}],"recorded_with":"VCR 2.5.0"}
|
data/spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/after_save/should_be_findable.json
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"put","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/61","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnt9fQ==\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":400,"message":"Bad Request"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 13:54:35 GMT"],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["40"],"Connection":["keep-alive"],"Status":["400 Bad Request"],"Cache-Control":["no-cache"],"X-Zendesk-Api-Version":["v2"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"UmVxdWlyZWQgcGFyYW1ldGVyIG1pc3Npbmc6IHBob25lX251bWJlcg==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 13:54:35 GMT"},{"request":{"method":"get","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/61","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 13:54:36 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["229"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["1435"],"Etag":["\"6b164a12d8618b3cf9050dd43cf4e10e\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjYxLCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDA4OjUyOjMzWiIsIm51bWJlciI6Iisx\nNzU0MzAwMjE5NCIsIm5hbWUiOiJURVNUREFUQSIsImRpc3BsYXlfbnVtYmVy\nIjoiKzEgKDc1NCkgMzAwLTIxOTQiLCJsb2NhdGlvbiI6bnVsbCwidG9sbF9m\ncmVlIjpmYWxzZSwidHJhbnNjcmlwdGlvbiI6dHJ1ZSwicmVjb3JkZWQiOnRy\ndWV9fQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 13:54:36 GMT"},{"request":{"method":"put","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/52","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnt9fQ==\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":400,"message":"Bad Request"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:12:57 GMT"],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["40"],"Connection":["keep-alive"],"Status":["400 Bad Request"],"Cache-Control":["no-cache"],"X-Zendesk-Api-Version":["v2"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"UmVxdWlyZWQgcGFyYW1ldGVyIG1pc3Npbmc6IHBob25lX251bWJlcg==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:12:57 GMT"},{"request":{"method":"get","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/52","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:12:58 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["229"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["83"],"Etag":["\"194d7a4561924b7ee2d31072e0e07df5\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjUyLCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDE1OjEyOjUxWiIsIm51bWJlciI6Iisx\nNDY5ODQ0NDI3MiIsIm5hbWUiOiJURVNUREFUQSIsImRpc3BsYXlfbnVtYmVy\nIjoiKzEgKDQ2OSkgODQ0LTQyNzIiLCJsb2NhdGlvbiI6bnVsbCwidG9sbF9m\ncmVlIjpmYWxzZSwidHJhbnNjcmlwdGlvbiI6dHJ1ZSwicmVjb3JkZWQiOnRy\ndWV9fQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:12:58 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"put","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/61","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnt9fQ==\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":400,"message":"Bad Request"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 13:54:34 GMT"],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["40"],"Connection":["keep-alive"],"Status":["400 Bad Request"],"Cache-Control":["no-cache"],"X-Zendesk-Api-Version":["v2"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"UmVxdWlyZWQgcGFyYW1ldGVyIG1pc3Npbmc6IHBob25lX251bWJlcg==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 13:54:34 GMT"},{"request":{"method":"put","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/52","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnt9fQ==\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":400,"message":"Bad Request"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:12:57 GMT"],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["40"],"Connection":["keep-alive"],"Status":["400 Bad Request"],"Cache-Control":["no-cache"],"X-Zendesk-Api-Version":["v2"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"UmVxdWlyZWQgcGFyYW1ldGVyIG1pc3Npbmc6IHBob25lX251bWJlcg==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:12:57 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"put","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/61","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnsibmlja25hbWUiOiJURVNUREFUQSJ9fQ==\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 13:54:33 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["229"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["1090"],"Etag":["\"6b164a12d8618b3cf9050dd43cf4e10e\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjYxLCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDA4OjUyOjMzWiIsIm51bWJlciI6Iisx\nNzU0MzAwMjE5NCIsIm5hbWUiOiJURVNUREFUQSIsImRpc3BsYXlfbnVtYmVy\nIjoiKzEgKDc1NCkgMzAwLTIxOTQiLCJsb2NhdGlvbiI6bnVsbCwidG9sbF9m\ncmVlIjpmYWxzZSwidHJhbnNjcmlwdGlvbiI6dHJ1ZSwicmVjb3JkZWQiOnRy\ndWV9fQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 13:54:33 GMT"},{"request":{"method":"put","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/52","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnsibmlja25hbWUiOiJURVNUREFUQSJ9fQ==\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:12:57 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["229"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["235"],"Etag":["\"194d7a4561924b7ee2d31072e0e07df5\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjUyLCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDE1OjEyOjUxWiIsIm51bWJlciI6Iisx\nNDY5ODQ0NDI3MiIsIm5hbWUiOiJURVNUREFUQSIsImRpc3BsYXlfbnVtYmVy\nIjoiKzEgKDQ2OSkgODQ0LTQyNzIiLCJsb2NhdGlvbiI6bnVsbCwidG9sbF9m\ncmVlIjpmYWxzZSwidHJhbnNjcmlwdGlvbiI6dHJ1ZSwicmVjb3JkZWQiOnRy\ndWV9fQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:12:57 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"post","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnsibnVtYmVyIjoiKzE0ODQ0OTg2NTkwIiwiY291\nbnRyeV9jb2RlIjoiVVMiLCJudW1iZXJfdHlwZSI6ImxvY2FsIn19\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:00:21 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["238"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["2575"],"Etag":["\"7aa1a2e5a56a8e87db32554a20f3c1ee\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjQ3LCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDE1OjAwOjIxWiIsIm51bWJlciI6Iisx\nNDg0NDk4NjU5MCIsIm5hbWUiOiIrMSAoNDg0KSA0OTgtNjU5MCIsImRpc3Bs\nYXlfbnVtYmVyIjoiKzEgKDQ4NCkgNDk4LTY1OTAiLCJsb2NhdGlvbiI6bnVs\nbCwidG9sbF9mcmVlIjpmYWxzZSwidHJhbnNjcmlwdGlvbiI6dHJ1ZSwicmVj\nb3JkZWQiOnRydWV9fQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:00:21 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"delete","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/47","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:00:23 GMT"],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["1"],"Connection":["keep-alive"],"Status":["200 OK"],"Cache-Control":["no-cache"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["204"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"IA==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:00:23 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"post","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnsibnVtYmVyIjoiKzE0NDM0MDY0NzU5IiwiY291\nbnRyeV9jb2RlIjoiVVMiLCJ0b2xsX2ZyZWUiOiJmYWxzZSJ9fQ==\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 16:25:10 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["238"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["2040"],"Etag":["\"c9c932a7305bd0b676cc77c72a81111e\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjYyLCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDE2OjI1OjA5WiIsIm51bWJlciI6Iisx\nNDQzNDA2NDc1OSIsIm5hbWUiOiIrMSAoNDQzKSA0MDYtNDc1OSIsImRpc3Bs\nYXlfbnVtYmVyIjoiKzEgKDQ0MykgNDA2LTQ3NTkiLCJsb2NhdGlvbiI6bnVs\nbCwidG9sbF9mcmVlIjpmYWxzZSwidHJhbnNjcmlwdGlvbiI6dHJ1ZSwicmVj\nb3JkZWQiOnRydWV9fQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 16:25:10 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"post","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers","body":{"encoding":"UTF-8","base64_string":"eyJwaG9uZV9udW1iZXIiOnsibnVtYmVyIjoiKzE0Njk4NDQ0MjcyIiwiY291\nbnRyeV9jb2RlIjoiVVMiLCJudW1iZXJfdHlwZSI6ImxvY2FsIn19\n"},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"],"Content-Type":["application/json"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:12:56 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["238"],"Connection":["keep-alive"],"Status":["200 OK"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["6382"],"Etag":["\"4f6781ef2a7c1a8524d71e43fb6beae6\""],"Cache-Control":["private, max-age=0, must-revalidate"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"eyJwaG9uZV9udW1iZXIiOnsiaWQiOjUyLCJjb3VudHJ5X2lkIjoxNTYsImNy\nZWF0ZWRfYXQiOiIyMDEzLTA4LTIxVDE1OjEyOjUxWiIsIm51bWJlciI6Iisx\nNDY5ODQ0NDI3MiIsIm5hbWUiOiIrMSAoNDY5KSA4NDQtNDI3MiIsImRpc3Bs\nYXlfbnVtYmVyIjoiKzEgKDQ2OSkgODQ0LTQyNzIiLCJsb2NhdGlvbiI6bnVs\nbCwidG9sbF9mcmVlIjpmYWxzZSwidHJhbnNjcmlwdGlvbiI6dHJ1ZSwicmVj\nb3JkZWQiOnRydWV9fQ==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:12:56 GMT"}],"recorded_with":"VCR 2.5.0"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"delete","uri":"http://agent%40zendesk.com:Testing123%21@support.localhost/api/v2/channels/voice/phone_numbers/52","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/json"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],"User-Agent":["ZendeskAPI API 1.0.1"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.2.8"],"Date":["Wed, 21 Aug 2013 15:12:58 GMT"],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["1"],"Connection":["keep-alive"],"Status":["200 OK"],"Cache-Control":["no-cache"],"X-Zendesk-Api-Version":["v2"],"X-Runtime":["277"],"X-Zendesk-Origin-Server":["calvin.local"],"X-Zendesk-User-Id":["2"]},"body":{"encoding":"US-ASCII","base64_string":"IA==\n"},"http_version":null},"recorded_at":"Wed, 21 Aug 2013 15:12:58 GMT"}],"recorded_with":"VCR 2.5.0"}
|
data/spec/live/ticket_spec.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
describe ZendeskAPI::Voice::PhoneNumber, :delete_after do
|
2
|
+
def valid_attributes
|
3
|
+
{:number => "+14434064759", :country_code => "US", :toll_free => "false"}
|
4
|
+
end
|
5
|
+
|
6
|
+
it_should_be_creatable
|
7
|
+
it_should_be_updatable :nickname
|
8
|
+
it_should_be_updatable :transcription
|
9
|
+
it_should_be_updatable :recorded
|
10
|
+
it_should_be_deletable
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bump
|
@@ -254,6 +254,7 @@ files:
|
|
254
254
|
- lib/zendesk_api/console/extensions.rb
|
255
255
|
- lib/zendesk_api/console/options.rb
|
256
256
|
- lib/zendesk_api/core_ext/inflection.rb
|
257
|
+
- lib/zendesk_api/delegator.rb
|
257
258
|
- lib/zendesk_api/error.rb
|
258
259
|
- lib/zendesk_api/helpers.rb
|
259
260
|
- lib/zendesk_api/lru_cache.rb
|
@@ -465,6 +466,16 @@ files:
|
|
465
466
|
- spec/core/trackie_spec.rb
|
466
467
|
- spec/fixtures/Argentina.gif
|
467
468
|
- spec/fixtures/Argentina2.gif
|
469
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/creation/should_be_findable.json
|
470
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/deletion/should_be_destroyable.json
|
471
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/after_save/should_be_findable.json
|
472
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/after_save/should_keep_attributes.json
|
473
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/should_be_savable.json
|
474
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_create.json
|
475
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_create_delete.json
|
476
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_delete_create.json
|
477
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_update_create.json
|
478
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_update_delete.json
|
468
479
|
- spec/fixtures/credentials.yml.example
|
469
480
|
- spec/fixtures/test_resources.rb
|
470
481
|
- spec/fixtures/zendesk.rb
|
@@ -504,6 +515,7 @@ files:
|
|
504
515
|
- spec/live/user_field_spec.rb
|
505
516
|
- spec/live/user_spec.rb
|
506
517
|
- spec/live/view_spec.rb
|
518
|
+
- spec/live/voice/phone_number_spec.rb
|
507
519
|
- spec/macros/resource_macros.rb
|
508
520
|
- spec/server/app_spec.rb
|
509
521
|
- spec/server/helper_spec.rb
|
@@ -562,6 +574,16 @@ test_files:
|
|
562
574
|
- spec/core/trackie_spec.rb
|
563
575
|
- spec/fixtures/Argentina.gif
|
564
576
|
- spec/fixtures/Argentina2.gif
|
577
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/creation/should_be_findable.json
|
578
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/deletion/should_be_destroyable.json
|
579
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/after_save/should_be_findable.json
|
580
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/after_save/should_keep_attributes.json
|
581
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber/update/should_be_savable.json
|
582
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_create.json
|
583
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_create_delete.json
|
584
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_delete_create.json
|
585
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_update_create.json
|
586
|
+
- spec/fixtures/cassettes/ZendeskAPI_Voice_PhoneNumber_update_delete.json
|
565
587
|
- spec/fixtures/credentials.yml.example
|
566
588
|
- spec/fixtures/test_resources.rb
|
567
589
|
- spec/fixtures/zendesk.rb
|
@@ -601,6 +623,7 @@ test_files:
|
|
601
623
|
- spec/live/user_field_spec.rb
|
602
624
|
- spec/live/user_spec.rb
|
603
625
|
- spec/live/view_spec.rb
|
626
|
+
- spec/live/voice/phone_number_spec.rb
|
604
627
|
- spec/macros/resource_macros.rb
|
605
628
|
- spec/server/app_spec.rb
|
606
629
|
- spec/server/helper_spec.rb
|