gds_zendesk 2.4.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e604a12794e1b420cba49b66ebefceeb111fca94
4
- data.tar.gz: 423b173ea68fcc9f79be97f86dd848b911f9cd8e
3
+ metadata.gz: a447e6d572e8bf6c8dfdbd79c40906c05f896cc1
4
+ data.tar.gz: 86e0ee3c122ad0104ec7d578f6b07b2c67742c81
5
5
  SHA512:
6
- metadata.gz: 6fb9c8e18d8ec384bc430d95d39ba44e6ea5b394da06f7116c294d6b6126cc17523e6784537c4a715e3f25f24d87a373572b6997d8ba1ba079124521f526e748
7
- data.tar.gz: 179e746b61ffc4a3e5eba171bc5af976d93ace32a315f07bd8a18e9371f4f806a33ed90027b620047b0f5029b76728c77cb2710ae7953d215f5f9a5e048a075f
6
+ metadata.gz: bc2777822bf5fefa9ce46d98c95f8bad9bdc441fa72976c5418acc59768757286e29b1bbbeac88061d4b51e8dc4c5d0c3018247a440feeec137a4f1559a8575c
7
+ data.tar.gz: 9d1140b369c2147d9ee51d06506a8818c8ff6d2b7727acb0c248ba8f36002278c14c9753edf76d4edf06bdf90a42e0e419ebd47e57c60ae53ffe4420f34d2124
@@ -1 +1 @@
1
- 2.2
1
+ 2.4.2
@@ -1,3 +1,9 @@
1
+ # 3.0.0
2
+
3
+ * Update the `webmock` library to version v2.3.2 to be compatible with Ruby
4
+ 2.4.2
5
+ * Update the `test_helpers` to be compatible with `webmock` v2.3.2
6
+
1
7
  # 2.4.0
2
8
 
3
9
  * Update the `zendesk_api` library to v1.14.4 to silence warnings from
@@ -22,5 +22,5 @@ Gem::Specification.new do |gem|
22
22
 
23
23
  gem.add_development_dependency 'rake', '10.0.3'
24
24
  gem.add_development_dependency 'rspec', '3.1.0'
25
- gem.add_development_dependency "webmock", '1.18.0'
25
+ gem.add_development_dependency "webmock", '~> 2.3.0'
26
26
  end
@@ -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 = stub_http_request(:post, "#{zendesk_endpoint}/users")
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 = stub_http_request(:post, "#{zendesk_endpoint}/tickets")
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
- stub_http_request(:post, "#{zendesk_endpoint}/tickets").
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
- stub_http_request(:put, "#{zendesk_endpoint}/users/#{user_id}").
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://#{valid_zendesk_credentials["username"]}:#{valid_zendesk_credentials["password"]}@govuk.zendesk.com/api/v2"
68
+ "https://govuk.zendesk.com/api/v2"
59
69
  end
60
70
 
61
71
  def valid_zendesk_credentials=(credentials)
@@ -1,3 +1,3 @@
1
1
  module GDSZendesk
2
- VERSION = "2.4.0"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -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 = stub_http_request(:post, "#{zendesk_endpoint}/tickets").to_return(status: 302)
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: 2.4.0
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-05-11 00:00:00.000000000 Z
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: 1.18.0
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: 1.18.0
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.8
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