laneful-ruby 1.1.0 → 1.1.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
2
  SHA256:
3
- metadata.gz: 3b7c5f86e1e341b49312a27486067c2427323569459dba65f8fb2b247629a1fb
4
- data.tar.gz: 649ca87028b16f0ede2b1e063390fe13043e12401e70e4637d6c69922d7b415e
3
+ metadata.gz: 4cebf80375fe3b41ce712f115c4e291c6f7ff0a9ceb4cf90de829422966b970b
4
+ data.tar.gz: 7fee98bf4a843ffe95123f1c544545760fd4f943651199619b93450e37c7727e
5
5
  SHA512:
6
- metadata.gz: 1d0b108965868436f5b4cbdc6208891bfa51b877a3ec7b70cc4bf13745b793aeb8676d284e010e446acd27de221637c38e005d8399dde5a60adfaf3bf2ae9749
7
- data.tar.gz: a50c27e76b6f4b47a8cc6ecee7e5b863bc6f3106127ba9e22e9e822e3b803c809c42202e78412b4b2afe5ab5afcafcbcb2f10c16d78dc923f57e453ca8b14c6b
6
+ metadata.gz: 11e4cea266db6d53a73958d9bf4b6a4106c31fe1cb7bcba62f52959444fc9c70d2b2432906bb4c540365b0edbe76af09d4f55a80f84a1f16445595d0f8242cce
7
+ data.tar.gz: 0f94b21d5267eb709cbada7cca3225f2eb4a6cebdfa694a2d63caec3d2fc7a7bf3f375e564cbedec8632fd08c91b0546a883175a9d591661c759bf562de82270
@@ -124,12 +124,13 @@ module Laneful
124
124
 
125
125
  # Creates an attachment from a hash representation
126
126
  def self.from_hash(data)
127
- new(data['filename'], data['content_type'], data['content'])
127
+ filename = data['file_name'] || data['filename'] # Support both field names
128
+ new(filename, data['content_type'], data['content'])
128
129
  end
129
130
 
130
131
  def to_hash
131
132
  {
132
- 'filename' => filename,
133
+ 'file_name' => filename,
133
134
  'content_type' => content_type,
134
135
  'content' => content
135
136
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Laneful
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laneful-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laneful Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-09-08 00:00:00.000000000 Z
11
+ date: 2025-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -46,21 +46,12 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".rubocop.yml"
50
- - LICENSE
51
- - Makefile
52
- - README.md
53
- - Rakefile
54
- - examples/Gemfile
55
- - examples/simple_example.rb
56
- - laneful-ruby.gemspec
57
49
  - lib/laneful.rb
58
50
  - lib/laneful/client.rb
59
51
  - lib/laneful/exceptions.rb
60
52
  - lib/laneful/models.rb
61
53
  - lib/laneful/version.rb
62
54
  - lib/laneful/webhooks.rb
63
- - scripts/publish.sh
64
55
  homepage: https://github.com/laneful/laneful-ruby
65
56
  licenses:
66
57
  - MIT
data/.rubocop.yml DELETED
@@ -1,31 +0,0 @@
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 DELETED
@@ -1,21 +0,0 @@
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 DELETED
@@ -1,49 +0,0 @@
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 DELETED
@@ -1,343 +0,0 @@
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-webhook-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
- ## License
341
-
342
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
343
-
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
data/examples/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'laneful-ruby'
@@ -1,123 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'laneful'
5
-
6
- # Simple example demonstrating basic usage of the Laneful Ruby SDK
7
- puts '📧 Laneful Ruby SDK - Simple Example'
8
- puts "====================================\n"
9
-
10
- # Configuration - Replace with your actual credentials
11
- base_url = 'https://your-subdomain.z1.send.dev.laneful.net'
12
- auth_token = 'priv-YourAuthTokenHere'
13
-
14
- # Email addresses - Replace with your actual addresses
15
- sender_email = 'sender@yourdomain.com'
16
- sender_name = 'Your Name'
17
- recipient_email = 'recipient@example.com'
18
- recipient_name = 'Recipient Name'
19
- cc_email = 'cc@example.com'
20
- cc_name = 'CC Recipient'
21
-
22
- # Create client
23
- begin
24
- client = Laneful::Client.new(base_url, auth_token)
25
- puts '✅ Client created successfully'
26
- rescue Laneful::ValidationException => e
27
- puts "❌ Failed to create client: #{e.message}"
28
- puts 'Please check your base_url and auth_token configuration.'
29
- exit 1
30
- end
31
-
32
- # Test 1: Send a simple text email
33
- puts "\n📝 Test 1: Sending Simple Text Email"
34
- puts '------------------------------------'
35
-
36
- begin
37
- email = Laneful::Email::Builder.new
38
- .from(Laneful::Address.new(sender_email, sender_name))
39
- .to(Laneful::Address.new(recipient_email, recipient_name))
40
- .subject('Hello from Laneful Ruby SDK! 🚀')
41
- .text_content('Hi! This is a test email sent using the Laneful Ruby SDK. ' \
42
- 'The SDK is working perfectly!')
43
- .tag('ruby-sdk-test')
44
- .build
45
-
46
- response = client.send_email(email)
47
- puts '✅ Simple email sent successfully!'
48
- puts "Response: #{response}"
49
- rescue Laneful::ValidationException => e
50
- puts "❌ Validation error: #{e.message}"
51
- rescue Laneful::ApiException => e
52
- puts "❌ API error: #{e.message} (Status: #{e.status_code})"
53
- puts " Details: #{e.error_message}" if e.error_message
54
- rescue Laneful::HttpException => e
55
- puts "❌ HTTP error: #{e.message} (Status: #{e.status_code})"
56
- end
57
-
58
- # Test 2: Send an HTML email with CC
59
- puts "\n🎨 Test 2: Sending HTML Email with CC"
60
- puts '-------------------------------------'
61
-
62
- begin
63
- tracking = Laneful::TrackingSettings.new(opens: true, clicks: true, unsubscribes: false)
64
-
65
- email = Laneful::Email::Builder.new
66
- .from(Laneful::Address.new(sender_email, sender_name))
67
- .to(Laneful::Address.new(recipient_email, recipient_name))
68
- .cc(Laneful::Address.new(cc_email, cc_name))
69
- .subject('Ruby SDK Test - HTML Email with Tracking 📧')
70
- .html_content(<<~HTML)
71
- <!DOCTYPE html>
72
- <html>
73
- <head>
74
- <title>Ruby SDK Test</title>
75
- </head>
76
- <body style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 20px;">
77
- <h1 style="color: #2c3e50;">🎉 Ruby SDK Test Successful!</h1>
78
- <p>Hello! This email was sent using the <strong>Laneful Ruby SDK</strong> with modern Ruby features:</p>
79
- <ul style="background-color: #f8f9fa; padding: 15px; border-radius: 5px;">
80
- <li>✅ Frozen string literals for immutability</li>
81
- <li>✅ Keyword arguments for clean APIs</li>
82
- <li>✅ Safe navigation operator (&.)</li>
83
- <li>✅ Enhanced exception handling</li>
84
- <li>✅ Modern Ruby syntax throughout</li>
85
- </ul>
86
- <p style="color: #7f8c8d;">This email has tracking enabled for opens and clicks.</p>
87
- <hr style="border: none; border-top: 1px solid #eee; margin: 20px 0;">
88
- <p style="font-size: 12px; color: #95a5a6;">
89
- Sent from: #{sender_email}<br>
90
- To: #{recipient_email}<br>
91
- CC: #{cc_email}
92
- </p>
93
- </body>
94
- </html>
95
- HTML
96
- .text_content('Ruby SDK Test Successful! Hello! This email was sent using ' \
97
- 'the Laneful Ruby SDK with modern Ruby features including ' \
98
- 'frozen string literals, keyword arguments, safe navigation ' \
99
- 'operator, and enhanced exception handling. This email has ' \
100
- 'tracking enabled for opens and clicks.')
101
- .tracking(tracking)
102
- .tag('html-cc-test')
103
- .build
104
-
105
- response = client.send_email(email)
106
- puts '✅ HTML email with CC sent successfully!'
107
- puts "Response: #{response}"
108
- rescue Laneful::ValidationException => e
109
- puts "❌ Validation error: #{e.message}"
110
- rescue Laneful::ApiException => e
111
- puts "❌ API error: #{e.message} (Status: #{e.status_code})"
112
- puts " Details: #{e.error_message}" if e.error_message
113
- rescue Laneful::HttpException => e
114
- puts "❌ HTTP error: #{e.message} (Status: #{e.status_code})"
115
- end
116
-
117
- puts "\n🎉 Tests completed!"
118
- puts "\n📋 Summary:"
119
- puts ' • Ruby SDK is working correctly'
120
- puts ' • Real API endpoint is accessible'
121
- puts ' • Email building and sending functionality is operational'
122
- puts ' • Error handling is working properly'
123
- puts "\n💡 Check your email inboxes for the test emails!"
data/laneful-ruby.gemspec DELETED
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/laneful/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'laneful-ruby'
7
- spec.version = Laneful::VERSION
8
- spec.authors = ['Laneful Team']
9
- spec.email = ['support@laneful.com']
10
-
11
- spec.summary = 'Ruby SDK for the Laneful email API'
12
- spec.description = 'A modern Ruby client library for the Laneful email API, ' \
13
- 'providing easy integration for email sending, webhooks, and analytics.'
14
- spec.homepage = 'https://github.com/laneful/laneful-ruby'
15
- spec.license = 'MIT'
16
- spec.required_ruby_version = '>= 3.0.0'
17
-
18
- spec.metadata['homepage_uri'] = spec.homepage
19
- spec.metadata['source_code_uri'] = 'https://github.com/laneful/laneful-ruby'
20
- spec.metadata['changelog_uri'] = 'https://github.com/laneful/laneful-ruby/blob/main/CHANGELOG.md'
21
- spec.metadata['documentation_uri'] = 'https://docs.laneful.com/ruby'
22
- spec.metadata['rubygems_mfa_required'] = 'true'
23
-
24
- # Specify which files should be added to the gem when it is released.
25
- spec.files = Dir.chdir(__dir__) do
26
- `git ls-files -z`.split("\x0").reject do |f|
27
- (File.expand_path(f) == __FILE__) ||
28
- f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
29
- end
30
- end
31
- spec.bindir = 'exe'
32
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
- spec.require_paths = ['lib']
34
-
35
- # Dependencies
36
- spec.add_dependency 'httparty', '~> 0.21'
37
- spec.add_dependency 'json', '~> 2.6'
38
- end
data/scripts/publish.sh DELETED
@@ -1,169 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Laneful Ruby SDK Publishing Script
4
- # This script handles the complete publishing workflow to RubyGems
5
-
6
- set -e
7
-
8
- # Colors for output
9
- RED='\033[0;31m'
10
- GREEN='\033[0;32m'
11
- YELLOW='\033[1;33m'
12
- BLUE='\033[0;34m'
13
- NC='\033[0m' # No Color
14
-
15
- # Function to print colored output
16
- print_status() {
17
- echo -e "${BLUE}[INFO]${NC} $1"
18
- }
19
-
20
- print_success() {
21
- echo -e "${GREEN}[SUCCESS]${NC} $1"
22
- }
23
-
24
- print_warning() {
25
- echo -e "${YELLOW}[WARNING]${NC} $1"
26
- }
27
-
28
- print_error() {
29
- echo -e "${RED}[ERROR]${NC} $1"
30
- }
31
-
32
- # Check if required environment variables are set
33
- check_environment() {
34
- print_status "Checking environment variables..."
35
-
36
- if [ -z "$GEM_HOST_API_KEY" ]; then
37
- print_error "GEM_HOST_API_KEY environment variable is not set"
38
- print_status "Please set your RubyGems API key:"
39
- print_status "export GEM_HOST_API_KEY=your_api_key_here"
40
- exit 1
41
- fi
42
-
43
- print_success "Environment variables are set"
44
- }
45
-
46
- # Check if we're in the right directory
47
- check_directory() {
48
- if [ ! -f "laneful-ruby.gemspec" ]; then
49
- print_error "laneful-ruby.gemspec not found. Please run this script from the project root."
50
- exit 1
51
- fi
52
- print_success "Found gemspec file"
53
- }
54
-
55
- # Check Ruby version
56
- check_ruby_version() {
57
- print_status "Checking Ruby version..."
58
- ruby_version=$(ruby -v | cut -d' ' -f2)
59
- required_version="3.0.0"
60
-
61
- if [ "$(printf '%s\n' "$required_version" "$ruby_version" | sort -V | head -n1)" = "$required_version" ]; then
62
- print_success "Ruby version $ruby_version is compatible"
63
- else
64
- print_error "Ruby version $ruby_version is not compatible. Required: $required_version or higher"
65
- exit 1
66
- fi
67
- }
68
-
69
- # Install dependencies
70
- install_dependencies() {
71
- print_status "Installing dependencies..."
72
- bundle install
73
- if [ $? -eq 0 ]; then
74
- print_success "Dependencies installed successfully"
75
- else
76
- print_error "Failed to install dependencies. Aborting publish."
77
- exit 1
78
- fi
79
- }
80
-
81
- # Run tests
82
- run_tests() {
83
- print_status "Running tests..."
84
- bundle exec rspec
85
- if [ $? -eq 0 ]; then
86
- print_success "All tests passed"
87
- else
88
- print_error "Tests failed. Aborting publish."
89
- exit 1
90
- fi
91
- }
92
-
93
- # Run linting
94
- run_lint() {
95
- print_status "Running linter..."
96
- bundle exec rubocop
97
- if [ $? -eq 0 ]; then
98
- print_success "Linting passed"
99
- else
100
- print_error "Linting failed. Aborting publish."
101
- exit 1
102
- fi
103
- }
104
-
105
- # Build the gem
106
- build_gem() {
107
- print_status "Building gem..."
108
- gem build laneful-ruby.gemspec
109
- if [ $? -eq 0 ]; then
110
- print_success "Gem built successfully"
111
- else
112
- print_error "Gem build failed. Aborting publish."
113
- exit 1
114
- fi
115
- }
116
-
117
- # Publish to RubyGems
118
- publish_gem() {
119
- print_status "Publishing to RubyGems..."
120
- gem push laneful-ruby-*.gem
121
- if [ $? -eq 0 ]; then
122
- print_success "Gem published successfully to RubyGems!"
123
- else
124
- print_error "Failed to publish gem to RubyGems."
125
- exit 1
126
- fi
127
- }
128
-
129
- # Clean up
130
- cleanup() {
131
- print_status "Cleaning up..."
132
- rm -f laneful-ruby-*.gem
133
- print_success "Cleanup completed"
134
- }
135
-
136
- # Main execution
137
- main() {
138
- print_status "Starting Laneful Ruby SDK publishing process..."
139
-
140
- check_environment
141
- check_directory
142
- check_ruby_version
143
- install_dependencies
144
-
145
- # Ask for confirmation
146
- echo
147
- print_warning "This will publish the gem to RubyGems. Are you sure? (y/N)"
148
- read -r response
149
- if [[ ! "$response" =~ ^[Yy]$ ]]; then
150
- print_status "Publishing cancelled."
151
- exit 0
152
- fi
153
-
154
- run_tests
155
- run_lint
156
- build_gem
157
- publish_gem
158
- cleanup
159
-
160
- print_success "Publishing process completed successfully!"
161
- print_status "Your gem is now available on RubyGems: https://rubygems.org/gems/laneful-ruby"
162
- }
163
-
164
- # Handle script interruption
165
- trap cleanup EXIT
166
-
167
- # Run main function
168
- main "$@"
169
-