gds_zendesk 2.4.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/gds_zendesk.gemspec +1 -1
- data/lib/gds_zendesk/test_helpers.rb +15 -5
- data/lib/gds_zendesk/version.rb +1 -1
- data/spec/gds_zendesk/client_spec.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a447e6d572e8bf6c8dfdbd79c40906c05f896cc1
|
4
|
+
data.tar.gz: 86e0ee3c122ad0104ec7d578f6b07b2c67742c81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc2777822bf5fefa9ce46d98c95f8bad9bdc441fa72976c5418acc59768757286e29b1bbbeac88061d4b51e8dc4c5d0c3018247a440feeec137a4f1559a8575c
|
7
|
+
data.tar.gz: 9d1140b369c2147d9ee51d06506a8818c8ff6d2b7727acb0c248ba8f36002278c14c9753edf76d4edf06bdf90a42e0e419ebd47e57c60ae53ffe4420f34d2124
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2
|
1
|
+
2.4.2
|
data/CHANGELOG.md
CHANGED
data/gds_zendesk.gemspec
CHANGED
@@ -4,44 +4,54 @@ module GDSZendesk
|
|
4
4
|
module TestHelpers
|
5
5
|
def zendesk_has_no_user_with_email(email)
|
6
6
|
stub_request(:get, "#{zendesk_endpoint}/users/search?query=#{email}").
|
7
|
+
with(basic_auth: basic_auth_credentials).
|
7
8
|
to_return(body: {users: [], previous_page: nil, next_page: nil, count: 0}.to_json,
|
8
9
|
headers: {'Content-Type' => 'application/json'})
|
9
10
|
end
|
10
11
|
|
11
12
|
def zendesk_has_user(user_details)
|
12
13
|
stub_request(:get, "#{zendesk_endpoint}/users/search?query=#{user_details[:email]}").
|
14
|
+
with(basic_auth: basic_auth_credentials).
|
13
15
|
to_return(body: {users: [user_details], previous_page: nil, next_page: nil, count: 1}.to_json,
|
14
16
|
headers: {'Content-Type' => 'application/json'})
|
15
17
|
end
|
16
18
|
|
17
19
|
def stub_zendesk_user_creation(user_properties = nil)
|
18
|
-
stub =
|
20
|
+
stub = stub_request(:post, "#{zendesk_endpoint}/users")
|
19
21
|
stub.with(body: {user: user_properties}) unless user_properties.nil?
|
22
|
+
stub.with(basic_auth: basic_auth_credentials)
|
20
23
|
stub.to_return(status: 201, body: { user: { id: 12345, name: "abc" }}.to_json,
|
21
24
|
headers: {'Content-Type' => 'application/json'})
|
22
25
|
end
|
23
26
|
|
24
27
|
def stub_zendesk_ticket_creation(ticket_properties = nil)
|
25
|
-
stub =
|
28
|
+
stub = stub_request(:post, "#{zendesk_endpoint}/tickets")
|
26
29
|
stub.with(body: {ticket: ticket_properties}) unless ticket_properties.nil?
|
30
|
+
stub.with(basic_auth: basic_auth_credentials)
|
27
31
|
stub.to_return(status: 201, body: { ticket: { id: 12345 }}.to_json,
|
28
32
|
headers: {'Content-Type' => 'application/json'})
|
29
33
|
end
|
30
34
|
|
31
35
|
def stub_zendesk_ticket_creation_with_body(body)
|
32
|
-
|
36
|
+
stub_request(:post, "#{zendesk_endpoint}/tickets").
|
33
37
|
with(body: body).
|
38
|
+
with(basic_auth: basic_auth_credentials).
|
34
39
|
to_return(status: 201, body: { ticket: { id: 12345 }}.to_json,
|
35
40
|
headers: {'Content-Type' => 'application/json'})
|
36
41
|
end
|
37
42
|
|
38
43
|
def stub_zendesk_user_update(user_id, user_properties)
|
39
|
-
|
44
|
+
stub_request(:put, "#{zendesk_endpoint}/users/#{user_id}").
|
40
45
|
with(body: {user: user_properties}).
|
46
|
+
with(basic_auth: basic_auth_credentials).
|
41
47
|
to_return(status: 201, body: { user: { id: 12345, name: "abc" }}.to_json,
|
42
48
|
headers: {'Content-Type' => 'application/json'})
|
43
49
|
end
|
44
50
|
|
51
|
+
def basic_auth_credentials
|
52
|
+
[valid_zendesk_credentials['username'], valid_zendesk_credentials['password']]
|
53
|
+
end
|
54
|
+
|
45
55
|
def zendesk_is_unavailable
|
46
56
|
stub_request(:any, /#{zendesk_endpoint}\/.*/).to_return(status: 503)
|
47
57
|
end
|
@@ -55,7 +65,7 @@ module GDSZendesk
|
|
55
65
|
end
|
56
66
|
|
57
67
|
def zendesk_endpoint
|
58
|
-
"https
|
68
|
+
"https://govuk.zendesk.com/api/v2"
|
59
69
|
end
|
60
70
|
|
61
71
|
def valid_zendesk_credentials=(credentials)
|
data/lib/gds_zendesk/version.rb
CHANGED
@@ -54,7 +54,7 @@ module GDSZendesk
|
|
54
54
|
|
55
55
|
it "raises an exception if the ticket creation wasn't successful" do
|
56
56
|
self.valid_zendesk_credentials = valid_credentials
|
57
|
-
post_stub =
|
57
|
+
post_stub = stub_request(:post, "#{zendesk_endpoint}/tickets").to_return(status: 302)
|
58
58
|
|
59
59
|
expect { client.ticket.create!(some: "data") }.to raise_error
|
60
60
|
expect(post_stub).to have_been_requested
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds_zendesk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Benilov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: null_logger
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.3.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 2.3.0
|
83
83
|
description: Client and models for communicating with Zendesk
|
84
84
|
email:
|
85
85
|
- benilov@gmail.com
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.6.
|
129
|
+
rubygems_version: 2.6.13
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Client and models for communicating with Zendesk
|