defra_ruby_aws 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f9b354b91b6387612b0f6dee19ea11e78773d929
4
- data.tar.gz: ce4724a563a416001758583ecc1fe2693122fd71
2
+ SHA256:
3
+ metadata.gz: 77814e6b155751f6f9008333ae24e48849522e3dc948ff983255a19534e29fc6
4
+ data.tar.gz: 551dd9f6bef0b52acdab49a6c7121627fb8fb6959ff119e6d3e00bf00dc292a9
5
5
  SHA512:
6
- metadata.gz: a4e9aefa9d7e36826ab34a3e8814f3974444f896a950ca425e22db97461e45e5f1e7ea4f5d4f3d8725fee7d5872acb9938bc3e08efd9adf99359b92ee98628a2
7
- data.tar.gz: '099bf6de690ea832484508c3223b83f7a82d7fd1bc2ded66a040481491a09674a0c373b1f18558a48737536fb38a19642577e63fa35b32851d78c5e642658268'
6
+ metadata.gz: d02db2c572ae6e19af365393ebc8e6d804b65d783e9ff80f72c2a820e8a2bc54443c6e4e32aeac9b32c8ec8057f8f106c1f4e5f249e1f95adc31c8023a87f8ef
7
+ data.tar.gz: bb0d956c1e085dd7c1ebb62d406fec5bc74938d8464c6f1a98698892086e5af6cae1a968e62f8d7b6bdbbbbf0e10fc3cd5ebb55b0d0b7952afcefa7864bb00aa
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # DefraRuby::Aws
1
+ # Defra Ruby Aws
2
2
 
3
- [![Build Status](https://travis-ci.com/DEFRA/defra-ruby-aws.svg?branch=master)](https://travis-ci.com/DEFRA/defra-ruby-aws)
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/4541a29b2c675b03a5ed/maintainability)](https://codeclimate.com/github/DEFRA/defra-ruby-aws/maintainability)
5
- [![Test Coverage](https://api.codeclimate.com/v1/badges/4541a29b2c675b03a5ed/test_coverage)](https://codeclimate.com/github/DEFRA/defra-ruby-aws/test_coverage)
6
- [![security](https://hakiri.io/github/DEFRA/defra-ruby-aws/master.svg)](https://hakiri.io/github/DEFRA/defra-ruby-aws/master)
3
+ [![Build Status](https://travis-ci.com/DEFRA/defra-ruby-aws.svg?branch=main)](https://travis-ci.com/DEFRA/defra-ruby-aws)
4
+ [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_defra-ruby-aws&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=DEFRA_defra-ruby-aws)
5
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=DEFRA_defra-ruby-aws&metric=coverage)](https://sonarcloud.io/dashboard?id=DEFRA_defra-ruby-aws)
6
+ [![security](https://hakiri.io/github/DEFRA/defra-ruby-aws/main.svg)](https://hakiri.io/github/DEFRA/defra-ruby-aws/main)
7
7
  [![Gem Version](https://badge.fury.io/rb/defra_ruby_aws.svg)](https://badge.fury.io/rb/defra_ruby_aws)
8
8
  [![Licence](https://img.shields.io/badge/Licence-OGLv3-blue.svg)](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3)
9
9
 
data/Rakefile CHANGED
@@ -11,7 +11,6 @@ Bundler::GemHelper.install_tasks
11
11
  # This is wrapped to prevent an error when rake is called in environments where
12
12
  # rspec may not be available, e.g. production. As such we don't need to handle
13
13
  # the error.
14
- # rubocop:disable Lint/HandleExceptions
15
14
  begin
16
15
  require "rspec/core/rake_task"
17
16
 
@@ -26,8 +25,9 @@ begin
26
25
  require "github_changelog_generator/task"
27
26
 
28
27
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
28
+ config.user = "defra"
29
+ config.project = "defra-ruby-aws"
29
30
  end
30
31
  rescue LoadError
31
32
  # no changelog available
32
33
  end
33
- # rubocop:enable Lint/HandleExceptions
@@ -6,9 +6,5 @@ require "defra_ruby/aws"
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
9
+ require "pry"
10
+ Pry.start
@@ -24,7 +24,7 @@ module DefraRuby
24
24
 
25
25
  def response_exe
26
26
  lambda do
27
- s3_bucket.object(File.basename(file.path)).upload_file(file.path, server_side_encryption: :AES256)
27
+ s3_bucket.object(File.basename(file.path)).upload_file(file.path, server_side_encryption: "aws:kms")
28
28
  end
29
29
  end
30
30
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module DefraRuby
4
4
  module Aws
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
@@ -1,17 +1,22 @@
1
- example_id | status | run_time |
2
- ----------------------------------------------------------------------- | ------ | --------------- |
3
- ./spec/defra_ruby_aws_spec.rb[1:1] | passed | 0.00122 seconds |
4
- ./spec/features/upload_file_to_bucket_spec.rb[1:1] | passed | 0.0124 seconds |
5
- ./spec/features/upload_file_to_bucket_spec.rb[1:2] | passed | 0.00574 seconds |
6
- ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:1:1:1] | passed | 0.00174 seconds |
7
- ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:1:2:1] | passed | 0.0001 seconds |
8
- ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:1:3:1] | passed | 0.00017 seconds |
9
- ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:1:4:1] | passed | 0.00014 seconds |
10
- ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:2:1] | passed | 0.00213 seconds |
11
- ./spec/lib/defra_ruby/aws/configuration_spec.rb[1:1:1] | passed | 0.00061 seconds |
12
- ./spec/lib/defra_ruby/aws/response_spec.rb[1:1:1:1] | passed | 0.00011 seconds |
13
- ./spec/lib/defra_ruby/aws/response_spec.rb[1:1:2:1] | passed | 0.00014 seconds |
14
- ./spec/lib/defra_ruby/aws/response_spec.rb[1:2:1:1] | passed | 0.0001 seconds |
15
- ./spec/lib/defra_ruby/aws/response_spec.rb[1:2:2:1] | passed | 0.00011 seconds |
16
- ./spec/lib/defra_ruby/aws/services/bucket_loader_service_spec.rb[1:1:1] | passed | 0.01269 seconds |
17
- ./spec/lib/defra_ruby/aws/services/presigned_url_service_spec.rb[1:1:1] | passed | 0.00368 seconds |
1
+ example_id | status | run_time |
2
+ ----------------------------------------------------------------------------------- | ------ | --------------- |
3
+ ./spec/defra_ruby_aws_spec.rb[1:1] | passed | 0.01013 seconds |
4
+ ./spec/features/upload_file_to_bucket_spec.rb[1:1] | passed | 0.01626 seconds |
5
+ ./spec/features/upload_file_to_bucket_spec.rb[1:2] | passed | 0.00509 seconds |
6
+ ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:1:1:1] | passed | 0.00012 seconds |
7
+ ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:1:2:1] | passed | 0.00011 seconds |
8
+ ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:1:3:1] | passed | 0.00121 seconds |
9
+ ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:1:4:1] | passed | 0.00011 seconds |
10
+ ./spec/lib/defra_ruby/aws/bucket_spec.rb[1:2:1] | passed | 0.0014 seconds |
11
+ ./spec/lib/defra_ruby/aws/configuration_spec.rb[1:1:1] | passed | 0.00066 seconds |
12
+ ./spec/lib/defra_ruby/aws/response_spec.rb[1:1:1:1] | passed | 0.00017 seconds |
13
+ ./spec/lib/defra_ruby/aws/response_spec.rb[1:1:2:1] | passed | 0.00011 seconds |
14
+ ./spec/lib/defra_ruby/aws/response_spec.rb[1:1:3:1] | passed | 0.0025 seconds |
15
+ ./spec/lib/defra_ruby/aws/response_spec.rb[1:1:4:1] | passed | 0.00013 seconds |
16
+ ./spec/lib/defra_ruby/aws/response_spec.rb[1:1:5:1] | passed | 0.00014 seconds |
17
+ ./spec/lib/defra_ruby/aws/response_spec.rb[1:2:1:1] | passed | 0.00088 seconds |
18
+ ./spec/lib/defra_ruby/aws/response_spec.rb[1:2:2:1] | passed | 0.0001 seconds |
19
+ ./spec/lib/defra_ruby/aws/services/bucket_loader_service_spec.rb[1:1:1] | passed | 0.00061 seconds |
20
+ ./spec/lib/defra_ruby/aws/services/delete_file_from_bucket_service_spec.rb[1:1:1] | passed | 0.00875 seconds |
21
+ ./spec/lib/defra_ruby/aws/services/delete_file_from_bucket_service_spec.rb[1:1:2:1] | passed | 0.00067 seconds |
22
+ ./spec/lib/defra_ruby/aws/services/presigned_url_service_spec.rb[1:1:1] | passed | 0.00408 seconds |
@@ -37,13 +37,13 @@ RSpec.describe "Defra Ruby AWS" do
37
37
  end
38
38
 
39
39
  def stub_successful_request
40
- stub_request(:put, %r{https:\/\/bulk-test\.s3\.eu-west-1\.amazonaws\.com\/test-bucket-load\..+})
40
+ stub_request(:put, %r{https://bulk-test\.s3\.eu-west-1\.amazonaws\.com/test-bucket-load\..+})
41
41
  end
42
42
 
43
43
  def stub_failing_request
44
44
  stub_request(
45
45
  :put,
46
- %r{https:\/\/bulk-test\.s3\.eu-west-1\.amazonaws\.com\/test-bucket-load\..+}
46
+ %r{https://bulk-test\.s3\.eu-west-1\.amazonaws\.com/test-bucket-load\..+}
47
47
  ).to_return(
48
48
  status: 403
49
49
  )
@@ -27,7 +27,7 @@ module DefraRuby
27
27
  expect(::Aws::S3::Resource).to receive(:new).and_return(aws_resource)
28
28
  expect(aws_resource).to receive(:bucket).with("bulk").and_return(s3_bucket)
29
29
  expect(s3_bucket).to receive(:object).with("test.csv").and_return(s3_object)
30
- expect(s3_object).to receive(:upload_file).with("foo/bar/baz/test.csv", server_side_encryption: :AES256).and_return(result)
30
+ expect(s3_object).to receive(:upload_file).with("foo/bar/baz/test.csv", server_side_encryption: "aws:kms").and_return(result)
31
31
 
32
32
  expect(described_class.run(bucket, file)).to be_a(Response)
33
33
  end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Need to require our actual code files.
4
+ require "defra_ruby/aws"
@@ -7,6 +7,10 @@ require "simplecov"
7
7
  # This gives us the most accurate assessment of our unit test coverage
8
8
  # https://github.com/colszowka/simplecov#getting-started
9
9
  SimpleCov.start do
10
+ # We filter the spec folder, mainly to ensure that any dummy apps don't get
11
+ # included in the coverage report. However our intent is that nothing in the
12
+ # spec folder should be included
13
+ add_filter "/spec/"
10
14
  # The version file is simply just that, so we do not feel the need to ensure
11
15
  # we have a test for it
12
16
  add_filter "lib/defra_ruby/aws/version"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: defra_ruby_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Defra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-16 00:00:00.000000000 Z
11
+ date: 2020-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 0.17.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 0.17.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: webmock
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -168,6 +168,7 @@ files:
168
168
  - spec/lib/defra_ruby/aws/services/presigned_url_service_spec.rb
169
169
  - spec/spec_helper.rb
170
170
  - spec/support/aws_sdk_s3.rb
171
+ - spec/support/defra_ruby_aws.rb
171
172
  - spec/support/dotenv.rb
172
173
  - spec/support/pry.rb
173
174
  - spec/support/simplecov.rb
@@ -192,8 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
193
  - !ruby/object:Gem::Version
193
194
  version: '0'
194
195
  requirements: []
195
- rubyforge_project:
196
- rubygems_version: 2.6.13
196
+ rubygems_version: 3.0.0
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Defra ruby on rails AWS helpers
@@ -202,6 +202,7 @@ test_files:
202
202
  - spec/spec_helper.rb
203
203
  - spec/examples.txt
204
204
  - spec/features/upload_file_to_bucket_spec.rb
205
+ - spec/support/defra_ruby_aws.rb
205
206
  - spec/support/aws_sdk_s3.rb
206
207
  - spec/support/simplecov.rb
207
208
  - spec/support/webmock.rb