gds_zendesk 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +15 -0
- data/.govuk_dependabot_merger.yml +6 -0
- data/CHANGELOG.md +4 -0
- data/gds_zendesk.gemspec +1 -1
- data/lib/gds_zendesk/users.rb +9 -8
- data/lib/gds_zendesk/version.rb +1 -1
- data/spec/gds_zendesk/users_spec.rb +48 -9
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0f492a71decbbe5f107ebbf6703886786b27b520efb742f6498835ab2193362
|
4
|
+
data.tar.gz: 1494834b7c7074de6ecfa2c7fdcebf9f6e0f18ca2b84bbe165bcb15cf5e1f949
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1069ab78782765fa979aaa68868fc9d3747a9f178d12c33810274660ac18f38947c430650c9307ba8ed158cbcaa53f6713086ec3b839400c92586aae90c432dc
|
7
|
+
data.tar.gz: 524d13268522c1e910cbcf75cf2c26726b01d2ebbbdf327cdcd02fa4cea2c1b813b47a89705dc8dc7683b2e78127acaf1328155602d05437720e4318105b9e47
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
on: [push, pull_request]
|
2
2
|
|
3
3
|
jobs:
|
4
|
+
snyk-security:
|
5
|
+
name: SNYK security analysis
|
6
|
+
uses: alphagov/govuk-infrastructure/.github/workflows/snyk-security.yml@main
|
7
|
+
secrets: inherit
|
8
|
+
|
9
|
+
codeql-sast:
|
10
|
+
name: CodeQL SAST scan
|
11
|
+
uses: alphagov/govuk-infrastructure/.github/workflows/codeql-analysis.yml@main
|
12
|
+
permissions:
|
13
|
+
security-events: write
|
14
|
+
|
15
|
+
dependency-review:
|
16
|
+
name: Dependency Review scan
|
17
|
+
uses: alphagov/govuk-infrastructure/.github/workflows/dependency-review.yml@main
|
18
|
+
|
4
19
|
test_matrix:
|
5
20
|
strategy:
|
6
21
|
fail-fast: false
|
data/CHANGELOG.md
CHANGED
data/gds_zendesk.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |gem|
|
|
23
23
|
|
24
24
|
gem.add_development_dependency "rake"
|
25
25
|
gem.add_development_dependency "rspec", "~> 3"
|
26
|
-
gem.add_development_dependency "rubocop-govuk", "4.
|
26
|
+
gem.add_development_dependency "rubocop-govuk", "4.13.0"
|
27
27
|
gem.add_development_dependency "webmock", ">= 2"
|
28
28
|
end
|
data/lib/gds_zendesk/users.rb
CHANGED
@@ -31,18 +31,19 @@ module GDSZendesk
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def create(requested_user)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
verified: true)
|
34
|
+
attributes = { email: requested_user.email, name: requested_user.name, verified: true }
|
35
|
+
attributes[:details] = "Job title: #{requested_user.job}" if requested_user.respond_to?(:job)
|
36
|
+
attributes[:phone] = requested_user.phone if requested_user.respond_to?(:phone)
|
37
|
+
@client.users.create!(attributes)
|
39
38
|
end
|
40
39
|
|
41
40
|
def update(existing_user_in_zendesk, requested_user)
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
attributes = {}
|
42
|
+
attributes[:details] = "Job title: #{requested_user.job}" if requested_user.respond_to?(:job)
|
43
|
+
if requested_user.respond_to?(:phone) && !requested_user.phone.nil? && !requested_user.phone.empty?
|
44
|
+
attributes[:phone] = requested_user.phone
|
45
45
|
end
|
46
|
+
existing_user_in_zendesk.update(attributes)
|
46
47
|
existing_user_in_zendesk.save
|
47
48
|
existing_user_in_zendesk
|
48
49
|
end
|
data/lib/gds_zendesk/version.rb
CHANGED
@@ -23,6 +23,20 @@ module GDSZendesk
|
|
23
23
|
expect(stub_post).to have_been_requested
|
24
24
|
end
|
25
25
|
|
26
|
+
it "can update a user which doesn't respond to #job" do
|
27
|
+
stub_post = stub_zendesk_user_update(123, phone: "12345")
|
28
|
+
users.create_or_update_user(double("requested user", email: "test@test.com", phone: "12345"))
|
29
|
+
|
30
|
+
expect(stub_post).to have_been_requested
|
31
|
+
end
|
32
|
+
|
33
|
+
it "can update a user which doesn't respond to #phone" do
|
34
|
+
stub_post = stub_zendesk_user_update(123, details: "Job title: Developer")
|
35
|
+
users.create_or_update_user(double("requested user", email: "test@test.com", job: "Developer"))
|
36
|
+
|
37
|
+
expect(stub_post).to have_been_requested
|
38
|
+
end
|
39
|
+
|
26
40
|
it "knows whether the user is suspended or not" do
|
27
41
|
zendesk_has_user(email: "test@test.com", id: 123, suspended: "true")
|
28
42
|
expect(users).to be_suspended("test@test.com")
|
@@ -30,6 +44,16 @@ module GDSZendesk
|
|
30
44
|
end
|
31
45
|
|
32
46
|
context "when a user doesn't exist" do
|
47
|
+
let(:expected_attributes) do
|
48
|
+
{
|
49
|
+
verified: true,
|
50
|
+
name: "Abc",
|
51
|
+
email: "test@test.com",
|
52
|
+
phone: "12345",
|
53
|
+
details: "Job title: Developer",
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
33
57
|
before do
|
34
58
|
zendesk_has_no_user_with_email("test@test.com")
|
35
59
|
end
|
@@ -39,15 +63,30 @@ module GDSZendesk
|
|
39
63
|
end
|
40
64
|
|
41
65
|
it "can create that user" do
|
42
|
-
stub_post = stub_zendesk_user_creation(
|
43
|
-
|
44
|
-
name: "Abc",
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
)
|
49
|
-
|
50
|
-
|
66
|
+
stub_post = stub_zendesk_user_creation(expected_attributes)
|
67
|
+
user_being_requested = double("requested user", {
|
68
|
+
name: "Abc", email: "test@test.com", phone: "12345", job: "Developer"
|
69
|
+
})
|
70
|
+
|
71
|
+
users.create_or_update_user(user_being_requested)
|
72
|
+
expect(stub_post).to have_been_requested
|
73
|
+
end
|
74
|
+
|
75
|
+
it "can create that user which doesn't respond to #job" do
|
76
|
+
stub_post = stub_zendesk_user_creation(expected_attributes.except(:details))
|
77
|
+
user_being_requested = double("requested user", {
|
78
|
+
name: "Abc", email: "test@test.com", phone: "12345"
|
79
|
+
})
|
80
|
+
|
81
|
+
users.create_or_update_user(user_being_requested)
|
82
|
+
expect(stub_post).to have_been_requested
|
83
|
+
end
|
84
|
+
|
85
|
+
it "can create that user which doesn't respond to #phone" do
|
86
|
+
stub_post = stub_zendesk_user_creation(expected_attributes.except(:phone))
|
87
|
+
user_being_requested = double("requested user", {
|
88
|
+
name: "Abc", email: "test@test.com", job: "Developer"
|
89
|
+
})
|
51
90
|
|
52
91
|
users.create_or_update_user(user_being_requested)
|
53
92
|
expect(stub_post).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: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: null_logger
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - '='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 4.
|
81
|
+
version: 4.13.0
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - '='
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 4.
|
88
|
+
version: 4.13.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: webmock
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- ".github/dependabot.yml"
|
111
111
|
- ".github/workflows/ci.yml"
|
112
112
|
- ".gitignore"
|
113
|
+
- ".govuk_dependabot_merger.yml"
|
113
114
|
- ".rubocop.yml"
|
114
115
|
- ".ruby-version"
|
115
116
|
- CHANGELOG.md
|
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
148
|
- !ruby/object:Gem::Version
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
|
-
rubygems_version: 3.4
|
151
|
+
rubygems_version: 3.5.4
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: Client and models for communicating with Zendesk
|