laneful-ruby 1.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.
- checksums.yaml +7 -0
- data/.rubocop.yml +31 -0
- data/LICENSE +21 -0
- data/Makefile +49 -0
- data/README.md +456 -0
- data/Rakefile +8 -0
- data/examples/Gemfile +5 -0
- data/examples/README.md +53 -0
- data/examples/simple_example.rb +121 -0
- data/laneful-ruby.gemspec +38 -0
- data/lib/laneful/client.rb +123 -0
- data/lib/laneful/exceptions.rb +41 -0
- data/lib/laneful/models.rb +442 -0
- data/lib/laneful/version.rb +5 -0
- data/lib/laneful/webhooks.rb +38 -0
- data/lib/laneful.rb +27 -0
- data/scripts/publish.sh +169 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 92cd0ae4c28744530a747d496d4b22e65dc92e6f2238739b59e75f7dd36769a7
|
4
|
+
data.tar.gz: 87e2c139cb4e26e60c6209f87b88241a0e4161e19b1ffc2dd9da0f254654843c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f8218f49eb9b96cce7b4941fdfe058ef88017c356b0dedc8c18f7bd46cf0398a598255fcbe0a74737d695a0282f0a5e7660a229a94de7406e9694c07b0dcfa72
|
7
|
+
data.tar.gz: 61498ac2d546d3971e6054b5603dbb777dac4b14efb4ac946aa4ac90f89765ffc5d347192b7d5200800ef4dfda2af033d91b1c58d6cdd3704bac9f9c208a199a
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
TargetRubyVersion: 3.0
|
4
|
+
SuggestExtensions: false
|
5
|
+
|
6
|
+
# Disable some strict rules for test files and gemspec
|
7
|
+
Metrics/BlockLength:
|
8
|
+
Exclude:
|
9
|
+
- 'spec/**/*'
|
10
|
+
- '*.gemspec'
|
11
|
+
|
12
|
+
Metrics/MethodLength:
|
13
|
+
Max: 30
|
14
|
+
|
15
|
+
Metrics/ClassLength:
|
16
|
+
Max: 150
|
17
|
+
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Max: 80
|
20
|
+
|
21
|
+
Metrics/CyclomaticComplexity:
|
22
|
+
Max: 40
|
23
|
+
|
24
|
+
Metrics/PerceivedComplexity:
|
25
|
+
Max: 40
|
26
|
+
|
27
|
+
Metrics/ParameterLists:
|
28
|
+
Max: 5
|
29
|
+
|
30
|
+
Layout/LineLength:
|
31
|
+
Max: 120
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Laneful
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Laneful Ruby SDK Makefile
|
2
|
+
|
3
|
+
.PHONY: help test lint build publish clean install setup
|
4
|
+
|
5
|
+
# Default target
|
6
|
+
help:
|
7
|
+
@echo "Available commands:"
|
8
|
+
@echo " setup - Install dependencies"
|
9
|
+
@echo " test - Run tests"
|
10
|
+
@echo " lint - Run code linting"
|
11
|
+
@echo " build - Build the gem"
|
12
|
+
@echo " publish - Publish to RubyGems (requires RUBYGEMS_API_KEY)"
|
13
|
+
@echo " install - Install gem locally"
|
14
|
+
@echo " clean - Clean up built gems"
|
15
|
+
|
16
|
+
# Install dependencies
|
17
|
+
setup:
|
18
|
+
bundle install
|
19
|
+
|
20
|
+
# Run tests
|
21
|
+
test:
|
22
|
+
bundle exec rspec
|
23
|
+
|
24
|
+
# Run linting
|
25
|
+
lint:
|
26
|
+
bundle exec rubocop
|
27
|
+
|
28
|
+
# Build gem
|
29
|
+
build:
|
30
|
+
gem build laneful-ruby.gemspec
|
31
|
+
|
32
|
+
# Publish to RubyGems
|
33
|
+
publish:
|
34
|
+
@if [ -z "$$GEM_HOST_API_KEY" ]; then \
|
35
|
+
echo "Error: GEM_HOST_API_KEY environment variable is not set"; \
|
36
|
+
echo "Please set your RubyGems API key: export GEM_HOST_API_KEY=your_api_key_here"; \
|
37
|
+
exit 1; \
|
38
|
+
fi
|
39
|
+
./scripts/publish.sh
|
40
|
+
|
41
|
+
# Install gem locally
|
42
|
+
install:
|
43
|
+
gem build laneful-ruby.gemspec
|
44
|
+
gem install laneful-ruby-*.gem
|
45
|
+
|
46
|
+
# Clean up
|
47
|
+
clean:
|
48
|
+
rm -f laneful-ruby-*.gem
|
49
|
+
|
data/README.md
ADDED
@@ -0,0 +1,456 @@
|
|
1
|
+
# Laneful Ruby SDK
|
2
|
+
|
3
|
+
A modern Ruby client library for the Laneful email API with support for sending emails, templates, tracking, and webhooks.
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
- Ruby 3.0 or higher
|
8
|
+
- Bundler (for dependency management)
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
### Using Bundler
|
13
|
+
|
14
|
+
Add the following to your `Gemfile`:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'laneful-ruby'
|
18
|
+
```
|
19
|
+
|
20
|
+
Then run:
|
21
|
+
|
22
|
+
```bash
|
23
|
+
bundle install
|
24
|
+
```
|
25
|
+
|
26
|
+
### Manual Installation
|
27
|
+
|
28
|
+
```bash
|
29
|
+
git clone https://github.com/lanefulhq/laneful-ruby.git
|
30
|
+
cd laneful-ruby
|
31
|
+
bundle install
|
32
|
+
bundle exec rake install
|
33
|
+
```
|
34
|
+
|
35
|
+
## Quick Start
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
require 'laneful'
|
39
|
+
|
40
|
+
# Create client
|
41
|
+
client = Laneful::Client.new(
|
42
|
+
'https://your-endpoint.send.laneful.net',
|
43
|
+
'your-auth-token'
|
44
|
+
)
|
45
|
+
|
46
|
+
# Create email
|
47
|
+
email = Laneful::Email::Builder.new
|
48
|
+
.from(Laneful::Address.new('sender@example.com', 'Your Name'))
|
49
|
+
.to(Laneful::Address.new('recipient@example.com', 'Recipient Name'))
|
50
|
+
.subject('Hello from Laneful Ruby SDK!')
|
51
|
+
.text_content('This is a simple test email.')
|
52
|
+
.build
|
53
|
+
|
54
|
+
# Send email
|
55
|
+
response = client.send_email(email)
|
56
|
+
puts "Email sent successfully!"
|
57
|
+
```
|
58
|
+
|
59
|
+
## Features
|
60
|
+
|
61
|
+
- Send single or multiple emails
|
62
|
+
- Plain text and HTML content
|
63
|
+
- Email templates with dynamic data
|
64
|
+
- File attachments
|
65
|
+
- Email tracking (opens, clicks, unsubscribes)
|
66
|
+
- Custom headers and reply-to addresses
|
67
|
+
- Scheduled sending
|
68
|
+
- Webhook signature verification
|
69
|
+
- Comprehensive error handling
|
70
|
+
- Modern Ruby 3.0+ features
|
71
|
+
|
72
|
+
## Examples
|
73
|
+
|
74
|
+
### Simple Text Email
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
email = Laneful::Email::Builder.new
|
78
|
+
.from(Laneful::Address.new('sender@example.com'))
|
79
|
+
.to(Laneful::Address.new('user@example.com'))
|
80
|
+
.subject('Simple Email')
|
81
|
+
.text_content('This is a simple text email.')
|
82
|
+
.build
|
83
|
+
|
84
|
+
response = client.send_email(email)
|
85
|
+
```
|
86
|
+
|
87
|
+
### HTML Email with Tracking
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
tracking = Laneful::TrackingSettings.new(opens: true, clicks: true, unsubscribes: false)
|
91
|
+
|
92
|
+
email = Laneful::Email::Builder.new
|
93
|
+
.from(Laneful::Address.new('sender@example.com'))
|
94
|
+
.to(Laneful::Address.new('user@example.com'))
|
95
|
+
.subject('HTML Email with Tracking')
|
96
|
+
.html_content('<h1>Welcome!</h1><p>This is an <strong>HTML email</strong> with tracking enabled.</p>')
|
97
|
+
.text_content('Welcome! This is an HTML email with tracking enabled.')
|
98
|
+
.tracking(tracking)
|
99
|
+
.build
|
100
|
+
|
101
|
+
response = client.send_email(email)
|
102
|
+
```
|
103
|
+
|
104
|
+
### Template Email
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
email = Laneful::Email::Builder.new
|
108
|
+
.from(Laneful::Address.new('sender@example.com'))
|
109
|
+
.to(Laneful::Address.new('user@example.com'))
|
110
|
+
.template_id('welcome-template')
|
111
|
+
.template_data({
|
112
|
+
'name' => 'John Doe',
|
113
|
+
'company' => 'Acme Corp'
|
114
|
+
})
|
115
|
+
.build
|
116
|
+
|
117
|
+
response = client.send_email(email)
|
118
|
+
```
|
119
|
+
|
120
|
+
### Email with Attachments
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
# Create attachment from file
|
124
|
+
attachment = Laneful::Attachment.from_file('/path/to/document.pdf')
|
125
|
+
|
126
|
+
email = Laneful::Email::Builder.new
|
127
|
+
.from(Laneful::Address.new('sender@example.com'))
|
128
|
+
.to(Laneful::Address.new('user@example.com'))
|
129
|
+
.subject('Document Attached')
|
130
|
+
.text_content('Please find the document attached.')
|
131
|
+
.attachment(attachment)
|
132
|
+
.build
|
133
|
+
|
134
|
+
response = client.send_email(email)
|
135
|
+
```
|
136
|
+
|
137
|
+
### Multiple Recipients
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
email = Laneful::Email::Builder.new
|
141
|
+
.from(Laneful::Address.new('sender@example.com'))
|
142
|
+
.to(Laneful::Address.new('user1@example.com'))
|
143
|
+
.to(Laneful::Address.new('user2@example.com', 'User Two'))
|
144
|
+
.cc(Laneful::Address.new('cc@example.com'))
|
145
|
+
.bcc(Laneful::Address.new('bcc@example.com'))
|
146
|
+
.subject('Multiple Recipients')
|
147
|
+
.text_content('This email has multiple recipients.')
|
148
|
+
.build
|
149
|
+
|
150
|
+
response = client.send_email(email)
|
151
|
+
```
|
152
|
+
|
153
|
+
### Scheduled Email
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
# Schedule for 24 hours from now
|
157
|
+
send_time = Time.now.to_i + (24 * 60 * 60)
|
158
|
+
|
159
|
+
email = Laneful::Email::Builder.new
|
160
|
+
.from(Laneful::Address.new('sender@example.com'))
|
161
|
+
.to(Laneful::Address.new('user@example.com'))
|
162
|
+
.subject('Scheduled Email')
|
163
|
+
.text_content('This email was scheduled.')
|
164
|
+
.send_time(send_time)
|
165
|
+
.build
|
166
|
+
|
167
|
+
response = client.send_email(email)
|
168
|
+
```
|
169
|
+
|
170
|
+
### Multiple Emails
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
emails = [
|
174
|
+
Laneful::Email::Builder.new
|
175
|
+
.from(Laneful::Address.new('sender@example.com'))
|
176
|
+
.to(Laneful::Address.new('user1@example.com'))
|
177
|
+
.subject('Email 1')
|
178
|
+
.text_content('First email content.')
|
179
|
+
.build,
|
180
|
+
Laneful::Email::Builder.new
|
181
|
+
.from(Laneful::Address.new('sender@example.com'))
|
182
|
+
.to(Laneful::Address.new('user2@example.com'))
|
183
|
+
.subject('Email 2')
|
184
|
+
.text_content('Second email content.')
|
185
|
+
.build
|
186
|
+
]
|
187
|
+
|
188
|
+
response = client.send_emails(emails)
|
189
|
+
```
|
190
|
+
|
191
|
+
### Custom Timeout
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
client = Laneful::Client.new(
|
195
|
+
'https://your-endpoint.send.laneful.net',
|
196
|
+
'your-auth-token',
|
197
|
+
timeout: 60 # 60 second timeout
|
198
|
+
)
|
199
|
+
```
|
200
|
+
|
201
|
+
## Webhook Verification
|
202
|
+
|
203
|
+
```ruby
|
204
|
+
# In your webhook handler
|
205
|
+
payload = request.body.read
|
206
|
+
signature = request.headers['X-Laneful-Signature']
|
207
|
+
secret = 'your-webhook-secret'
|
208
|
+
|
209
|
+
if Laneful::WebhookVerifier.verify_signature(secret, payload, signature)
|
210
|
+
# Process webhook data
|
211
|
+
data = JSON.parse(payload)
|
212
|
+
# Handle webhook event
|
213
|
+
else
|
214
|
+
# Invalid signature
|
215
|
+
head :unauthorized
|
216
|
+
end
|
217
|
+
```
|
218
|
+
|
219
|
+
## Error Handling
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
begin
|
223
|
+
response = client.send_email(email)
|
224
|
+
puts "Email sent successfully"
|
225
|
+
rescue Laneful::ValidationException => e
|
226
|
+
puts "Validation error: #{e.message}"
|
227
|
+
rescue Laneful::ApiException => e
|
228
|
+
puts "API error: #{e.message}"
|
229
|
+
puts "Status code: #{e.status_code}"
|
230
|
+
puts "Error message: #{e.error_message}"
|
231
|
+
rescue Laneful::HttpException => e
|
232
|
+
puts "HTTP error: #{e.message}"
|
233
|
+
puts "Status code: #{e.status_code}"
|
234
|
+
rescue StandardError => e
|
235
|
+
puts "Unexpected error: #{e.message}"
|
236
|
+
end
|
237
|
+
```
|
238
|
+
|
239
|
+
## API Reference
|
240
|
+
|
241
|
+
### Laneful::Client
|
242
|
+
|
243
|
+
#### Constructor
|
244
|
+
|
245
|
+
```ruby
|
246
|
+
Laneful::Client.new(base_url, auth_token, timeout: 30)
|
247
|
+
```
|
248
|
+
|
249
|
+
- `base_url` - The base URL of the Laneful API
|
250
|
+
- `auth_token` - The authentication token
|
251
|
+
- `timeout` - Request timeout in seconds (optional, default: 30)
|
252
|
+
|
253
|
+
#### Methods
|
254
|
+
|
255
|
+
- `send_email(email)` - Sends a single email
|
256
|
+
- `send_emails(emails)` - Sends multiple emails
|
257
|
+
|
258
|
+
### Laneful::Email::Builder
|
259
|
+
|
260
|
+
#### Required Fields
|
261
|
+
|
262
|
+
- `from(address)` - Sender address
|
263
|
+
|
264
|
+
#### Optional Fields
|
265
|
+
|
266
|
+
- `to(address)` - Recipient addresses
|
267
|
+
- `cc(address)` - CC addresses
|
268
|
+
- `bcc(address)` - BCC addresses
|
269
|
+
- `subject(subject)` - Email subject
|
270
|
+
- `text_content(content)` - Plain text content
|
271
|
+
- `html_content(content)` - HTML content
|
272
|
+
- `template_id(id)` - Template ID
|
273
|
+
- `template_data(data)` - Template data
|
274
|
+
- `attachment(attachment)` - File attachments
|
275
|
+
- `headers(headers)` - Custom headers
|
276
|
+
- `reply_to(address)` - Reply-to address
|
277
|
+
- `send_time(time)` - Scheduled send time (Unix timestamp)
|
278
|
+
- `webhook_data(data)` - Webhook data
|
279
|
+
- `tag(tag)` - Email tag
|
280
|
+
- `tracking(tracking)` - Tracking settings
|
281
|
+
|
282
|
+
### Laneful::Address
|
283
|
+
|
284
|
+
```ruby
|
285
|
+
Laneful::Address.new(email, name = nil)
|
286
|
+
```
|
287
|
+
|
288
|
+
- `email` - The email address (required)
|
289
|
+
- `name` - The display name (optional)
|
290
|
+
|
291
|
+
### Laneful::Attachment
|
292
|
+
|
293
|
+
```ruby
|
294
|
+
# From file
|
295
|
+
Laneful::Attachment.from_file(file_path)
|
296
|
+
|
297
|
+
# From raw data
|
298
|
+
Laneful::Attachment.new(filename, content_type, content)
|
299
|
+
```
|
300
|
+
|
301
|
+
### Laneful::TrackingSettings
|
302
|
+
|
303
|
+
```ruby
|
304
|
+
Laneful::TrackingSettings.new(opens: false, clicks: false, unsubscribes: false)
|
305
|
+
```
|
306
|
+
|
307
|
+
### Laneful::WebhookVerifier
|
308
|
+
|
309
|
+
```ruby
|
310
|
+
Laneful::WebhookVerifier.verify_signature(secret, payload, signature)
|
311
|
+
```
|
312
|
+
|
313
|
+
## Exception Types
|
314
|
+
|
315
|
+
- `Laneful::ValidationException` - Thrown when input validation fails
|
316
|
+
- `Laneful::ApiException` - Thrown when the API returns an error response
|
317
|
+
- `Laneful::HttpException` - Thrown when HTTP communication fails
|
318
|
+
- `Laneful::LanefulException` - Base exception class for all SDK exceptions
|
319
|
+
|
320
|
+
## Development
|
321
|
+
|
322
|
+
### Running Tests
|
323
|
+
|
324
|
+
```bash
|
325
|
+
bundle exec rspec
|
326
|
+
```
|
327
|
+
|
328
|
+
### Code Quality
|
329
|
+
|
330
|
+
```bash
|
331
|
+
bundle exec rubocop
|
332
|
+
```
|
333
|
+
|
334
|
+
### Documentation
|
335
|
+
|
336
|
+
```bash
|
337
|
+
bundle exec yard doc
|
338
|
+
```
|
339
|
+
|
340
|
+
## Publishing to RubyGems
|
341
|
+
|
342
|
+
This SDK can be published to RubyGems using a simple, automated workflow.
|
343
|
+
|
344
|
+
### Prerequisites
|
345
|
+
|
346
|
+
1. **Ruby 3.0+**: Ensure you have Ruby 3.0 or higher installed
|
347
|
+
2. **Bundler**: Install bundler if not already installed (`gem install bundler`)
|
348
|
+
3. **RubyGems API Key**: Get your API key from [RubyGems.org](https://rubygems.org/settings/edit)
|
349
|
+
|
350
|
+
### Setting up your API Key
|
351
|
+
|
352
|
+
```bash
|
353
|
+
export GEM_HOST_API_KEY=your_api_key_here
|
354
|
+
```
|
355
|
+
|
356
|
+
### Publishing Methods
|
357
|
+
|
358
|
+
#### Method 1: Using the Automated Script (Recommended)
|
359
|
+
|
360
|
+
```bash
|
361
|
+
./scripts/publish.sh
|
362
|
+
```
|
363
|
+
|
364
|
+
This script will:
|
365
|
+
|
366
|
+
- Check Ruby version compatibility
|
367
|
+
- Install dependencies
|
368
|
+
- Run all tests
|
369
|
+
- Perform code linting
|
370
|
+
- Build the gem
|
371
|
+
- Publish to RubyGems
|
372
|
+
- Clean up built gem files
|
373
|
+
|
374
|
+
#### Method 2: Using Make Commands
|
375
|
+
|
376
|
+
**Install dependencies:**
|
377
|
+
|
378
|
+
```bash
|
379
|
+
make setup
|
380
|
+
```
|
381
|
+
|
382
|
+
**Run tests:**
|
383
|
+
|
384
|
+
```bash
|
385
|
+
make test
|
386
|
+
```
|
387
|
+
|
388
|
+
**Run linting:**
|
389
|
+
|
390
|
+
```bash
|
391
|
+
make lint
|
392
|
+
```
|
393
|
+
|
394
|
+
**Build the gem:**
|
395
|
+
|
396
|
+
```bash
|
397
|
+
make build
|
398
|
+
```
|
399
|
+
|
400
|
+
**Publish to RubyGems:**
|
401
|
+
|
402
|
+
```bash
|
403
|
+
make publish
|
404
|
+
```
|
405
|
+
|
406
|
+
#### Method 3: Manual Publishing
|
407
|
+
|
408
|
+
**Install dependencies:**
|
409
|
+
|
410
|
+
```bash
|
411
|
+
bundle install
|
412
|
+
```
|
413
|
+
|
414
|
+
**Run tests:**
|
415
|
+
|
416
|
+
```bash
|
417
|
+
bundle exec rspec
|
418
|
+
```
|
419
|
+
|
420
|
+
**Run linting:**
|
421
|
+
|
422
|
+
```bash
|
423
|
+
bundle exec rubocop
|
424
|
+
```
|
425
|
+
|
426
|
+
**Build the gem:**
|
427
|
+
|
428
|
+
```bash
|
429
|
+
gem build laneful-ruby.gemspec
|
430
|
+
```
|
431
|
+
|
432
|
+
**Publish to RubyGems:**
|
433
|
+
|
434
|
+
```bash
|
435
|
+
gem push laneful-ruby-*.gem
|
436
|
+
```
|
437
|
+
|
438
|
+
### Version Management
|
439
|
+
|
440
|
+
Before publishing, make sure to update the version in `lib/laneful/version.rb`:
|
441
|
+
|
442
|
+
```ruby
|
443
|
+
module Laneful
|
444
|
+
VERSION = "1.0.1".freeze # Update this version
|
445
|
+
end
|
446
|
+
```
|
447
|
+
|
448
|
+
Follow [Semantic Versioning](https://semver.org/) guidelines:
|
449
|
+
|
450
|
+
- **MAJOR** version for incompatible API changes
|
451
|
+
- **MINOR** version for backwards-compatible functionality additions
|
452
|
+
- **PATCH** version for backwards-compatible bug fixes
|
453
|
+
|
454
|
+
## License
|
455
|
+
|
456
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
data/Rakefile
ADDED
data/examples/Gemfile
ADDED
data/examples/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Laneful Ruby SDK Examples
|
2
|
+
|
3
|
+
This directory contains example code demonstrating how to use the Laneful Ruby SDK.
|
4
|
+
|
5
|
+
## Quick Start
|
6
|
+
|
7
|
+
1. **Install the gem:**
|
8
|
+
```bash
|
9
|
+
gem install laneful-ruby
|
10
|
+
```
|
11
|
+
|
12
|
+
2. **Or use Bundler:**
|
13
|
+
```bash
|
14
|
+
cd examples
|
15
|
+
bundle install
|
16
|
+
```
|
17
|
+
|
18
|
+
3. **Configure the example:**
|
19
|
+
Edit `simple_example.rb` and replace the placeholder values:
|
20
|
+
- `base_url`: Your Laneful endpoint URL
|
21
|
+
- `auth_token`: Your authentication token
|
22
|
+
- Email addresses: Replace with your actual email addresses
|
23
|
+
|
24
|
+
4. **Run the example:**
|
25
|
+
```bash
|
26
|
+
ruby simple_example.rb
|
27
|
+
```
|
28
|
+
|
29
|
+
## Example Files
|
30
|
+
|
31
|
+
- **`simple_example.rb`**: Demonstrates basic email sending functionality including:
|
32
|
+
- Simple text email
|
33
|
+
- HTML email with tracking
|
34
|
+
- Email with CC recipients
|
35
|
+
- Error handling
|
36
|
+
|
37
|
+
## Configuration
|
38
|
+
|
39
|
+
Before running the examples, make sure to:
|
40
|
+
|
41
|
+
1. **Get your credentials** from your Laneful dashboard
|
42
|
+
2. **Update the configuration** in the example files:
|
43
|
+
```ruby
|
44
|
+
base_url = 'https://your-endpoint.send.laneful.net'
|
45
|
+
auth_token = 'your-auth-token'
|
46
|
+
```
|
47
|
+
3. **Use valid email addresses** for testing
|
48
|
+
|
49
|
+
## More Examples
|
50
|
+
|
51
|
+
For more comprehensive examples and API documentation, visit:
|
52
|
+
- [Laneful Ruby SDK Documentation](https://docs.laneful.com/ruby)
|
53
|
+
- [GitHub Repository](https://github.com/laneful/laneful-ruby)
|