onlinebrief24 0.0.1
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.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Guardfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +18 -0
- data/lib/onlinebrief24.rb +6 -0
- data/lib/onlinebrief24/client.rb +48 -0
- data/lib/onlinebrief24/letter.rb +107 -0
- data/lib/onlinebrief24/version.rb +3 -0
- data/onlinebrief24.gemspec +28 -0
- data/spec/example_files/example.pdf +0 -0
- data/spec/onlinebrief24/client_spec.rb +78 -0
- data/spec/onlinebrief24/letter_spec.rb +177 -0
- data/spec/onlinebrief24_spec.rb +7 -0
- data/spec/spec_helper.rb +3 -0
- metadata +173 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec' do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}/#{m[2]}_spec.rb" }
|
7
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
8
|
+
|
9
|
+
watch('spec/spec_helper.rb') { "spec" }
|
10
|
+
end
|
11
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Roland Moriz
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Onlinebrief24
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'onlinebrief24'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install onlinebrief24
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
Bundler.setup
|
5
|
+
Bundler::GemHelper.install_tasks
|
6
|
+
|
7
|
+
require 'rspec/core/rake_task'
|
8
|
+
desc 'Run RSpec'
|
9
|
+
RSpec::Core::RakeTask.new do |spec|
|
10
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
11
|
+
spec.rspec_opts = ['--color', '--format nested']
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Run rspec tests'
|
15
|
+
task :test => [:spec]
|
16
|
+
|
17
|
+
task :default => :test
|
18
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'net/sftp'
|
2
|
+
|
3
|
+
module Onlinebrief24
|
4
|
+
class Client
|
5
|
+
attr_accessor :login, :password, :server, :port, :upload_dir, :fingerprint
|
6
|
+
|
7
|
+
def initialize(opts = {})
|
8
|
+
@login = opts[:login]
|
9
|
+
@password = opts[:password]
|
10
|
+
@server = opts[:server] || 'api.onlinebrief24.de'
|
11
|
+
@port = opts[:port] || 22
|
12
|
+
@upload_dir = opts[:upload_dir] || '/upload/api'
|
13
|
+
end
|
14
|
+
|
15
|
+
def upload!(letter_or_file_handle_or_filename, options = {})
|
16
|
+
|
17
|
+
if letter_or_file_handle_or_filename.is_a?(File) || letter_or_file_handle_or_filename.is_a?(String)
|
18
|
+
letter = Letter.new(letter_or_file_handle_or_filename)
|
19
|
+
elsif letter_or_file_handle_or_filename.is_a?(Onlinebrief24::Letter)
|
20
|
+
letter = letter_or_file_handle_or_filename
|
21
|
+
else
|
22
|
+
raise ArgumentError, letter_or_file_handle_or_filename.class
|
23
|
+
end
|
24
|
+
|
25
|
+
letter.valid?
|
26
|
+
|
27
|
+
connection.upload!(letter.local_path, abs_remote_path(letter.remote_filename))
|
28
|
+
|
29
|
+
letter.remote_filename
|
30
|
+
end
|
31
|
+
|
32
|
+
def connection
|
33
|
+
return @connection if @connection and @connection.open?
|
34
|
+
|
35
|
+
@connection = Net::SFTP.start(@server, @login, :password => @password)
|
36
|
+
end
|
37
|
+
alias_method :connect, :connection
|
38
|
+
|
39
|
+
def disconnect
|
40
|
+
@connection.close if @connection and @connection.open?
|
41
|
+
end
|
42
|
+
|
43
|
+
def abs_remote_path(filename)
|
44
|
+
@upload_dir + '/' + filename
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module Onlinebrief24
|
2
|
+
class InvalidLetterAttributeValueError < StandardError; end
|
3
|
+
|
4
|
+
class Letter
|
5
|
+
attr_accessor :local_path, :local_filename, :color, :duplex, :envelope, :distribution, :registered, :cost_center, :connection
|
6
|
+
|
7
|
+
ENVELOPE_FORMATS = [ :din_lang, :c4 ]
|
8
|
+
DISTRIBUTION_FORMATS = [ :auto, :national, :international ]
|
9
|
+
REGISTERED_OPTIONS = [ :none, :insertion, :standard, :personal ]
|
10
|
+
|
11
|
+
def initialize(file_or_filename, options = {})
|
12
|
+
@local_path = File.expand_path(file_or_filename)
|
13
|
+
@local_filename = File.basename(@local_path)
|
14
|
+
|
15
|
+
defaults.merge(options).each_pair do |setting, value|
|
16
|
+
send("#{setting}=", value)
|
17
|
+
end
|
18
|
+
|
19
|
+
validate_settings
|
20
|
+
end
|
21
|
+
|
22
|
+
def defaults
|
23
|
+
{
|
24
|
+
:color => true,
|
25
|
+
:duplex => false,
|
26
|
+
:envelope => :din_lang,
|
27
|
+
:distribution => :auto,
|
28
|
+
:registered => :none
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def remote_filename
|
33
|
+
rf = '0000000000000' + '_' + with_cost_center(@local_filename)
|
34
|
+
|
35
|
+
case @color
|
36
|
+
when true
|
37
|
+
rf[0] = "1"
|
38
|
+
else
|
39
|
+
rf[0] = "0"
|
40
|
+
end
|
41
|
+
|
42
|
+
case @duplex
|
43
|
+
when true
|
44
|
+
rf[1] = "1"
|
45
|
+
else
|
46
|
+
rf[1] = "0"
|
47
|
+
end
|
48
|
+
|
49
|
+
case @envelope
|
50
|
+
when :c4
|
51
|
+
rf[2] = "1"
|
52
|
+
else
|
53
|
+
rf[2] = "0"
|
54
|
+
end
|
55
|
+
|
56
|
+
case @distribution
|
57
|
+
when :auto
|
58
|
+
rf[3] = "0"
|
59
|
+
when :national
|
60
|
+
rf[3] = "1"
|
61
|
+
when :international
|
62
|
+
rf[3] = "3"
|
63
|
+
end
|
64
|
+
|
65
|
+
case @registered
|
66
|
+
when :none
|
67
|
+
rf[4] = "0"
|
68
|
+
when :insertion
|
69
|
+
rf[4] = "1"
|
70
|
+
when :standard
|
71
|
+
rf[4] = "2"
|
72
|
+
when :personal
|
73
|
+
rf[4] = "3"
|
74
|
+
end
|
75
|
+
|
76
|
+
rf
|
77
|
+
end
|
78
|
+
|
79
|
+
def valid?
|
80
|
+
validate_settings
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def with_cost_center(filename)
|
86
|
+
if @cost_center
|
87
|
+
filename.gsub(/\.pdf/, "##{@cost_center}#.pdf")
|
88
|
+
else
|
89
|
+
filename
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def validate_settings
|
94
|
+
unless ENVELOPE_FORMATS.include? @envelope
|
95
|
+
raise InvalidLetterAttributeValueError, ':envelope value needs to be within: ' + ENVELOPE_FORMATS.join(',') + ' - value was: ' + @envelope.inspect
|
96
|
+
end
|
97
|
+
|
98
|
+
unless DISTRIBUTION_FORMATS.include? @distribution
|
99
|
+
raise InvalidLetterAttributeValueError, ':distribution value needs to be within: ' + DISTRIBUTION_FORMATS.join(',') + '- value was: ' + @distribution.inspect
|
100
|
+
end
|
101
|
+
|
102
|
+
unless REGISTERED_OPTIONS.include? @registered
|
103
|
+
raise InvalidLetterAttributeValueError, ':registered value needs to be within: ' + REGISTERED_OPTIONS.join(',') + '- value was: ' + @registered.inspect
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'onlinebrief24/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = 'onlinebrief24'
|
8
|
+
gem.version = Onlinebrief24::VERSION
|
9
|
+
gem.authors = ['Roland Moriz']
|
10
|
+
gem.email = ['roland@moriz.de']
|
11
|
+
gem.description = %q{A gem to interact with onlinebrief24.de (send PDFs as physical letters/snail mail)}
|
12
|
+
gem.summary = %q{A gem to interact with onlinebrief24.de (send PDFs as physical letters/snail mail)}
|
13
|
+
gem.homepage = 'https://github.com/rmoriz'
|
14
|
+
gem.license = 'MIT'
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ['lib']
|
20
|
+
|
21
|
+
gem.add_dependency 'net-sftp', '~> 2.0'
|
22
|
+
|
23
|
+
gem.add_development_dependency 'rspec', '~> 2.0'
|
24
|
+
gem.add_development_dependency 'rake'
|
25
|
+
gem.add_development_dependency 'guard'
|
26
|
+
gem.add_development_dependency 'guard-rspec'
|
27
|
+
gem.add_development_dependency 'rb-fsevent'
|
28
|
+
end
|
Binary file
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Onlinebrief24::Client do
|
4
|
+
let(:params) {
|
5
|
+
{
|
6
|
+
:login => 'user@example.com',
|
7
|
+
:password => 'fefe_isst_gerne_schweinshaxn',
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
describe '#initialize' do
|
12
|
+
context 'without parameters' do
|
13
|
+
it 'should instantiate' do
|
14
|
+
described_class.new.should be_instance_of(Onlinebrief24::Client)
|
15
|
+
end
|
16
|
+
its(:server) { should eql('api.onlinebrief24.de') }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'with parameters' do
|
20
|
+
subject { described_class.new params }
|
21
|
+
|
22
|
+
it { should be_instance_of(Onlinebrief24::Client) }
|
23
|
+
its(:login) { should eql(params[:login]) }
|
24
|
+
its(:password) { should eql(params[:password]) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#upload' do
|
29
|
+
subject { described_class.new params }
|
30
|
+
let(:local_path) { File.expand_path('../../example_files/example.pdf', __FILE__) }
|
31
|
+
let(:letter) { Onlinebrief24::Letter.new(local_path, letter_options) }
|
32
|
+
let(:letter_options) { {} }
|
33
|
+
|
34
|
+
describe 'without a letter instance' do
|
35
|
+
let(:letter) { nil }
|
36
|
+
|
37
|
+
it { expect{ subject.upload! letter}.to raise_error ArgumentError }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'with a valid letter instance' do
|
41
|
+
let(:letter_options) { { :duplex => true, :color => true, :cost_center => 'eris' } }
|
42
|
+
|
43
|
+
it 'should upload the letter with the correct remote filename' do
|
44
|
+
sftp = double('sftp')
|
45
|
+
sftp.should_receive(:upload!).with(local_path, '/upload/api/' + letter.remote_filename).once
|
46
|
+
|
47
|
+
Net::SFTP.should_receive(:start).with('api.onlinebrief24.de', params[:login], :password => params[:password]) { sftp }
|
48
|
+
|
49
|
+
subject.upload!(letter).should eql('1100000000000_example#eris#.pdf')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'with a file handle' do
|
54
|
+
let(:filehandle) { File.open(local_path) }
|
55
|
+
|
56
|
+
it 'should upload the letter with the correct remote filename' do
|
57
|
+
sftp = double('sftp')
|
58
|
+
sftp.should_receive(:upload!).with(local_path, '/upload/api/1000000000000_example.pdf').once
|
59
|
+
|
60
|
+
Net::SFTP.should_receive(:start).with('api.onlinebrief24.de', params[:login], :password => params[:password]) { sftp }
|
61
|
+
|
62
|
+
subject.upload!(filehandle).should eql('1000000000000_example.pdf')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe 'with a filenamee' do
|
67
|
+
it 'should upload the letter with the correct remote filename' do
|
68
|
+
sftp = double('sftp')
|
69
|
+
sftp.should_receive(:upload!).with(local_path, '/upload/api/1000000000000_example.pdf').once
|
70
|
+
|
71
|
+
Net::SFTP.should_receive(:start).with('api.onlinebrief24.de', params[:login], :password => params[:password]) { sftp }
|
72
|
+
|
73
|
+
subject.upload!(local_path).should eql('1000000000000_example.pdf')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
@@ -0,0 +1,177 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Onlinebrief24::Letter do
|
4
|
+
subject {
|
5
|
+
Onlinebrief24::Letter.new file_or_filename, options
|
6
|
+
}
|
7
|
+
|
8
|
+
let(:options) { {} }
|
9
|
+
let(:filename) { File.expand_path('../../example_files/example.pdf', __FILE__) }
|
10
|
+
|
11
|
+
describe '#initialize' do
|
12
|
+
context 'without a filename' do
|
13
|
+
subject { Onlinebrief24::Letter.new }
|
14
|
+
|
15
|
+
it 'should raise an error' do
|
16
|
+
expect { subject }.to raise_error ArgumentError
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with a filename' do
|
21
|
+
let(:file_or_filename) { filename }
|
22
|
+
|
23
|
+
it { should be_instance_of(Onlinebrief24::Letter) }
|
24
|
+
|
25
|
+
its(:local_path){ should eql(filename) }
|
26
|
+
its(:local_filename){ should eql(File.basename(filename)) }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with a file handle' do
|
30
|
+
let(:file_or_filename) { File.open(filename) }
|
31
|
+
|
32
|
+
it { should be_instance_of(Onlinebrief24::Letter) }
|
33
|
+
|
34
|
+
its(:local_path){ should eql(filename) }
|
35
|
+
its(:local_filename){ should eql(File.basename(filename)) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
describe 'settings' do
|
41
|
+
let(:file_or_filename) { filename }
|
42
|
+
|
43
|
+
describe '#duplex' do
|
44
|
+
context 'default' do
|
45
|
+
its(:duplex) { should be_false }
|
46
|
+
end
|
47
|
+
context 'disabled' do
|
48
|
+
let(:options) { { :duplex => false } }
|
49
|
+
its(:duplex) { should be_false }
|
50
|
+
end
|
51
|
+
context 'enabled' do
|
52
|
+
let(:options) { { :duplex => true } }
|
53
|
+
its(:duplex) { should be_true }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe '#color' do
|
58
|
+
context 'default' do
|
59
|
+
its(:color) { should be_true }
|
60
|
+
end
|
61
|
+
context 'disabled' do
|
62
|
+
let(:options) { { :color => false } }
|
63
|
+
its(:color) { should be_false }
|
64
|
+
end
|
65
|
+
context 'enabled' do
|
66
|
+
let(:options) { { :color => true } }
|
67
|
+
its(:color) { should be_true }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#envelope' do
|
72
|
+
context 'default' do
|
73
|
+
its(:envelope) { should eql(:din_lang) }
|
74
|
+
end
|
75
|
+
context 'DIN Lang' do
|
76
|
+
let(:options) { { :envelope => :din_lang } }
|
77
|
+
its(:envelope) { should eql(:din_lang) }
|
78
|
+
end
|
79
|
+
context 'C4' do
|
80
|
+
let(:options) { { :envelope => :c4 } }
|
81
|
+
its(:envelope) { should eql(:c4) }
|
82
|
+
end
|
83
|
+
context 'invalid' do
|
84
|
+
let(:options) { { :envelope => :A0 } }
|
85
|
+
it { expect { subject }.to raise_error(Onlinebrief24::InvalidLetterAttributeValueError) }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '#distribution' do
|
90
|
+
context 'default' do
|
91
|
+
its(:distribution) { should eql(:auto) }
|
92
|
+
end
|
93
|
+
context 'national' do
|
94
|
+
let(:options) { { :distribution => :national } }
|
95
|
+
its(:distribution) { should eql(:national) }
|
96
|
+
end
|
97
|
+
context 'invalid' do
|
98
|
+
let(:options) { { :distribution => :warp } }
|
99
|
+
it { expect { subject }.to raise_error(Onlinebrief24::InvalidLetterAttributeValueError) }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#registered' do
|
104
|
+
context 'default' do
|
105
|
+
its(:registered) { should eql(:none) }
|
106
|
+
end
|
107
|
+
context 'insertion' do
|
108
|
+
let(:options) { { :registered => :insertion } }
|
109
|
+
its(:registered) { should eql(:insertion) }
|
110
|
+
end
|
111
|
+
context 'standard' do
|
112
|
+
let(:options) { { :registered => :standard } }
|
113
|
+
its(:registered) { should eql(:standard) }
|
114
|
+
end
|
115
|
+
context 'personal' do
|
116
|
+
let(:options) { { :registered => :personal } }
|
117
|
+
its(:registered) { should eql(:personal) }
|
118
|
+
end
|
119
|
+
context 'invalid' do
|
120
|
+
let(:options) { { :registered => :identmyass } }
|
121
|
+
it { expect { subject }.to raise_error(Onlinebrief24::InvalidLetterAttributeValueError) }
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe 'remote_filename' do
|
126
|
+
context 'default' do
|
127
|
+
its(:remote_filename) { should eql('1000000000000_example.pdf') }
|
128
|
+
end
|
129
|
+
|
130
|
+
context 'default with cost center' do
|
131
|
+
let(:options) { { :cost_center => 'trash_and_law' } }
|
132
|
+
its(:remote_filename) { should eql('1000000000000_example#trash_and_law#.pdf') }
|
133
|
+
end
|
134
|
+
|
135
|
+
describe 'color duplex with c4 envelope' do
|
136
|
+
let(:options) { { :color => true, :duplex => true, :envelope => :c4 } }
|
137
|
+
its(:remote_filename) { should eql('1110000000000_example.pdf') }
|
138
|
+
end
|
139
|
+
|
140
|
+
context 'distribution' do
|
141
|
+
describe 'auto' do
|
142
|
+
let(:options) { { :distribution => :auto } }
|
143
|
+
its(:remote_filename) { should eql('1000000000000_example.pdf') }
|
144
|
+
end
|
145
|
+
describe 'national' do
|
146
|
+
let(:options) { { :distribution => :national } }
|
147
|
+
its(:remote_filename) { should eql('1001000000000_example.pdf') }
|
148
|
+
end
|
149
|
+
describe 'international' do
|
150
|
+
let(:options) { { :distribution => :international } }
|
151
|
+
its(:remote_filename) { should eql('1003000000000_example.pdf') }
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
context 'registered (Einschreiben)' do
|
156
|
+
describe 'none' do
|
157
|
+
let(:options) { { :registered => :none} }
|
158
|
+
its(:remote_filename) { should eql('1000000000000_example.pdf') }
|
159
|
+
end
|
160
|
+
describe 'insertion (Einwurf)' do
|
161
|
+
let(:options) { { :registered => :insertion } }
|
162
|
+
its(:remote_filename) { should eql('1000100000000_example.pdf') }
|
163
|
+
end
|
164
|
+
describe 'standard' do
|
165
|
+
let(:options) { { :registered => :standard } }
|
166
|
+
its(:remote_filename) { should eql('1000200000000_example.pdf') }
|
167
|
+
end
|
168
|
+
describe 'personal (eigenhaendig)' do
|
169
|
+
let(:options) { { :registered => :personal } }
|
170
|
+
its(:remote_filename) { should eql('1000300000000_example.pdf') }
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: onlinebrief24
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Roland Moriz
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: net-sftp
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: guard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: guard-rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rb-fsevent
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
description: A gem to interact with onlinebrief24.de (send PDFs as physical letters/snail
|
111
|
+
mail)
|
112
|
+
email:
|
113
|
+
- roland@moriz.de
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- .rspec
|
120
|
+
- .travis.yml
|
121
|
+
- Gemfile
|
122
|
+
- Guardfile
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- lib/onlinebrief24.rb
|
127
|
+
- lib/onlinebrief24/client.rb
|
128
|
+
- lib/onlinebrief24/letter.rb
|
129
|
+
- lib/onlinebrief24/version.rb
|
130
|
+
- onlinebrief24.gemspec
|
131
|
+
- spec/example_files/example.pdf
|
132
|
+
- spec/onlinebrief24/client_spec.rb
|
133
|
+
- spec/onlinebrief24/letter_spec.rb
|
134
|
+
- spec/onlinebrief24_spec.rb
|
135
|
+
- spec/spec_helper.rb
|
136
|
+
homepage: https://github.com/rmoriz
|
137
|
+
licenses:
|
138
|
+
- MIT
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
none: false
|
145
|
+
requirements:
|
146
|
+
- - ! '>='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
segments:
|
150
|
+
- 0
|
151
|
+
hash: 2273251959082989790
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
hash: 2273251959082989790
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 1.8.23
|
164
|
+
signing_key:
|
165
|
+
specification_version: 3
|
166
|
+
summary: A gem to interact with onlinebrief24.de (send PDFs as physical letters/snail
|
167
|
+
mail)
|
168
|
+
test_files:
|
169
|
+
- spec/example_files/example.pdf
|
170
|
+
- spec/onlinebrief24/client_spec.rb
|
171
|
+
- spec/onlinebrief24/letter_spec.rb
|
172
|
+
- spec/onlinebrief24_spec.rb
|
173
|
+
- spec/spec_helper.rb
|