seeuletter 1.1.0 → 1.4.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.
- checksums.yaml +5 -5
- data/.gitignore +14 -14
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +232 -142
- data/Rakefile +7 -7
- data/examples/README.md +31 -17
- data/examples/accounts.rb +27 -0
- data/examples/invoices.rb +21 -0
- data/examples/letter_price.rb +5 -5
- data/examples/letters.rb +49 -49
- data/examples/letters_electronic.rb +48 -0
- data/examples/postcards.rb +53 -0
- data/examples/users.rb +6 -0
- data/lib/seeuletter/client.rb +46 -25
- data/lib/seeuletter/errors/invalid_request_error.rb +4 -4
- data/lib/seeuletter/errors/seeuletter_error.rb +20 -20
- data/lib/seeuletter/resources/account.rb +30 -0
- data/lib/seeuletter/resources/invoice.rb +22 -0
- data/lib/seeuletter/resources/letter.rb +17 -14
- data/lib/seeuletter/resources/letter_price.rb +14 -14
- data/lib/seeuletter/resources/postcard.rb +14 -0
- data/lib/seeuletter/resources/resource_base.rb +109 -109
- data/lib/seeuletter/resources/user.rb +16 -0
- data/lib/seeuletter/version.rb +3 -3
- data/lib/seeuletter.rb +7 -7
- data/seeuletter.gemspec +24 -24
- metadata +15 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5bc0dfd516e4b918a21c7c592788df8e12b98ccecc428fa59a0fac7c5ec4f771
|
4
|
+
data.tar.gz: '0957b2824afb423e6a1e91a76644e84e58e0f4b1e10c1920afa453d414d9b2b7'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33de5980a1dfa835a8c5547352b3a5f87c2562d504a66b2e128be536d347bb1b9847ca09890f09ad001bf1b8fc2f40cd197d6c0f78dcdb77568d0fb1c5740e4d
|
7
|
+
data.tar.gz: b5e47137fc690881260c1357566e7187a73d05b993e9621a1ff1a4cc15015808c7ee4fe143541a5d65779026126f5d6e55a46ebce7aa427c8f149c77c4c4280c
|
data/.gitignore
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
.DS_Store
|
7
|
-
Gemfile.lock
|
8
|
-
InstalledFiles
|
9
|
-
_yardoc
|
10
|
-
coverage
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
tmp
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
.DS_Store
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
tmp
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in seeuletter.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in seeuletter.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2017 Seeuletter.com
|
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.
|
1
|
+
Copyright (c) 2017 Seeuletter.com
|
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
CHANGED
@@ -1,142 +1,232 @@
|
|
1
|
-
# seeuletter-ruby
|
2
|
-
|
3
|
-
|
4
|
-
[](https://badge.fury.io/rb/seeuletter)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- [
|
16
|
-
- [
|
17
|
-
- [
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
$
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
```
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
```
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
seeuletter
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
```
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
1
|
+
# seeuletter-ruby
|
2
|
+
|
3
|
+
|
4
|
+
[](https://badge.fury.io/rb/seeuletter)
|
5
|
+
[](https://gemnasium.com/github.com/seeuletter/seeuletter-ruby)
|
6
|
+
|
7
|
+
|
8
|
+
Ruby wrapper for the [Seeuletter.com](https://www.seeuletter.com) API. See the full Seeuletter.com [API Documentation](https://docs.seeuletter.com/?ruby#). For best results, be sure that you're using the latest version of the Seeuletter API and the latest version of the ruby wrapper. This gem gives you an ActiveRecord-style syntax to use the Seeuletter.com API.
|
9
|
+
|
10
|
+
Supports Ruby 2.0.0 and greater.
|
11
|
+
|
12
|
+
## Table of Contents
|
13
|
+
|
14
|
+
- [Getting Started](#getting-started)
|
15
|
+
- [Registration](#registration)
|
16
|
+
- [Installation](#installation)
|
17
|
+
- [Usage](#usage)
|
18
|
+
- [Letters](#letters)
|
19
|
+
- [Accounts](#accounts)
|
20
|
+
- [Invoices](#invoices)
|
21
|
+
- [Examples](#examples)
|
22
|
+
|
23
|
+
## Getting Started
|
24
|
+
|
25
|
+
Here's a general overview of the Seeuletter services available, click through to read more.
|
26
|
+
|
27
|
+
Please read through the official [API Documentation](https://docs.seeuletter.com/?ruby#) to get a complete sense of what to expect from each endpoint.
|
28
|
+
|
29
|
+
### Registration
|
30
|
+
|
31
|
+
First, you will need to first create an account at [Seeuletter.com](https://www.seeuletter.com/signup) and obtain your Test and Live API Keys.
|
32
|
+
|
33
|
+
Once you have created an account, you can access your API Keys from the [API Keys Panel](https://www.seeuletter.com/app/dashboard/keys).
|
34
|
+
|
35
|
+
### Installation
|
36
|
+
|
37
|
+
Add this line to your application's `Gemfile`:
|
38
|
+
|
39
|
+
gem 'seeuletter'
|
40
|
+
|
41
|
+
And then execute:
|
42
|
+
|
43
|
+
$ bundle
|
44
|
+
|
45
|
+
Or manually install it yourself:
|
46
|
+
|
47
|
+
$ gem install seeuletter
|
48
|
+
|
49
|
+
### Usage
|
50
|
+
|
51
|
+
The library uses an ActiveRecord-style interface.
|
52
|
+
|
53
|
+
For optional parameters and other details, refer to the docs [here](https://docs.seeuletter.com/?ruby#).
|
54
|
+
|
55
|
+
#### Initialization and Configuration
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
# To initialize a Seeuletter object
|
59
|
+
seeuletter = Seeuletter::Client.new(api_key: "your-api-key")
|
60
|
+
```
|
61
|
+
|
62
|
+
### Letters
|
63
|
+
|
64
|
+
#### Create a new letter
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
# send the letter
|
68
|
+
require 'seeuletter'
|
69
|
+
|
70
|
+
# initialize Seeuletter object
|
71
|
+
seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
|
72
|
+
|
73
|
+
puts seeuletter.letters.create(
|
74
|
+
description: "Test letter from the Ruby Wrapper",
|
75
|
+
to: {
|
76
|
+
name: 'Erlich',
|
77
|
+
address_line1: '30 rue de rivoli',
|
78
|
+
address_line2: '',
|
79
|
+
address_city: 'Paris',
|
80
|
+
address_country: 'France',
|
81
|
+
address_postalcode: '75004'
|
82
|
+
},
|
83
|
+
source_file: '<html>Hello {{name}}</html>',
|
84
|
+
source_file_type: 'html',
|
85
|
+
postage_type: 'prioritaire',
|
86
|
+
variables: { name: 'Erlich'},
|
87
|
+
color: 'color'
|
88
|
+
)
|
89
|
+
```
|
90
|
+
|
91
|
+
#### Create a new electronic letter
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
# send the letter
|
95
|
+
require 'seeuletter'
|
96
|
+
|
97
|
+
# initialize Seeuletter object
|
98
|
+
seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
|
99
|
+
|
100
|
+
puts seeuletter.letters.createElectronic(
|
101
|
+
description: "Test electronic letter from the Ruby Wrapper",
|
102
|
+
to: {
|
103
|
+
email: 'erlich.dumas@example.com',
|
104
|
+
first_name: 'Erlich',
|
105
|
+
last_name: 'Dumas',
|
106
|
+
status: 'individual'
|
107
|
+
},
|
108
|
+
source_file: '<html>Hello {{name}}</html>',
|
109
|
+
source_file_type: 'html',
|
110
|
+
postage_type: 'lre',
|
111
|
+
variables: {
|
112
|
+
name: 'Erlich'
|
113
|
+
}
|
114
|
+
)
|
115
|
+
```
|
116
|
+
|
117
|
+
#### List all letters
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
require 'seeuletter'
|
121
|
+
|
122
|
+
seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
|
123
|
+
|
124
|
+
puts seeuletter.letters.list()
|
125
|
+
```
|
126
|
+
|
127
|
+
#### Get a specific letter
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
require 'seeuletter'
|
131
|
+
|
132
|
+
seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
|
133
|
+
|
134
|
+
puts seeuletter.letters.find('LETTER_ID')
|
135
|
+
```
|
136
|
+
#### Get the price of a letter
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
require 'seeuletter'
|
140
|
+
|
141
|
+
seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
|
142
|
+
|
143
|
+
puts seeuletter.letter_price.get(color: 'bw', postage_type: 'prioritaire', postage_speed: 'D1', page_count: 1)
|
144
|
+
```
|
145
|
+
|
146
|
+
### Accounts
|
147
|
+
|
148
|
+
#### Create a new account for the company
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
require 'seeuletter'
|
152
|
+
|
153
|
+
# initialize Seeuletter object
|
154
|
+
seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
|
155
|
+
|
156
|
+
puts seeuletter.accounts.create(
|
157
|
+
email: "msb.partner@example.com",
|
158
|
+
name: "Erlich Bachman",
|
159
|
+
phone: "+33104050607",
|
160
|
+
company_name: "MSB Partner from Ruby Wrapper",
|
161
|
+
address_line1: '30 rue de rivoli',
|
162
|
+
address_line2: '',
|
163
|
+
address_city: 'Paris',
|
164
|
+
address_country: 'France',
|
165
|
+
address_postalcode: '75004'
|
166
|
+
)
|
167
|
+
```
|
168
|
+
|
169
|
+
### Update the account company email
|
170
|
+
|
171
|
+
```ruby
|
172
|
+
require 'seeuletter'
|
173
|
+
|
174
|
+
# initialize Seeuletter object
|
175
|
+
seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
|
176
|
+
|
177
|
+
seeuletter.accounts.updateEmail('ACCOUNT_COMPANY_ID', "msb.partner.new@example.com")
|
178
|
+
```
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
### Invoices
|
183
|
+
|
184
|
+
#### List all invoices for a company
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
require 'seeuletter'
|
188
|
+
|
189
|
+
seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
|
190
|
+
|
191
|
+
puts seeuletter.invoices.list()
|
192
|
+
```
|
193
|
+
|
194
|
+
#### Get a specific invoice
|
195
|
+
|
196
|
+
```ruby
|
197
|
+
require 'seeuletter'
|
198
|
+
|
199
|
+
seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
|
200
|
+
|
201
|
+
puts seeuletter.invoices.find('INVOICE_ID')
|
202
|
+
```
|
203
|
+
|
204
|
+
#### Caution: Pass zero-prefixed postal codes as strings
|
205
|
+
|
206
|
+
When using postal codes with zero-prefixes, always quote them. For example when specifying `02125`, pass it as a string `"02125"`, instead of an integer.
|
207
|
+
|
208
|
+
The Ruby interpreter assumes it's not of base-10 and tries to convert it to base-10 number. So that might result in an entirely different postal code than intended.
|
209
|
+
|
210
|
+
#### Accessing Response Headers
|
211
|
+
|
212
|
+
You can access response headers via a hidden `headers` method on the response hash.
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
addresses = seeuletter.addresses.list
|
216
|
+
|
217
|
+
addresses._response.headers[:content_type]
|
218
|
+
# => "application/json"
|
219
|
+
```
|
220
|
+
|
221
|
+
|
222
|
+
## Examples
|
223
|
+
|
224
|
+
We've provided various examples for you to try out [here](https://github.com/seeuletter/seeuletter-ruby/tree/master/examples).
|
225
|
+
|
226
|
+
There are simple scripts to demonstrate how to create all letters with the Seeuletter API Ruby wrapper.
|
227
|
+
|
228
|
+
=======================
|
229
|
+
|
230
|
+
Copyright © 2017 Seeuletter.com
|
231
|
+
|
232
|
+
Released under the MIT License, which can be found in the repository in `LICENSE.txt`.
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new do |t|
|
5
|
-
t.libs.push "lib"
|
6
|
-
t.verbose = true
|
7
|
-
end
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
Rake::TestTask.new do |t|
|
5
|
+
t.libs.push "lib"
|
6
|
+
t.verbose = true
|
7
|
+
end
|
data/examples/README.md
CHANGED
@@ -1,17 +1,31 @@
|
|
1
|
-
# Ruby Examples
|
2
|
-
|
3
|
-
Here you can find some examples to help you get started with the Ruby wrapper.
|
4
|
-
|
5
|
-
## Getting started
|
6
|
-
Before running these examples make sure you are in the `examples/` directory.
|
7
|
-
```
|
8
|
-
cd examples/
|
9
|
-
```
|
10
|
-
|
11
|
-
## Examples
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
1
|
+
# Ruby Examples
|
2
|
+
|
3
|
+
Here you can find some examples to help you get started with the Ruby wrapper.
|
4
|
+
|
5
|
+
## Getting started
|
6
|
+
Before running these examples make sure you are in the `examples/` directory.
|
7
|
+
```
|
8
|
+
cd examples/
|
9
|
+
```
|
10
|
+
|
11
|
+
## Examples
|
12
|
+
|
13
|
+
### Create a letter
|
14
|
+
```
|
15
|
+
ruby letters.rb
|
16
|
+
```
|
17
|
+
|
18
|
+
### Create an electronic letter
|
19
|
+
```
|
20
|
+
ruby letters_electronic.rb
|
21
|
+
```
|
22
|
+
|
23
|
+
### Create and update account
|
24
|
+
```
|
25
|
+
ruby accounts.rb
|
26
|
+
```
|
27
|
+
|
28
|
+
### Get invoices
|
29
|
+
```
|
30
|
+
ruby invoices.rb
|
31
|
+
```
|
@@ -0,0 +1,27 @@
|
|
1
|
+
$:.unshift File.expand_path("../lib", File.dirname(__FILE__))
|
2
|
+
require 'seeuletter'
|
3
|
+
|
4
|
+
# initialize Seeuletter object
|
5
|
+
seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
|
6
|
+
|
7
|
+
begin
|
8
|
+
# create a new company account
|
9
|
+
create_response = seeuletter.accounts.create(
|
10
|
+
email: "msb.partner@example.com",
|
11
|
+
name: "Erlich Bachman",
|
12
|
+
phone: "+33104050607",
|
13
|
+
company_name: "MSB Partner from Ruby Wrapper",
|
14
|
+
address_line1: '30 rue de rivoli',
|
15
|
+
address_line2: '',
|
16
|
+
address_city: 'Paris',
|
17
|
+
address_country: 'France',
|
18
|
+
address_postalcode: '75004'
|
19
|
+
)
|
20
|
+
puts "The Seeuletter API Account responded : #{create_response}"
|
21
|
+
|
22
|
+
# update email of a company account
|
23
|
+
seeuletter.accounts.updateEmail(create_response['company']['_id'], "msb.partner.new@example.com")
|
24
|
+
|
25
|
+
rescue Seeuletter::SeeuletterError => ex
|
26
|
+
puts "Error from API : #{ex}"
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift File.expand_path("../lib", File.dirname(__FILE__))
|
2
|
+
require 'seeuletter'
|
3
|
+
|
4
|
+
# initialize Seeuletter object
|
5
|
+
seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
|
6
|
+
|
7
|
+
begin
|
8
|
+
# get list of invoices
|
9
|
+
list_response = seeuletter.invoices.list(
|
10
|
+
status: "paid",
|
11
|
+
date_start: "2020-01-01"
|
12
|
+
)
|
13
|
+
puts "The Seeuletter API Invoices responded : #{list_response}"
|
14
|
+
|
15
|
+
# get single invoice by API
|
16
|
+
find_response = seeuletter.invoices.find(list_response['invoices'][0]['_id'])
|
17
|
+
puts "The Seeuletter API Invoice responded : #{find_response}"
|
18
|
+
|
19
|
+
rescue Seeuletter::SeeuletterError => ex
|
20
|
+
puts "Error from API : #{ex}"
|
21
|
+
end
|
data/examples/letter_price.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
$:.unshift File.expand_path("../lib", File.dirname(__FILE__))
|
2
|
-
require 'seeuletter'
|
3
|
-
|
4
|
-
seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
|
5
|
-
|
1
|
+
$:.unshift File.expand_path("../lib", File.dirname(__FILE__))
|
2
|
+
require 'seeuletter'
|
3
|
+
|
4
|
+
seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
|
5
|
+
|
6
6
|
puts seeuletter.letter_price.get(color: 'bw', postage_type: 'prioritaire', postage_speed: 'D1', page_count: 1)
|