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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c95ab7d39cc66975f788f128075a0678c5af426a
4
- data.tar.gz: 3c6582b0e1abd7f6e2366c78f1033f9c3707f055
2
+ SHA256:
3
+ metadata.gz: 5bc0dfd516e4b918a21c7c592788df8e12b98ccecc428fa59a0fac7c5ec4f771
4
+ data.tar.gz: '0957b2824afb423e6a1e91a76644e84e58e0f4b1e10c1920afa453d414d9b2b7'
5
5
  SHA512:
6
- metadata.gz: 52f655b93b2b77029b9a461408388af761651f2a7af372fe2eaa13d23585b117479d3f6c6b276a8c1b6a03803edb7e1bd920f990884db061a00c17abd9142808
7
- data.tar.gz: '02864672a80c3e8c18e069766fdebe1214b97259f08a1532c106d7a06841043f586e5a0e8974d09ca8f24bece59c22418f8b7250bd05157fa7c78763c9f883b1'
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
- [![Gem Version](https://badge.fury.io/rb/seeuletter.svg)](https://badge.fury.io/rb/seeuletter)
5
-
6
-
7
- 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.
8
-
9
- Supports Ruby 2.0.0 and greater.
10
-
11
- ## Table of Contents
12
-
13
- - [Getting Started](#getting-started)
14
- - [Registration](#registration)
15
- - [Installation](#installation)
16
- - [Usage](#usage)
17
- - [Examples](#examples)
18
-
19
- ## Getting Started
20
-
21
- Here's a general overview of the Seeuletter services available, click through to read more.
22
-
23
- Please read through the official [API Documentation](https://docs.seeuletter.com/?ruby#) to get a complete sense of what to expect from each endpoint.
24
-
25
- ### Registration
26
-
27
- 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.
28
-
29
- Once you have created an account, you can access your API Keys from the [API Keys Panel](https://www.seeuletter.com/app/dashboard/keys).
30
-
31
- ### Installation
32
-
33
- Add this line to your application's `Gemfile`:
34
-
35
- gem 'seeuletter'
36
-
37
- And then execute:
38
-
39
- $ bundle
40
-
41
- Or manually install it yourself:
42
-
43
- $ gem install seeuletter
44
-
45
- ### Usage
46
-
47
- The library uses an ActiveRecord-style interface.
48
-
49
- For optional parameters and other details, refer to the docs [here](https://docs.seeuletter.com/?ruby#).
50
-
51
- #### Initialization and Configuration
52
-
53
- ```ruby
54
- # To initialize a Seeuletter object
55
- seeuletter = Seeuletter::Client.new(api_key: "your-api-key")
56
- ```
57
-
58
- #### Create a new letter
59
-
60
- ```ruby
61
- # send the letter
62
- require 'seeuletter'
63
-
64
- # initialize Seeuletter object
65
- seeuletter = Seeuletter::Client.new(api_key: '<PUT_YOU_API_KEY_HERE>')
66
-
67
- puts seeuletter.letters.create(
68
- description: "Test letter from the Ruby Wrapper",
69
- to: {
70
- name: 'Erlich',
71
- address_line1: '30 rue de rivoli',
72
- address_line2: '',
73
- address_city: 'Paris',
74
- address_country: 'France',
75
- address_postalcode: '75004'
76
- },
77
- source_file: '<html>Hello {{name}}</html>',
78
- source_file_type: 'html',
79
- postage_type: 'prioritaire',
80
- variables: { name: 'Erlich'},
81
- color: 'color'
82
- )
83
- ```
84
-
85
- #### List all letters
86
-
87
- ```ruby
88
- require 'seeuletter'
89
-
90
- seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
91
-
92
- puts seeuletter.letters.list()
93
- ```
94
-
95
- #### Get a specific letter
96
-
97
- ```ruby
98
- require 'seeuletter'
99
-
100
- seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
101
-
102
- puts seeuletter.letters.find('LETTER_ID')
103
- ```
104
- #### Get the price of a letter
105
-
106
- ```ruby
107
- require 'seeuletter'
108
-
109
- seeuletter = Seeuletter::Client.new(api_key: 'test_12345678901234567890')
110
-
111
- puts seeuletter.letter_price.get(color: 'bw', postage_type: 'prioritaire', postage_speed: 'D1', page_count: 1)
112
- ```
113
-
114
- #### Caution: Pass zero-prefixed postal codes as strings
115
-
116
- 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.
117
-
118
- 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.
119
-
120
- #### Accessing Response Headers
121
-
122
- You can access response headers via a hidden `headers` method on the response hash.
123
-
124
- ```ruby
125
- addresses = seeuletter.addresses.list
126
-
127
- addresses._response.headers[:content_type]
128
- # => "application/json"
129
- ```
130
-
131
-
132
- ## Examples
133
-
134
- We've provided various examples for you to try out [here](https://github.com/seeuletter/seeuletter-ruby/tree/master/examples).
135
-
136
- There are simple scripts to demonstrate how to create all letters with the Seeuletter API Ruby wrapper.
137
-
138
- =======================
139
-
140
- Copyright &copy; 2017 Seeuletter.com
141
-
142
- Released under the MIT License, which can be found in the repository in `LICENSE.txt`.
1
+ # seeuletter-ruby
2
+
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/seeuletter.svg)](https://badge.fury.io/rb/seeuletter)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/seeuletter/seeuletter-ruby.svg)](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 &copy; 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
- ### Create a letter
15
- ```
16
- ruby letters.rb
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
@@ -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)