maileva 0.1.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: d8ca9ba68df975a784e13aeab62b11624890aeff
4
+ data.tar.gz: a64e42a7244fc5a87be7d84ff8591aea06e3be83
5
+ SHA512:
6
+ metadata.gz: 561e961547f2e3127c52fa467c64e17fa0d2aafe1a7ac78cc3a069bce4ca4712ce0d61ae05b1c291c38e0bf51ed395c9acc82561819b77711dfb51e44ee74c0f
7
+ data.tar.gz: 86a87d330a994d6465b25b34c3ddf3069546700d2e578a5c04a832cd6cd3f032a68b2c2ab47ee0a6250607d37d226ee066d56d080485d9c72777fd4d13c772c2
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright © 2016, Kévin Lesénéchal <kevin.lesenechal@gmail.com>
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its contributors
15
+ may be used to endorse or promote products derived from this software
16
+ without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Maileva API #
2
+
3
+ This gem allows you to send postal mails through the **Maileva** system (of La Poste).
4
+
5
+ ## Installation ##
6
+
7
+ Put this in your `Gemfile`:
8
+
9
+ gem 'maileva'
10
+
11
+ To include all the necessary classes, do:
12
+
13
+ require 'maileva'
14
+
15
+ ## Configuration ##
16
+
17
+ Use `Maileva.config` to configure the default settings of the API like your
18
+ Maileva credentials. Example:
19
+
20
+ Maileva.config.ftp_login = "my_login"
21
+
22
+ The available configuration variables are:
23
+
24
+ * `files_root`: (`Pathname`, not `String`!) A directory where temporary PDF files
25
+ to send will be stored;
26
+ * `ftp_login`: (`String`) Your Maileva FTP login;
27
+ * `ftp_password`: (`String`) Your Maileva FTP password;
28
+ * `client_id`: (`String`) Your Maileva client ID;
29
+ * `confirmation_threshold`: (Integer, optional) The maximum number of files which
30
+ can be sent without confirmation. Default: 100.
31
+
32
+ ### Setting rules ###
33
+
@@ -0,0 +1,27 @@
1
+ module CoreExtensions
2
+ module Net
3
+ module FTP
4
+ module Maileva
5
+ def file_exists?(path)
6
+ begin
7
+ size(path)
8
+ return true
9
+ rescue Net::FTPError => e
10
+ err_code = e.message[0, 3].to_i
11
+ raise "SIZE unimplemented on server" if err_code == 500 or err_code == 502
12
+ return false
13
+ end
14
+ end
15
+
16
+ def putstr(str, remote, &block)
17
+ f = StringIO.new(str)
18
+ begin
19
+ storlines("STOR #{remote}", f, &block)
20
+ ensure
21
+ f.close
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
data/lib/maileva.rb ADDED
@@ -0,0 +1,67 @@
1
+ # Copyright © 2016, Kévin Lesénéchal <kevin.lesenechal@gmail.com>.
2
+ #
3
+ # This library is licensed under the new BSD license. Checkout the license text
4
+ # in the LICENSE file or online at <http://opensource.org/licenses/BSD-3-Clause>.
5
+
6
+ require 'core_extensions/net/ftp/maileva'
7
+ require 'double_bag_ftps'
8
+ require 'ostruct'
9
+
10
+ Net::FTP.include CoreExtensions::Net::FTP::Maileva
11
+
12
+ module Maileva
13
+ @@config = OpenStruct.new({
14
+ files_root: nil,
15
+ ftp_login: nil,
16
+ ftp_password: nil,
17
+ client_id: nil,
18
+ confirmation_threshold: 100
19
+ })
20
+
21
+ @@confirmation_callbacks = []
22
+ @@processing_callbacks = []
23
+ @@done_callbacks = []
24
+ @@failure_callbacks = []
25
+
26
+ @@rules = {}
27
+ @@batches_in_process = []
28
+
29
+ BATCHES_IN_PROCESS_MUTEX = Mutex.new
30
+
31
+ def self.config
32
+ @@config
33
+ end
34
+
35
+ def self.rules
36
+ @@rules
37
+ end
38
+
39
+ def self.batches_in_process
40
+ @@batches_in_process
41
+ end
42
+
43
+ def self.add_rule(name, opts)
44
+ raise ArgumentError, "name: expecting string" if !name.is_a?(Symbol)
45
+ raise ArgumentError, "Expecting option 'id'" if !opts.key?(:id)
46
+
47
+ @@rules[name] = opts
48
+ end
49
+
50
+ def self.on_confirmation_needed(&block)
51
+ @@confirmation_callbacks << block
52
+ end
53
+
54
+ def self.on_batch_processing(&block)
55
+ @@processing_callbacks << block
56
+ end
57
+
58
+ def self.on_batch_sent(&block)
59
+ @@done_callbacks << block
60
+ end
61
+
62
+ def self.on_batch_failure(&block)
63
+ @@failure_callbacks << block
64
+ end
65
+ end
66
+
67
+ require 'maileva/batch'
@@ -0,0 +1,138 @@
1
+ # Copyright © 2016, Kévin Lesénéchal <kevin.lesenechal@gmail.com>.
2
+ #
3
+ # This library is licensed under the new BSD license. Checkout the license text
4
+ # in the LICENSE file or online at <http://opensource.org/licenses/BSD-3-Clause>.
5
+
6
+ require 'double_bag_ftps'
7
+
8
+ class Maileva::Batch
9
+ attr_accessor :type, :name
10
+ attr_reader :files, :rule
11
+
12
+ PART_SIZE = 30
13
+
14
+ def initialize(type, name)
15
+ raise ArgumentError, "Invalid Maileva batch type '#{type}'" unless type.is_a?(Symbol) and Maileva.rules.key?(type)
16
+
17
+ @type = type
18
+ @name = name
19
+ @rule = Maileva.rules[@type]
20
+ @files = []
21
+ end
22
+
23
+ def append_file(*files)
24
+ files.each do |file|
25
+ if file.is_a? Array
26
+ file.each{|f| append_file(f)}
27
+ return
28
+ end
29
+
30
+ raise ArgumentError, "Expecting string for 'file'" unless file.is_a?(String)
31
+ raise "#{file}: no such file for batch '#{@name}' (#{@type})" unless File.file?(file)
32
+ raise "#{file}: expecting .pdf" unless File.extname(file) == ".pdf"
33
+
34
+ @files << file
35
+ end
36
+ end
37
+ alias << append_file
38
+
39
+ def tmp_dir
40
+ return Maileva.config.files_root + @type.to_s + @name
41
+ end
42
+
43
+ def uploaded_count
44
+ return @uploaded_remote_names.size
45
+ end
46
+
47
+ def send
48
+ if @files.size < Maileva.config.confirmation_threshold
49
+ send!
50
+ else
51
+ FileUtils.mkdir_p tmp_dir unless File.directory?(tmp_dir)
52
+ @files.each do |file|
53
+ FileUtils.cp file, tmp_dir + File.basename(file) unless file.start_with? tmp_dir.to_s
54
+ end
55
+
56
+ Maileva.class_variable_get(:@@confirmation_callbacks).each{|proc| proc.call(self)}
57
+ end
58
+ end
59
+
60
+ def send!(in_db: false)
61
+ raise "Cannot send empty batch" if @files.size == 0
62
+
63
+ Maileva.class_variable_get(:@@processing_callbacks).each{|proc| proc.call(self, in_db)}
64
+
65
+ @uploaded_remote_names = []
66
+ @uploaded_part_names = []
67
+
68
+ Maileva::BATCHES_IN_PROCESS_MUTEX.synchronize{ Maileva.batches_in_process << self }
69
+
70
+ ftp = nil
71
+ begin
72
+ ftp = DoubleBagFTPS.new
73
+ ftp.passive = true
74
+ ftp.connect("ftps.maileva.com", 21)
75
+ ftp.login(Maileva.config.ftp_login, Maileva.config.ftp_password)
76
+
77
+ begin
78
+ part_no = 1
79
+ @files.each_slice(PART_SIZE) do |part|
80
+ send_part(ftp, part, part_no)
81
+ part_no += 1
82
+ end
83
+
84
+ @uploaded_part_names.each do |part|
85
+ ftp.rename part + ".tmp", part + ".flw"
86
+ end
87
+ rescue Exception => e
88
+ rollback!(ftp)
89
+ raise e
90
+ end
91
+
92
+ Maileva.class_variable_get(:@@done_callbacks).each{|proc| proc.call(self)}
93
+ rescue Exception => e
94
+ Maileva.class_variable_get(:@@failure_callbacks).each{|proc| proc.call(self)}
95
+ raise e
96
+ ensure
97
+ Maileva::BATCHES_IN_PROCESS_MUTEX.synchronize{ Maileva.batches_in_process.delete(self) }
98
+ begin; ftp.close unless ftp.nil? or ftp.closed? rescue Exception; end
99
+ end
100
+ end
101
+
102
+ private
103
+
104
+ def send_part(ftp, part, part_no)
105
+ part_name = sprintf "%s_%s_%d", @type, @name, part_no
106
+ cmd_file_name = part_name + ".tmp"
107
+ cmd_file = "CLIENT_ID=#{Maileva.config.client_id}\n" +
108
+ "NB_FILE=#{part.size}\n" +
109
+ "GATEWAY=FLOW\n" +
110
+ "FLOW_RULE=#{@rule[:id]}\n"
111
+ raise "Command file '#{cmd_file_name}' already exists on server" if ftp.file_exists?(cmd_file_name)
112
+ ftp.putstr "", cmd_file_name
113
+ @uploaded_part_names << part_name
114
+
115
+ file_no = 1
116
+ part.each do |file|
117
+ file_name = sprintf "%s.%03d", part_name, file_no
118
+ cmd_file += "FILE_NAME_#{file_no}=#{file_name}\n" +
119
+ "FILE_SIZE_#{file_no}=#{File.size(file)}\n"
120
+ ftp.put file, file_name
121
+ Maileva::BATCHES_IN_PROCESS_MUTEX.synchronize{ @uploaded_remote_names << file_name }
122
+ file_no += 1
123
+ end
124
+ ftp.putstr cmd_file, cmd_file_name
125
+ end
126
+
127
+ def rollback!(ftp)
128
+ @uploaded_part_names.each do |part|
129
+ begin; ftp.delete part + ".flw" rescue Exception; end
130
+ end
131
+ @uploaded_part_names.each do |part|
132
+ begin; ftp.delete part + ".tmp" rescue Exception; end
133
+ end
134
+ @uploaded_remote_names.each do |file|
135
+ begin; ftp.delete file rescue Exception; end
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,175 @@
1
+ # Copyright © 2016, Kévin Lesénéchal <kevin.lesenechal@gmail.com>.
2
+ #
3
+ # This library is licensed under the new BSD license. Checkout the license text
4
+ # in the LICENSE file or online at <http://opensource.org/licenses/BSD-3-Clause>.
5
+
6
+ require 'spec_helper'
7
+ require 'maileva'
8
+ require 'double_bag_ftps'
9
+ require 'fileutils'
10
+ require 'pathname'
11
+
12
+ RSpec.describe Maileva::Batch do
13
+ before do
14
+ Maileva.class_variable_set(:@@rules, {})
15
+ Maileva.add_rule :grids, id: "bar", name: "baz"
16
+ end
17
+
18
+ it "adds files" do
19
+ expect(File).to receive(:file?).at_least(:once).and_return(true)
20
+
21
+ batch = Maileva::Batch.new(:grids, "my_batch")
22
+ expect {
23
+ batch.append_file "lorem.pdf"
24
+ batch.append_file "ipsum.pdf", "dolor.pdf"
25
+ batch << "sit.pdf"
26
+ batch << %w(amet.pdf consectetur.pdf adipiscing.pdf)
27
+ }.to change{ batch.files }.from([]).to(%w(lorem.pdf ipsum.pdf dolor.pdf sit.pdf amet.pdf consectetur.pdf adipiscing.pdf))
28
+ end
29
+
30
+ it "has a temp directory" do
31
+ Maileva.config.files_root = Pathname.new("/my/maileva/files")
32
+ batch = Maileva::Batch.new(:grids, "my_batch")
33
+ expect(batch.tmp_dir).to eq Pathname.new("/my/maileva/files/grids/my_batch")
34
+ end
35
+
36
+ it "rejects non-existing files" do
37
+ expect(File).to receive(:file?).with("non_existing.pdf").and_return(false)
38
+
39
+ batch = Maileva::Batch.new(:grids, "my_batch")
40
+ expect {
41
+ batch << "non_existing.pdf"
42
+ }.to raise_error("non_existing.pdf: no such file for batch 'my_batch' (grids)")
43
+ end
44
+
45
+ it "rejects non-PDF files" do
46
+ expect(File).to receive(:file?).with("invalid_file.png").and_return(true)
47
+
48
+ batch = Maileva::Batch.new(:grids, "my_batch")
49
+ expect {
50
+ batch << "invalid_file.png"
51
+ }.to raise_error("invalid_file.png: expecting .pdf")
52
+ end
53
+
54
+ it "sends batches if under threshold" do
55
+ expect(File).to receive(:file?).at_least(:once).and_return(true)
56
+
57
+ Maileva.config.confirmation_threshold = 100
58
+ batch = Maileva::Batch.new(:grids, "my_batch")
59
+ batch << "hello.pdf" << "world.pdf"
60
+ expect(batch).to receive(:send!)
61
+ batch.send
62
+ end
63
+
64
+ it "asks confirmation if above threshold" do
65
+ expect(File).to receive(:file?).at_least(:once).and_return(true)
66
+
67
+ Maileva.config.confirmation_threshold = 2
68
+ batch = Maileva::Batch.new(:grids, "my_batch")
69
+ batch << 5.times.map{|i| "file#{i + 1}.pdf"}.each do |file|
70
+ expect(FileUtils).to receive(:cp).with(file, batch.tmp_dir + file)
71
+ end
72
+ confirm_cb = proc{}
73
+ Maileva.on_confirmation_needed &confirm_cb
74
+
75
+ expect(batch.files.size).to eq 5
76
+ expect(File).to receive(:directory?).with(batch.tmp_dir).and_return(false)
77
+ expect(FileUtils).to receive(:mkdir_p).with(batch.tmp_dir)
78
+ expect(confirm_cb).to receive(:call).with(batch)
79
+ batch.send
80
+ end
81
+
82
+ it "sends files to Maileva" do
83
+ command_files = {}
84
+ confirmed_cmds = []
85
+ uploaded_files = []
86
+
87
+ Maileva.config.ftp_login = "my_login"
88
+ Maileva.config.ftp_password = "my_pass"
89
+ Maileva.config.client_id = "my_client_id"
90
+
91
+ expect(File).to receive(:file?).at_least(34).times.and_return(true)
92
+ expect(File).to receive(:size).at_least(34).times.and_return(14556)
93
+ expect_any_instance_of(DoubleBagFTPS).to receive(:putstr).at_least(:once) do |ftp, str, remote|
94
+ command_files[remote] = str
95
+ end
96
+ expect_any_instance_of(DoubleBagFTPS).to receive(:put).at_least(:once) do |ftp, local, remote|
97
+ uploaded_files << remote
98
+ end
99
+ expect_any_instance_of(DoubleBagFTPS).to receive(:rename).at_least(:once) do |ftp, from, to|
100
+ confirmed_cmds << from
101
+ end
102
+ expect_any_instance_of(DoubleBagFTPS).to receive(:file_exists?).twice.and_return(false)
103
+ expect_any_instance_of(DoubleBagFTPS).to receive(:connect).with("ftps.maileva.com", 21)
104
+ expect_any_instance_of(DoubleBagFTPS).to receive(:login).with("my_login", "my_pass")
105
+
106
+ batch = Maileva::Batch.new(:grids, "my_batch")
107
+ batch << ("a".."z").map{|s| s * 8 + ".pdf" }
108
+ batch << %w(lorem ipsum dolor sit amet foo bar baz).map{|s| s + ".pdf"}
109
+
110
+ processing_cb = proc{}
111
+ done_cb = proc{}
112
+ Maileva.on_batch_processing &processing_cb
113
+ Maileva.on_batch_sent &done_cb
114
+ expect(processing_cb).to receive(:call).with(batch)
115
+ expect(done_cb).to receive(:call).with(batch)
116
+
117
+ batch.send!
118
+
119
+ expect(uploaded_files.size).to eq 34
120
+ expect(command_files.keys).to eq(["grids_my_batch_1.tmp", "grids_my_batch_2.tmp"])
121
+ i = 0
122
+ command_files.values.each do |cmd|
123
+ expect(cmd).to include "CLIENT_ID=my_client_id\n"
124
+ expect(cmd).to include "NB_FILE=#{i == 0 ? 30 : 4}\n"
125
+ expect(cmd).to include "GATEWAY=FLOW\n"
126
+ expect(cmd).to include "FLOW_RULE=bar\n"
127
+ j = 1
128
+ (i == 0 ? uploaded_files[0, 30] : uploaded_files[30..-1]).each do |file|
129
+ expect(cmd).to include "FILE_NAME_#{j}=#{file}\n"
130
+ expect(cmd).to include "FILE_SIZE_#{j}=14556\n"
131
+ j += 1
132
+ end
133
+ i += 1
134
+ end
135
+ expect(confirmed_cmds).to eq command_files.keys
136
+ end
137
+
138
+ it "rollbacks in case of an error" do
139
+ Maileva.config.ftp_login = "my_login"
140
+ Maileva.config.ftp_password = "my_pass"
141
+ Maileva.config.client_id = "my_client_id"
142
+
143
+ expect(File).to receive(:file?).at_least(34).times.and_return(true)
144
+ expect(File).to receive(:size).at_least(34).times.and_return(14556)
145
+
146
+ batch = Maileva::Batch.new(:grids, "my_batch")
147
+ batch << ("a".."z").map{|s| s * 8 + ".pdf" }
148
+ batch << %w(lorem ipsum dolor sit amet foo bar baz).map{|s| s + ".pdf"}
149
+
150
+ expect(batch).to receive(:rollback!).and_call_original
151
+ expect_any_instance_of(DoubleBagFTPS).to receive(:rename) { raise "Dummy exception" }
152
+ expect_any_instance_of(DoubleBagFTPS).to receive(:putstr).at_least(:once)
153
+ expect_any_instance_of(DoubleBagFTPS).to receive(:put).at_least(:once)
154
+ expect_any_instance_of(DoubleBagFTPS).to receive(:file_exists?).twice.and_return(false)
155
+ expect_any_instance_of(DoubleBagFTPS).to receive(:connect).with("ftps.maileva.com", 21)
156
+ expect_any_instance_of(DoubleBagFTPS).to receive(:login).with("my_login", "my_pass")
157
+ ["grids_my_batch_1", "grids_my_batch_2"].each do |f|
158
+ expect_any_instance_of(DoubleBagFTPS).to receive(:delete).with(f + ".tmp")
159
+ expect_any_instance_of(DoubleBagFTPS).to receive(:delete).with(f + ".flw")
160
+ files = f == "grids_my_batch_1" ? batch.files[0, 30] : batch.files[30..-1]
161
+ files.each_index do |i|
162
+ expect_any_instance_of(DoubleBagFTPS).to receive(:delete).with(sprintf "%s.%03d", f, i + 1)
163
+ end
164
+ end
165
+
166
+ processing_cb = proc{}
167
+ failure_cb = proc{}
168
+ Maileva.on_batch_processing &processing_cb
169
+ Maileva.on_batch_failure &failure_cb
170
+ expect(processing_cb).to receive(:call).with(batch)
171
+ expect(failure_cb).to receive(:call).with(batch)
172
+
173
+ expect{ batch.send! }.to raise_error("Dummy exception")
174
+ end
175
+ end
@@ -0,0 +1,17 @@
1
+ # Copyright © 2016, Kévin Lesénéchal <kevin.lesenechal@gmail.com>.
2
+ #
3
+ # This library is licensed under the new BSD license. Checkout the license text
4
+ # in the LICENSE file or online at <http://opensource.org/licenses/BSD-3-Clause>.
5
+
6
+ require 'spec_helper'
7
+ require 'maileva'
8
+ require 'double_bag_ftps'
9
+
10
+ RSpec.describe Maileva do
11
+ it "should add rules" do
12
+ Maileva.class_variable_set(:@@rules, {})
13
+ expect {
14
+ Maileva.add_rule :grids, id: "bar", name: "baz"
15
+ }.to change{ Maileva.rules }.from({}).to({grids: {id: "bar", name: "baz"}})
16
+ end
17
+ end
@@ -0,0 +1,96 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Allows RSpec to persist some state between runs in order to support
54
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
55
+ # you configure your source control system to ignore this file.
56
+ config.example_status_persistence_file_path = "spec/examples.txt"
57
+
58
+ # Limits the available syntax to the non-monkey patched syntax that is
59
+ # recommended. For more details, see:
60
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
61
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
63
+ config.disable_monkey_patching!
64
+
65
+ # This setting enables warnings. It's recommended, but in some cases may
66
+ # be too noisy due to issues in dependencies.
67
+ config.warnings = true
68
+
69
+ # Many RSpec users commonly either run the entire suite or an individual
70
+ # file, and it's useful to allow more verbose output when running an
71
+ # individual spec file.
72
+ if config.files_to_run.one?
73
+ # Use the documentation formatter for detailed output,
74
+ # unless a formatter has already been configured
75
+ # (e.g. via a command-line flag).
76
+ config.default_formatter = 'doc'
77
+ end
78
+
79
+ # Print the 10 slowest examples and example groups at the
80
+ # end of the spec run, to help surface which specs are running
81
+ # particularly slow.
82
+ config.profile_examples = 10
83
+
84
+ # Run specs in random order to surface order dependencies. If you find an
85
+ # order dependency and want to debug it, you can fix the order by providing
86
+ # the seed, which is printed after each run.
87
+ # --seed 1234
88
+ config.order = :random
89
+
90
+ # Seed global randomization in this process using the `--seed` CLI option.
91
+ # Setting this allows you to use `--seed` to deterministically reproduce
92
+ # test failures related to randomization by passing the same `--seed` value
93
+ # as the one that triggered the failure.
94
+ Kernel.srand config.seed
95
+ =end
96
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: maileva
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kévin Lesénéchal
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: double-bag-ftps
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ description:
42
+ email: kevin.lesenechal@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - LICENSE
48
+ - README.md
49
+ - lib/core_extensions/net/ftp/maileva.rb
50
+ - lib/maileva.rb
51
+ - lib/maileva/batch.rb
52
+ - spec/batch_spec.rb
53
+ - spec/maileva_spec.rb
54
+ - spec/spec_helper.rb
55
+ homepage: https://github.com/kevin-lesenechal/paybox_direct
56
+ licenses:
57
+ - BSD-3-Clause
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.5.1
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Send mails through Maileva FTP deposit
79
+ test_files: []