pigeon-ruby 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a802bf8045b08a1f9944159be36e22ce21dc579b7ee15651d0d9feaf08896a0
4
- data.tar.gz: 79d640424a8254370b15166568830c3983123b4bb5e867138d70877950dd7bd8
3
+ metadata.gz: 2dac127a5ea1a527e870c52772625f5874b7b81175dd0b8c12450cff63c6a847
4
+ data.tar.gz: 7daa4c1bc8ff6927cce63522fd5216b111bbbe99d58b4589d2cb3353e624e87e
5
5
  SHA512:
6
- metadata.gz: 7b0b704ac834649397a1e5f7cfa53f9e4b0a6b133254a2bd38e08d3238fc74666ac35afdfc46fa00bcef05613c251076704e5bd60e004d5c705b18f27aaed9af
7
- data.tar.gz: a9f31cb6f54618e201ad51688dfbac99a96271e51d50d04c02f91f218efcdbb49da8a5de3b27a15d35af977e9e940345051456f7793826a986a70708a9ab31d0
6
+ metadata.gz: 927197a29a9f5d577b8c3e043937a83065f31f02a66dfc6a4b563bc0b1d88a3000543910c722314fa576f9f69690cd892620941b7be90fe3dfe26a29592ccdd6
7
+ data.tar.gz: a477a73e12b3d16145df8c3868b23168eb5167993ef2f2e0ffa0c4f59d7ff29ef6ce1d99cc3c99d74a1f01246681ec05201f15ada22fedde1749fa5a3b29b893
@@ -58,20 +58,22 @@ module Pigeon
58
58
 
59
59
  check_presence!(attrs[:to], 'Recipient')
60
60
 
61
- (attrs[:attachments] || []).each do |attachment|
62
- next unless File.file?(attachment[:file])
63
-
64
- prepare_attachment_content(attachment)
65
- end
61
+ (attrs[:attachments] || []).each { |attachment| prepare_attachment_content(attachment) }
66
62
 
67
63
  attrs
68
64
  end
69
65
 
70
66
  def prepare_attachment_content(attachment)
71
- file = attachment[:file]
72
- file = File.open(file) if file.is_a? String
73
- attachment[:content] = Base64.strict_encode64(file.read)
74
- attachment[:name] ||= File.basename(file, '.*')
67
+ attachment_file = attachment[:file]
68
+
69
+ if File.file?(attachment_file)
70
+ file = File.open(attachment_file)
71
+ attachment[:content] = Base64.strict_encode64(file.read)
72
+ attachment[:name] ||= File.basename(file, '.*')
73
+ else
74
+ attachment[:content] = attachment_file
75
+ end
76
+
75
77
  attachment.delete(:file)
76
78
  end
77
79
 
@@ -1,3 +1,3 @@
1
1
  module Pigeon
2
- VERSION = '0.6.3'
2
+ VERSION = '0.6.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pigeon-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pradeep Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-27 00:00:00.000000000 Z
11
+ date: 2020-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.0.6
111
+ rubygems_version: 3.0.8
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Pigeon Ruby Library