onlinebrief24 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +40 -9
- data/lib/onlinebrief24/client.rb +1 -1
- data/lib/onlinebrief24/version.rb +1 -1
- data/spec/onlinebrief24/client_spec.rb +9 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,24 +1,48 @@
|
|
1
1
|
# Onlinebrief24
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/rmoriz/onlinebrief24.png)](https://travis-ci.org/rmoriz/onlinebrief24)
|
4
|
+
|
5
|
+
This gem is only interesting for users that use the German letter outbound service Onlinebrief24.de. This gem wraps the required workflow to upload a PDF to Onlinebrief24's servers. Onlinebrief24 then prints and mails the letters via snail mail. As this service is only available to German customers, the following documentation is available in German language only.
|
6
|
+
|
7
|
+
## Voraussetzung
|
8
|
+
|
9
|
+
Ruby 1.9.2 oder neuer.
|
4
10
|
|
5
11
|
## Installation
|
6
12
|
|
7
|
-
|
13
|
+
Über Bundler im Gemfile hinzufügen:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'onlinebrief24'
|
17
|
+
```
|
18
|
+
|
19
|
+
…dann auf der Shell Bundler das Gem installieren lassen:
|
20
|
+
|
21
|
+
```shell
|
22
|
+
$ bundle
|
23
|
+
```
|
8
24
|
|
9
|
-
|
25
|
+
…oder global mit:
|
10
26
|
|
11
|
-
|
27
|
+
```shell
|
28
|
+
$ gem install onlinebrief24
|
29
|
+
```
|
12
30
|
|
13
|
-
|
31
|
+
## Beispiele
|
14
32
|
|
15
|
-
|
33
|
+
#### Kurzform
|
34
|
+
```ruby
|
35
|
+
require 'onlinebrief24'
|
16
36
|
|
17
|
-
|
37
|
+
c = Onlinebrief24::Client.new :login => 'email@example.com', :password => '123456'
|
18
38
|
|
19
|
-
|
39
|
+
c.upload! '/tmp/filename1.pdf', :duplex => true, :color => false
|
40
|
+
c.upload! '/tmp/filename2.pdf', :registered => :insertion, :envelope => :c4
|
41
|
+
c.upload! '/tmp/filename3.pdf', :registered => :standard, :distribution => :international
|
42
|
+
|
43
|
+
c.disconnect
|
44
|
+
```
|
20
45
|
|
21
|
-
TODO: Write usage instructions here
|
22
46
|
|
23
47
|
## Contributing
|
24
48
|
|
@@ -27,3 +51,10 @@ TODO: Write usage instructions here
|
|
27
51
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
52
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
53
|
5. Create new Pull Request
|
54
|
+
|
55
|
+
|
56
|
+
## Copyright
|
57
|
+
|
58
|
+
Licensed under the MIT license.
|
59
|
+
|
60
|
+
Copyright (C) 2013 Moriz GmbH, https://moriz.de/
|
data/lib/onlinebrief24/client.rb
CHANGED
@@ -15,7 +15,7 @@ module Onlinebrief24
|
|
15
15
|
def upload!(letter_or_file_handle_or_filename, options = {})
|
16
16
|
|
17
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)
|
18
|
+
letter = Letter.new(letter_or_file_handle_or_filename, options)
|
19
19
|
elsif letter_or_file_handle_or_filename.is_a?(Onlinebrief24::Letter)
|
20
20
|
letter = letter_or_file_handle_or_filename
|
21
21
|
else
|
@@ -63,7 +63,7 @@ describe Onlinebrief24::Client do
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
describe 'with a
|
66
|
+
describe 'with a filename' do
|
67
67
|
it 'should upload the letter with the correct remote filename' do
|
68
68
|
sftp = double('sftp')
|
69
69
|
sftp.should_receive(:upload!).with(local_path, '/upload/api/1000000000000_example.pdf').once
|
@@ -72,6 +72,14 @@ describe Onlinebrief24::Client do
|
|
72
72
|
|
73
73
|
subject.upload!(local_path).should eql('1000000000000_example.pdf')
|
74
74
|
end
|
75
|
+
it 'should upload the letter with the correct remote filename with options' do
|
76
|
+
sftp = double('sftp')
|
77
|
+
sftp.should_receive(:upload!).with(local_path, '/upload/api/0100000000000_example.pdf').once
|
78
|
+
|
79
|
+
Net::SFTP.should_receive(:start).with('api.onlinebrief24.de', params[:login], :password => params[:password]) { sftp }
|
80
|
+
|
81
|
+
subject.upload!(local_path, :duplex => true, :color => false).should eql('0100000000000_example.pdf')
|
82
|
+
end
|
75
83
|
end
|
76
84
|
end
|
77
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onlinebrief24
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-sftp
|
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
segments:
|
150
150
|
- 0
|
151
|
-
hash:
|
151
|
+
hash: 2410213596265831708
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
none: false
|
154
154
|
requirements:
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
segments:
|
159
159
|
- 0
|
160
|
-
hash:
|
160
|
+
hash: 2410213596265831708
|
161
161
|
requirements: []
|
162
162
|
rubyforge_project:
|
163
163
|
rubygems_version: 1.8.23
|