aws-sdk-rails 3.7.0 → 3.8.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
2
  SHA256:
3
- metadata.gz: e4a36f06cb28402d5c089672aa4e88a7ec087d61496c5d2f2855a61c11b3ca4b
4
- data.tar.gz: 19f617df06780135dd75d1f6e76911c2104f8b3f2201b0654b97d29a2fd61bbc
3
+ metadata.gz: 5157818d7cbed8369158102676415247809f388f88f255890c513705075193eb
4
+ data.tar.gz: 792018ac311693ce6afa82b8ae1c7547bf858a90959558f2547dcfc173cefdbe
5
5
  SHA512:
6
- metadata.gz: 4d0fb987757cb4b86b660e3180355a8d9870df3f85798f4ab1d085cd03fb448cba686438f0ee7bc96687daeac5faeeee44e8bdf0e88097c243d70bf1531dd0c5
7
- data.tar.gz: ad77218a0c85cf43fe3eb8123dedd52d7914bdbfa6323a46299b743c97340edf5fe59774efae0fece141b9ae4e02949e2d17ad2cb00bb119e514e6367442c929
6
+ metadata.gz: 7c0821bb9dffd184a6f21c51bc6ed5a000dd1a1f5d0a435ccd5d36668f41d95f2be3e834482f20216b83edfac47d763c25d100386efcb87b9e8a64185b2644e9
7
+ data.tar.gz: be49eeaf3fa701769204a924dcfef6982360dc15387266a5d0e8ae8f8c1c44afb0b383669531799f8daabe2af65372ac37a7dbdf671ee9ba522ecd141a0f0ab8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.0
1
+ 3.8.0
@@ -81,12 +81,30 @@ module Aws
81
81
  end
82
82
 
83
83
  def sent_from_docker_host?(request)
84
- app_runs_in_docker_container? && request.ip == '172.17.0.1'
84
+ app_runs_in_docker_container? && default_gw_ips.include?(request.ip)
85
85
  end
86
86
 
87
87
  def app_runs_in_docker_container?
88
88
  @app_runs_in_docker_container ||= `[ -f /proc/1/cgroup ] && cat /proc/1/cgroup` =~ /docker/
89
89
  end
90
+
91
+ def default_gw_ips
92
+ default_gw_ips = ['172.17.0.1']
93
+
94
+ if File.exist?('/proc/net/route')
95
+ File.open('/proc/net/route').each_line do |line|
96
+ fields = line.strip.split
97
+ next if fields.size != 11
98
+
99
+ # Destination == 0.0.0.0 and Flags & RTF_GATEWAY != 0
100
+ if fields[1] == '00000000' && (fields[3].hex & 0x2) != 0
101
+ default_gw_ips << IPAddr.new_ntoh([fields[2].hex].pack('L')).to_s
102
+ end
103
+ end
104
+ end
105
+
106
+ default_gw_ips
107
+ end
90
108
  end
91
109
  end
92
110
  end
@@ -20,6 +20,7 @@ module Aws
20
20
  # [Aws::SES::Client.new](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SES/Client.html#initialize-instance_method).
21
21
  def initialize(options = {})
22
22
  @client = SES::Client.new(options)
23
+ @client.config.user_agent_frameworks << 'aws-sdk-rails'
23
24
  end
24
25
 
25
26
  # Rails expects this method to exist, and to handle a Mail::Message object
@@ -20,17 +20,23 @@ module Aws
20
20
  # [Aws::SESV2::Client.new](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SESV2/Client.html#initialize-instance_method).
21
21
  def initialize(options = {})
22
22
  @client = SESV2::Client.new(options)
23
+ @client.config.user_agent_frameworks << 'aws-sdk-rails'
23
24
  end
24
25
 
25
26
  # Rails expects this method to exist, and to handle a Mail::Message object
26
27
  # correctly. Called during mail delivery.
27
28
  def deliver!(message)
28
- params = {
29
- content: { raw: { data: message.to_s } },
30
- from_email_address: message.smtp_envelope_from, # defaults to From header
31
- # defaults to destinations (To,Cc,Bcc) - stick all on bcc to be delivered anyway
32
- destination: { bcc_addresses: message.smtp_envelope_to }
29
+ params = { content: { raw: { data: message.to_s } } }
30
+ # smtp_envelope_from will default to the From address *without* sender names.
31
+ # By omitting this param, SESv2 will correctly use sender names from the mail headers.
32
+ # We should only use smtp_envelope_from when it was explicitly set (instance variable set)
33
+ params[:from_email_address] = message.smtp_envelope_from if message.instance_variable_get(:@smtp_envelope_from)
34
+ params[:destination] = {
35
+ to_addresses: to_addresses(message),
36
+ cc_addresses: message.cc,
37
+ bcc_addresses: message.bcc
33
38
  }
39
+
34
40
  @client.send_email(params).tap do |response|
35
41
  message.header[:ses_message_id] = response.message_id
36
42
  end
@@ -40,6 +46,15 @@ module Aws
40
46
  def settings
41
47
  {}
42
48
  end
49
+
50
+ private
51
+
52
+ # smtp_envelope_to will default to the full destinations (To, Cc, Bcc)
53
+ # SES v2 API prefers each component split out into a destination hash.
54
+ # When smtp_envelope_to was set, use it explicitly for to_address only.
55
+ def to_addresses(message)
56
+ message.instance_variable_get(:@smtp_envelope_to) ? message.smtp_envelope_to : message.to
57
+ end
43
58
  end
44
59
  end
45
60
  end
@@ -92,7 +92,11 @@ module Aws
92
92
  end
93
93
 
94
94
  def client
95
- @client ||= Aws::SQS::Client.new(user_agent_suffix: user_agent)
95
+ @client ||= begin
96
+ client = Aws::SQS::Client.new
97
+ client.config.user_agent_frameworks << 'aws-sdk-rails'
98
+ client
99
+ end
96
100
  end
97
101
 
98
102
  # Return the queue_url for a given job_queue name
@@ -125,6 +129,7 @@ module Aws
125
129
  def set_attributes(options)
126
130
  options.keys.each do |opt_name|
127
131
  instance_variable_set("@#{opt_name}", options[opt_name])
132
+ client.config.user_agent_frameworks << 'aws-sdk-rails' if opt_name == :client
128
133
  end
129
134
  end
130
135
 
@@ -154,10 +159,6 @@ module Aws
154
159
  options[:config_file] || ENV["AWS_SQS_ACTIVE_JOB_CONFIG_FILE"]
155
160
  end
156
161
 
157
- def user_agent
158
- "ft/aws-sdk-rails-activejob/#{Aws::Rails::VERSION}"
159
- end
160
-
161
162
  def load_yaml(file_path)
162
163
  require "erb"
163
164
  source = ERB.new(File.read(file_path)).result
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-record
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.50.0
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
43
  version: '1'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.50.0
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: aws-sdk-sesv2
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +51,9 @@ dependencies:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
53
  version: '1'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 1.34.0
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +61,9 @@ dependencies:
52
61
  - - "~>"
53
62
  - !ruby/object:Gem::Version
54
63
  version: '1'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 1.34.0
55
67
  - !ruby/object:Gem::Dependency
56
68
  name: aws-sdk-sqs
57
69
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +71,9 @@ dependencies:
59
71
  - - "~>"
60
72
  - !ruby/object:Gem::Version
61
73
  version: '1'
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 1.56.0
62
77
  type: :runtime
63
78
  prerelease: false
64
79
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +81,9 @@ dependencies:
66
81
  - - "~>"
67
82
  - !ruby/object:Gem::Version
68
83
  version: '1'
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 1.56.0
69
87
  - !ruby/object:Gem::Dependency
70
88
  name: aws-sessionstore-dynamodb
71
89
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
197
  - !ruby/object:Gem::Version
180
198
  version: '0'
181
199
  requirements: []
182
- rubygems_version: 3.2.7
200
+ rubygems_version: 3.4.10
183
201
  signing_key:
184
202
  specification_version: 4
185
203
  summary: AWS SDK for Ruby on Rails Plugin