notifications-ruby-client 5.3.0 → 6.0.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
data/README.md CHANGED
@@ -6,5 +6,5 @@ Useful links:
6
6
 
7
7
  - [Documentation](https://docs.notifications.service.gov.uk/ruby.html)
8
8
  - [Ruby gem](https://rubygems.org/gems/notifications-ruby-client)
9
- - [Changelog](https://github.com/alphagov/notifications-ruby-client/blob/master/CHANGELOG.md)
10
- - [Contributing to this client](https://github.com/alphagov/notifications-ruby-client/blob/master/CONTRIBUTING.md)
9
+ - [Changelog](https://github.com/alphagov/notifications-ruby-client/blob/main/CHANGELOG.md)
10
+ - [Contributing to this client](https://github.com/alphagov/notifications-ruby-client/blob/main/CONTRIBUTING.md)
@@ -1,9 +1,15 @@
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, filename: nil, 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) }
8
+
9
+ data[:filename] = filename
10
+ data[:confirm_email_before_download] = confirm_email_before_download
11
+ data[:retention_period] = retention_period
12
+
13
+ data
8
14
  end
9
15
  end
@@ -9,6 +9,6 @@
9
9
 
10
10
  module Notifications
11
11
  class Client
12
- VERSION = "5.3.0".freeze
12
+ VERSION = "6.0.0".freeze
13
13
  end
14
14
  end
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "rake", "~> 13.0"
27
27
  spec.add_development_dependency "rspec", "~> 3.7"
28
28
  spec.add_development_dependency "webmock", "~> 3.4"
29
- spec.add_development_dependency "factory_bot", "~> 6.1"
29
+ spec.add_development_dependency "factory_bot", "~> 6.1", "<6.4.5"
30
30
  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: 6.0.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: 2024-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -93,6 +93,9 @@ dependencies:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
95
  version: '6.1'
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: 6.4.5
96
99
  type: :development
97
100
  prerelease: false
98
101
  version_requirements: !ruby/object:Gem::Requirement
@@ -100,6 +103,9 @@ dependencies:
100
103
  - - "~>"
101
104
  - !ruby/object:Gem::Version
102
105
  version: '6.1'
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: 6.4.5
103
109
  description:
104
110
  email:
105
111
  - notify@digital.cabinet-office.gov.uk
@@ -107,6 +113,7 @@ executables: []
107
113
  extensions: []
108
114
  extra_rdoc_files: []
109
115
  files:
116
+ - ".dockerignore"
110
117
  - ".github/PULL_REQUEST_TEMPLATE.md"
111
118
  - ".gitignore"
112
119
  - ".rspec"
@@ -121,7 +128,6 @@ files:
121
128
  - README.md
122
129
  - Rakefile
123
130
  - bin/console
124
- - bin/generate_docker_env.sh
125
131
  - bin/setup
126
132
  - bin/test_client.rb
127
133
  - lib/notifications/client.rb
@@ -140,6 +146,7 @@ files:
140
146
  - lib/notifications/client/uuid_validator.rb
141
147
  - lib/notifications/client/version.rb
142
148
  - notifications-ruby-client.gemspec
149
+ - scripts/run_with_docker.sh
143
150
  homepage: https://github.com/alphagov/notifications-ruby-client
144
151
  licenses: []
145
152
  metadata: {}
@@ -158,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
165
  - !ruby/object:Gem::Version
159
166
  version: '0'
160
167
  requirements: []
161
- rubygems_version: 3.0.3
168
+ rubygems_version: 3.0.3.1
162
169
  signing_key:
163
170
  specification_version: 4
164
171
  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