postmark_ruby_client 0.1.0

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.
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "time"
4
+
5
+ require_relative "postmark_client/version"
6
+ require_relative "postmark_client/errors"
7
+ require_relative "postmark_client/configuration"
8
+ require_relative "postmark_client/client/base"
9
+ require_relative "postmark_client/models/attachment"
10
+ require_relative "postmark_client/models/email"
11
+ require_relative "postmark_client/models/email_response"
12
+ require_relative "postmark_client/resources/emails"
13
+
14
+ # PostmarkClient is a Ruby gem for interacting with the Postmark transactional email API.
15
+ # It provides a clean, extensible interface for sending emails via Postmark.
16
+ #
17
+ # @example Basic configuration
18
+ # PostmarkClient.configure do |config|
19
+ # config.api_token = ENV["POSTMARK_API_TOKEN"]
20
+ # end
21
+ #
22
+ # @example Sending an email
23
+ # email = PostmarkClient::Email.new(
24
+ # from: "sender@example.com",
25
+ # to: "recipient@example.com",
26
+ # subject: "Hello!",
27
+ # text_body: "Hello, World!"
28
+ # )
29
+ #
30
+ # client = PostmarkClient::Resources::Emails.new
31
+ # response = client.send(email)
32
+ # puts response.message_id if response.success?
33
+ #
34
+ # @example Using the convenience method
35
+ # client = PostmarkClient::Resources::Emails.new
36
+ # response = client.send_email(
37
+ # from: "sender@example.com",
38
+ # to: "recipient@example.com",
39
+ # subject: "Hello!",
40
+ # text_body: "Hello, World!"
41
+ # )
42
+ #
43
+ # @see https://postmarkapp.com/developer Postmark API Documentation
44
+ module PostmarkClient
45
+ class << self
46
+ # Convenience method to create an Emails client
47
+ #
48
+ # @param api_token [String, nil] optional API token override
49
+ # @return [Resources::Emails] an Emails client instance
50
+ #
51
+ # @example
52
+ # response = PostmarkClient.emails.send_email(
53
+ # from: "sender@example.com",
54
+ # to: "recipient@example.com",
55
+ # subject: "Hello!",
56
+ # text_body: "Hello, World!"
57
+ # )
58
+ def emails(api_token: nil)
59
+ Resources::Emails.new(api_token: api_token)
60
+ end
61
+
62
+ # Send an email using the default configuration
63
+ #
64
+ # @param email [Email, Hash] the email to send
65
+ # @return [EmailResponse] the API response
66
+ #
67
+ # @example
68
+ # PostmarkClient.deliver(
69
+ # from: "sender@example.com",
70
+ # to: "recipient@example.com",
71
+ # subject: "Hello!",
72
+ # text_body: "Hello, World!"
73
+ # )
74
+ def deliver(email)
75
+ emails.send(email.is_a?(Hash) ? Email.new(**email) : email)
76
+ end
77
+ end
78
+ end
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: postmark_ruby_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alvaro Delgado
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: base64
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '0.1'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '0.1'
26
+ - !ruby/object:Gem::Dependency
27
+ name: faraday
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ - - "<"
34
+ - !ruby/object:Gem::Version
35
+ version: '3.0'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '2.0'
43
+ - - "<"
44
+ - !ruby/object:Gem::Version
45
+ version: '3.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: faraday-multipart
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.0'
53
+ type: :runtime
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.0'
60
+ - !ruby/object:Gem::Dependency
61
+ name: bundler
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '2.0'
74
+ - !ruby/object:Gem::Dependency
75
+ name: rake
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '13.0'
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '13.0'
88
+ - !ruby/object:Gem::Dependency
89
+ name: rspec
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '3.12'
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '3.12'
102
+ - !ruby/object:Gem::Dependency
103
+ name: webmock
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '3.19'
109
+ type: :development
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '3.19'
116
+ - !ruby/object:Gem::Dependency
117
+ name: yard
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '0.9'
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '0.9'
130
+ - !ruby/object:Gem::Dependency
131
+ name: simplecov
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '0.22'
137
+ type: :development
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '0.22'
144
+ description: A clean, extensible Ruby client for the Postmark transactional email
145
+ API. Built with Faraday and designed for Rails 8+ applications.
146
+ email:
147
+ - hola@alvarodelgado.dev
148
+ executables: []
149
+ extensions: []
150
+ extra_rdoc_files: []
151
+ files:
152
+ - ".rspec"
153
+ - CHANGELOG.md
154
+ - LICENSE.txt
155
+ - README.md
156
+ - Rakefile
157
+ - lib/postmark_client.rb
158
+ - lib/postmark_client/client/base.rb
159
+ - lib/postmark_client/configuration.rb
160
+ - lib/postmark_client/errors.rb
161
+ - lib/postmark_client/models/attachment.rb
162
+ - lib/postmark_client/models/email.rb
163
+ - lib/postmark_client/models/email_response.rb
164
+ - lib/postmark_client/resources/emails.rb
165
+ - lib/postmark_client/version.rb
166
+ homepage: https://github.com/AAlvAAro/postmark_ruby_client
167
+ licenses:
168
+ - MIT
169
+ metadata:
170
+ allowed_push_host: https://rubygems.org
171
+ source_code_uri: https://github.com/AAlvAAro/postmark_ruby_client
172
+ changelog_uri: https://github.com/AAlvAAro/postmark_ruby_client/blob/main/CHANGELOG.md
173
+ rubygems_mfa_required: 'true'
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: 3.2.0
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubygems_version: 3.6.9
189
+ specification_version: 4
190
+ summary: A Ruby gem for interacting with the Postmark API
191
+ test_files: []