notifications-ruby-client 5.3.0 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Dockerfile CHANGED
@@ -11,3 +11,6 @@ RUN \
11
11
  gnupg
12
12
 
13
13
  WORKDIR /var/project
14
+
15
+ COPY . .
16
+ RUN make bootstrap
data/Makefile CHANGED
@@ -1,22 +1,16 @@
1
1
  .DEFAULT_GOAL := help
2
2
  SHELL := /bin/bash
3
3
 
4
- DOCKER_BUILDER_IMAGE_NAME = govuk/notify-ruby-client-builder
5
-
6
- BUILD_TAG ?= notifications-ruby-client-manual
7
-
8
- DOCKER_CONTAINER_PREFIX = ${USER}-${BUILD_TAG}
9
-
10
4
  .PHONY: help
11
5
  help:
12
6
  @cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
13
7
 
14
- .PHONY: dependencies
15
- dependencies: ## Install build dependencies
16
- bundle install --path=vendor/bundle --binstubs=vendor/bin
8
+ .PHONY: bootstrap
9
+ bootstrap: ## Install build dependencies
10
+ bundle install
17
11
 
18
12
  .PHONY: build
19
- build: dependencies ## Build project
13
+ build: bootstrap ## Build project (dummy task for CI)
20
14
 
21
15
  .PHONY: test
22
16
  test: ## Run tests
@@ -26,40 +20,17 @@ test: ## Run tests
26
20
  integration-test: ## Run integration tests
27
21
  bundle exec bin/test_client.rb
28
22
 
29
- .PHONY: generate-env-file
30
- generate-env-file: ## Generate the environment file for running the tests inside a Docker container
31
- bin/generate_docker_env.sh
32
-
33
- .PHONY: prepare-docker-runner-image
34
- prepare-docker-runner-image: ## Prepare the Docker builder image
35
- docker pull `grep "FROM " Dockerfile | cut -d ' ' -f 2` || true
36
- docker build -t ${DOCKER_BUILDER_IMAGE_NAME} .
37
-
38
- .PHONY: build-with-docker
39
- build-with-docker: prepare-docker-runner-image ## Build inside a Docker container
40
- docker run -i --rm \
41
- --name "${DOCKER_CONTAINER_PREFIX}-build" \
42
- -v "`pwd`:/var/project" \
43
- ${DOCKER_BUILDER_IMAGE_NAME} \
44
- make build
23
+ .PHONY: bootstrap-with-docker
24
+ bootstrap-with-docker: ## Prepare the Docker builder image
25
+ docker build -t notifications-ruby-client .
45
26
 
46
27
  .PHONY: test-with-docker
47
- test-with-docker: prepare-docker-runner-image generate-env-file ## Run tests inside a Docker container
48
- docker run -i --rm \
49
- --name "${DOCKER_CONTAINER_PREFIX}-test" \
50
- -v "`pwd`:/var/project" \
51
- --env-file docker.env \
52
- ${DOCKER_BUILDER_IMAGE_NAME} \
53
- make build test
28
+ test-with-docker: ## Run tests inside a Docker container
29
+ ./scripts/run_with_docker.sh make test
54
30
 
55
31
  .PHONY: integration-test-with-docker
56
- integration-test-with-docker: prepare-docker-runner-image generate-env-file ## Run integration tests inside a Docker container
57
- docker run -i --rm \
58
- --name "${DOCKER_CONTAINER_PREFIX}-integration-test" \
59
- -v "`pwd`:/var/project" \
60
- --env-file docker.env \
61
- ${DOCKER_BUILDER_IMAGE_NAME} \
62
- make build integration-test
32
+ integration-test-with-docker: ## Run integration tests inside a Docker container
33
+ ./scripts/run_with_docker.sh make integration-test
63
34
 
64
35
  .PHONY: get-client-version
65
36
  get-client-version: ## Retrieve client version number from source code
@@ -71,9 +42,5 @@ publish-to-rubygems: ## Create gemspec file and publish to rubygems
71
42
  gem build notifications-ruby-client.gemspec --output=release.gem
72
43
  gem push release.gem
73
44
 
74
- .PHONY: clean-docker-containers
75
- clean-docker-containers: ## Clean up any remaining docker containers
76
- docker rm -f $(shell docker ps -q -f "name=${DOCKER_CONTAINER_PREFIX}") 2> /dev/null || true
77
-
78
45
  clean:
79
46
  rm -rf vendor
@@ -1,9 +1,14 @@
1
1
  require "base64"
2
2
 
3
3
  module Notifications
4
- def self.prepare_upload(file, is_csv=false)
4
+ def self.prepare_upload(file, is_csv=false, confirm_email_before_download: nil, retention_period: nil)
5
5
  raise ArgumentError.new("File is larger than 2MB") if file.size > Client::MAX_FILE_UPLOAD_SIZE
6
6
 
7
- { file: Base64.strict_encode64(file.read), is_csv: is_csv }
7
+ data = { file: Base64.strict_encode64(file.read), is_csv: is_csv }
8
+
9
+ data[:confirm_email_before_download] = confirm_email_before_download
10
+ data[:retention_period] = retention_period
11
+
12
+ data
8
13
  end
9
14
  end
@@ -9,6 +9,6 @@
9
9
 
10
10
  module Notifications
11
11
  class Client
12
- VERSION = "5.3.0".freeze
12
+ VERSION = "5.4.0".freeze
13
13
  end
14
14
  end
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ DOCKER_IMAGE_NAME=notifications-ruby-client
3
+
4
+ source environment.sh
5
+
6
+ docker run \
7
+ --rm \
8
+ -v "`pwd`:/var/project" \
9
+ -e NOTIFY_API_URL=${NOTIFY_API_URL} \
10
+ -e API_KEY=${API_KEY} \
11
+ -e FUNCTIONAL_TEST_NUMBER=${FUNCTIONAL_TEST_NUMBER} \
12
+ -e FUNCTIONAL_TEST_EMAIL=${FUNCTIONAL_TEST_EMAIL} \
13
+ -e EMAIL_TEMPLATE_ID=${EMAIL_TEMPLATE_ID} \
14
+ -e SMS_TEMPLATE_ID=${SMS_TEMPLATE_ID} \
15
+ -e LETTER_TEMPLATE_ID=${LETTER_TEMPLATE_ID} \
16
+ -e EMAIL_REPLY_TO_ID=${EMAIL_REPLY_TO_ID} \
17
+ -e SMS_SENDER_ID=${SMS_SENDER_ID} \
18
+ -e API_SENDING_KEY=${API_SENDING_KEY} \
19
+ -e INBOUND_SMS_QUERY_KEY=${INBOUND_SMS_QUERY_KEY} \
20
+ -it \
21
+ ${DOCKER_IMAGE_NAME} \
22
+ ${@}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifications-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-11 00:00:00.000000000 Z
11
+ date: 2022-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -107,6 +107,7 @@ executables: []
107
107
  extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
+ - ".dockerignore"
110
111
  - ".github/PULL_REQUEST_TEMPLATE.md"
111
112
  - ".gitignore"
112
113
  - ".rspec"
@@ -121,7 +122,6 @@ files:
121
122
  - README.md
122
123
  - Rakefile
123
124
  - bin/console
124
- - bin/generate_docker_env.sh
125
125
  - bin/setup
126
126
  - bin/test_client.rb
127
127
  - lib/notifications/client.rb
@@ -140,6 +140,7 @@ files:
140
140
  - lib/notifications/client/uuid_validator.rb
141
141
  - lib/notifications/client/version.rb
142
142
  - notifications-ruby-client.gemspec
143
+ - scripts/run_with_docker.sh
143
144
  homepage: https://github.com/alphagov/notifications-ruby-client
144
145
  licenses: []
145
146
  metadata: {}
@@ -158,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  - !ruby/object:Gem::Version
159
160
  version: '0'
160
161
  requirements: []
161
- rubygems_version: 3.0.3
162
+ rubygems_version: 3.0.3.1
162
163
  signing_key:
163
164
  specification_version: 4
164
165
  summary: Ruby client for GOV.UK Notifications API
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -eo pipefail
4
-
5
- function exit_with_msg {
6
- echo $1
7
- exit $2
8
- }
9
-
10
- echo -n "" > docker.env
11
-
12
- env_vars=(
13
- NOTIFY_API_URL
14
- SERVICE_ID
15
- API_KEY
16
- FUNCTIONAL_TEST_EMAIL
17
- FUNCTIONAL_TEST_NUMBER
18
- EMAIL_TEMPLATE_ID
19
- SMS_TEMPLATE_ID
20
- LETTER_TEMPLATE_ID
21
- EMAIL_REPLY_TO_ID
22
- SMS_SENDER_ID
23
- API_SENDING_KEY
24
- INBOUND_SMS_QUERY_KEY
25
- )
26
-
27
- for env_var in "${env_vars[@]}"; do
28
- echo "${env_var}=${!env_var}" >> docker.env
29
- done