fde-mail_sender 0.3.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 889f32b1e0abcdab9ffb8a6ad9a7e88f96160333
4
+ data.tar.gz: 51c8c9c69f90cb488d4eed6e01037dee5ae789a3
5
+ SHA512:
6
+ metadata.gz: f9e815b22890743094c3e94ff5885e274ae5c7fa1a7d0666c77612d7d867a13275c84804b79e3225d7fe6e00806290bbf401ca10c1d2412f931d4b8e6eb45ce1
7
+ data.tar.gz: f9d070b58cefe6263b0baec31108451e34b23569e419ef4fd28722b275b09340302b6ad313b689991d11965a8ff30334ea54bbfc2c6af6cd14fd38dfde76df66
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ .DS-Store
15
+
16
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.test.env ADDED
@@ -0,0 +1,7 @@
1
+ SMTP_MAIL_ADDRESS="mail.example.com"
2
+ SMTP_MAIL_PORT=25
3
+ SMTP_MAIL_DOMAIN="example.com"
4
+ SMTP_MAIL_USER_NAME="example@example.com"
5
+ SMTP_MAIL_PASSWORD="secret"
6
+ SMTP_MAIL_AUTHENTICATION="plain"
7
+ SMTP_MAIL_ENABLE_STARTTLS_AUTO=false
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.15.4
6
+
7
+ notifications:
8
+ slack: fadendaten:tWoet2mtObvbwSZSyUAY93jl
9
+ email: false
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Felix Langenegger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ [![Gem Version](https://badge.fury.io/rb/fde-mail_sender.svg)](https://badge.fury.io/rb/fde-mail_sender)
2
+ [![Build Status](https://travis-ci.org/fashion-data-exchange/mail_sender.svg?branch=master)](https://travis-ci.org/fashion-data-exchange/mail_sender)
3
+ [![Code Climate](https://codeclimate.com/github/fashion-data-exchange/mail_sender/badges/gpa.svg)](https://codeclimate.com/github/fashion-data-exchange/mail_sender)
4
+ # MailSender
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "fde/mail_sender"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
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__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "fde/mail_sender/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fde-mail_sender"
8
+ spec.version = FDE::MailSender::VERSION
9
+ spec.authors = ["Felix Langenegger"]
10
+ spec.email = ["f.langenegger@fadendaten.ch"]
11
+
12
+ spec.summary = %q{A EDI Mail Sender}
13
+ spec.description = %q{A Simple tool to send edi file via mail}
14
+ spec.homepage = "https://github.com/fashion-data-exchange/edi-mail_sender"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_runtime_dependency 'mail', '~> 2.6', '>= 2.6.6'
34
+ spec.add_runtime_dependency "dotenv", "~> 2.2", ">= 2.2.1"
35
+
36
+ spec.add_development_dependency "bundler", "~> 1.15"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency "pry", "~> 0.10"
40
+ spec.add_development_dependency "pry-remote", "~> 0.1"
41
+ spec.add_development_dependency "pry-nav", "~> 0.2"
42
+ end
@@ -0,0 +1,35 @@
1
+ module FDE
2
+ class Mail
3
+ attr_accessor :from, :to, :subject, :body, :attachment, :mail
4
+
5
+ def initialize(from, to, subject, body, attachment)
6
+ @from = from
7
+ @to = to
8
+ @subject = subject
9
+ @body = body
10
+ @attachment = attachment
11
+ build
12
+ end
13
+
14
+ def build
15
+ from = @from
16
+ to = @to
17
+ subject = @subject
18
+ body = @body
19
+ filename = File.basename(@attachment)
20
+ content = File.read(@attachment)
21
+
22
+ @mail = ::Mail.new do
23
+ from(from)
24
+ to(to)
25
+ subject(subject)
26
+ body(body)
27
+ add_file(filename: filename, content: content)
28
+ end
29
+ end
30
+
31
+ def deliver!
32
+ FDE::MailSender.smtp_account.deliver!(@mail)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ module FDE
2
+ module MailSender
3
+ VERSION = "0.3.0"
4
+ end
5
+ end
@@ -0,0 +1,44 @@
1
+ require 'fde/mail_sender/version'
2
+ require 'fde/mail_sender/mail'
3
+ require 'mail'
4
+
5
+ module FDE
6
+ module MailSender
7
+ class Config
8
+ attr_accessor :address,
9
+ :port,
10
+ :domain,
11
+ :user_name,
12
+ :password,
13
+ :authentication,
14
+ :enable_starttls_auto,
15
+ :from
16
+
17
+ def attributes
18
+ {
19
+ address: @address,
20
+ port: @port,
21
+ domain: @domain,
22
+ user_name: @user_name,
23
+ password: @password,
24
+ authentication: @authentication,
25
+ enable_starttls_auto: @enable_starttls_auto
26
+ }
27
+ end
28
+ end
29
+
30
+ def self.config
31
+ @@config ||= Config.new
32
+ end
33
+
34
+ def self.smtp_account
35
+ @@smtp ||= ::Mail.defaults do
36
+ delivery_method :smtp, FDE::MailSender.config.attributes
37
+ end
38
+ end
39
+
40
+ def self.configure
41
+ yield self.config
42
+ end
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fde-mail_sender
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Felix Langenegger
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-09-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mail
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.6'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.6.6
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.6'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.6.6
33
+ - !ruby/object:Gem::Dependency
34
+ name: dotenv
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.2'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.2.1
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '2.2'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.2.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: bundler
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.15'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '1.15'
67
+ - !ruby/object:Gem::Dependency
68
+ name: rake
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '10.0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '10.0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: rspec
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '3.0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '3.0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: pry
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '0.10'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '0.10'
109
+ - !ruby/object:Gem::Dependency
110
+ name: pry-remote
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '0.1'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '0.1'
123
+ - !ruby/object:Gem::Dependency
124
+ name: pry-nav
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '0.2'
130
+ type: :development
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '0.2'
137
+ description: A Simple tool to send edi file via mail
138
+ email:
139
+ - f.langenegger@fadendaten.ch
140
+ executables: []
141
+ extensions: []
142
+ extra_rdoc_files: []
143
+ files:
144
+ - ".gitignore"
145
+ - ".rspec"
146
+ - ".test.env"
147
+ - ".travis.yml"
148
+ - Gemfile
149
+ - LICENSE.txt
150
+ - README.md
151
+ - Rakefile
152
+ - bin/console
153
+ - bin/setup
154
+ - fde-mail_sender.gemspec
155
+ - lib/fde/mail_sender.rb
156
+ - lib/fde/mail_sender/mail.rb
157
+ - lib/fde/mail_sender/version.rb
158
+ homepage: https://github.com/fashion-data-exchange/edi-mail_sender
159
+ licenses:
160
+ - MIT
161
+ metadata:
162
+ allowed_push_host: https://rubygems.org
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubyforge_project:
179
+ rubygems_version: 2.6.8
180
+ signing_key:
181
+ specification_version: 4
182
+ summary: A EDI Mail Sender
183
+ test_files: []