helo-email-sdk 1.1.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24f067959418c6bacc218f81802bbcbda0eacedd25e5bc16f156c4e6e7ef2192
4
- data.tar.gz: 1ee808b62e899e0df4a98e9c24385f5045df97daba11d55301a3312fb064bb03
3
+ metadata.gz: 84b8003d01a3e6278f8dff8ff9fba2a336475c5742fc2ac056c48af1137da1e8
4
+ data.tar.gz: a5de4d620766c12163910d1636c8fa2608d61eef455b28d336d1e4937e7ffb82
5
5
  SHA512:
6
- metadata.gz: b06dc543d3d8773f415b3d0413c5524006742af0a6a6cb74a750a8e4ac9a552f83e24d631917b84cafb3810022694e953ab7a3034d6e6ab40a16d724afddd389
7
- data.tar.gz: f07bba17cd695cb7728cef33bc396222c78208d541c0e331a15e8abff22b9beb77ee3bfdc4c00ae539618343ab994265822e8239294041c54f09be33d4a1a9bb
6
+ metadata.gz: e019cbeb7967169e5a6dc3f44c0a7ac82bc807be292495e70ac17b181a02eddd8157ab2346f1f8c0a46eb20745b60f84caec37902c39ba9db4f2aa46ee0fba4d
7
+ data.tar.gz: 951d97625eb2944af8713e90b02fcac28a3a7d2be603871ffa553d6a0f51370bd3ec4f43cb96020a65011ef07469fff7b7b22ce4e2fbc30fcde48d60c29f53af
data/README.md CHANGED
@@ -167,4 +167,5 @@ To compute a signature yourself — signing a fixture in tests, for example —
167
167
  - [Helo::Broadcasts](docs/Broadcasts.md)
168
168
  - [Helo::Statistics](docs/Statistics.md)
169
169
  - [Helo::Suppressions](docs/Suppressions.md)
170
+ - [Helo::Templates](docs/Templates.md)
170
171
  - [Helo::Webhooks](docs/Webhooks.md)
@@ -20,4 +20,7 @@ module Helo
20
20
  @_json_response ||= response_body.try(:deep_symbolize_keys) || {}
21
21
  end
22
22
  end
23
+
24
+ class ConnectionError < APIError
25
+ end
23
26
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class Templates < API
5
+ def list(request_data = {})
6
+ request = TemplatesListRequest.new(request_data)
7
+ response = @client.request(:get, "/templates", params: request.to_params)
8
+ PaginatedResponseOfTemplateSummaryResponse.from_hash(response.body)
9
+ end
10
+
11
+ def create(request_data)
12
+ request = CreateTemplateRequest.new(request_data)
13
+ response = @client.request(:post, "/templates", body: request.to_params)
14
+ TemplateResponse.from_hash(response.body)
15
+ end
16
+
17
+ def render_draft(request_data)
18
+ request = RenderDraftRequest.new(request_data)
19
+ response = @client.request(:post, "/templates/render", body: request.to_params)
20
+ RenderTemplateResponse.from_hash(response.body)
21
+ end
22
+
23
+ def retrieve(id)
24
+ response = @client.request(:get, "/templates/#{id}")
25
+ TemplateResponse.from_hash(response.body)
26
+ end
27
+
28
+ def update(id, request_data)
29
+ request = UpdateTemplateRequest.new(request_data)
30
+ response = @client.request(:patch, "/templates/#{id}", body: request.to_params)
31
+ TemplateResponse.from_hash(response.body)
32
+ end
33
+
34
+ def delete(id)
35
+ response = @client.request(:delete, "/templates/#{id}")
36
+ nil
37
+ end
38
+
39
+ def render(id, request_data)
40
+ request = RenderTemplateRequest.new(request_data)
41
+ response = @client.request(:post, "/templates/#{id}/render", body: request.to_params)
42
+ RenderTemplateResponse.from_hash(response.body)
43
+ end
44
+
45
+ class_methods :list, :create, :render_draft, :retrieve, :update, :delete, :render
46
+ end
47
+ end
data/lib/helo/client.rb CHANGED
@@ -22,7 +22,7 @@ module Helo
22
22
  end
23
23
 
24
24
  def handle_connection_error(exception)
25
- raise APIError.new("Connection failed: #{exception.message}")
25
+ raise ConnectionError.new("Connection failed: #{exception.message}")
26
26
  end
27
27
  end
28
28
  end
@@ -6,5 +6,6 @@ module Helo
6
6
 
7
7
  api_attribute :name, :string, key: "name"
8
8
  api_attribute :channel_ids, key: "channelIds"
9
+ api_attribute :enable_custom_tracking, :boolean, key: "enableCustomTracking"
9
10
  end
10
11
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class CreateTemplateRequest
5
+ include Helo::Core::Model
6
+
7
+ api_attribute :name, :string, key: "name"
8
+ api_attribute :subject, :string, key: "subject"
9
+ api_attribute :html, :string, key: "html"
10
+ api_attribute :mjml, :string, key: "mjml"
11
+ api_attribute :text, :string, key: "text"
12
+ api_attribute :channel_ids, key: "channelIds"
13
+ end
14
+ end
@@ -7,5 +7,6 @@ module Helo
7
7
  api_attribute :domain_key_active, Helo::Core::ModelType.new("Helo::DnsRecordResponse"), key: "domainKeyActive"
8
8
  api_attribute :domain_key_pending, Helo::Core::ModelType.new("Helo::DnsRecordResponse"), key: "domainKeyPending"
9
9
  api_attribute :return_path, Helo::Core::ArrayType.new("Helo::DnsRecordResponse"), key: "returnPath"
10
+ api_attribute :tracking, Helo::Core::ModelType.new("Helo::DnsRecordResponse"), key: "tracking"
10
11
  end
11
12
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class PaginatedResponseOfTemplateSummaryResponse
5
+ include Helo::Core::Model
6
+
7
+ api_attribute :total_count, :integer, key: "totalCount"
8
+ api_attribute :results, Helo::Core::ArrayType.new("Helo::TemplateSummaryResponse"), key: "results"
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class RenderDraftRequest
5
+ include Helo::Core::Model
6
+
7
+ api_attribute :subject, :string, key: "subject"
8
+ api_attribute :html, :string, key: "html"
9
+ api_attribute :mjml, :string, key: "mjml"
10
+ api_attribute :text, :string, key: "text"
11
+ api_attribute :inline_styles, :boolean, key: "inlineStyles"
12
+ api_attribute :data, key: "data"
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class RenderTemplateRequest
5
+ include Helo::Core::Model
6
+
7
+ api_attribute :inline_styles, :boolean, key: "inlineStyles"
8
+ api_attribute :data, key: "data"
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class RenderTemplateResponse
5
+ include Helo::Core::Model
6
+
7
+ api_attribute :subject, :string, key: "subject"
8
+ api_attribute :html, :string, key: "html"
9
+ api_attribute :text, :string, key: "text"
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class TemplateResponse
5
+ include Helo::Core::Model
6
+
7
+ api_attribute :id, :string, key: "id"
8
+ api_attribute :created_at, :datetime, key: "createdAt"
9
+ api_attribute :updated_at, :datetime, key: "updatedAt"
10
+ api_attribute :version, :integer, key: "version"
11
+ api_attribute :name, :string, key: "name"
12
+ api_attribute :subject, :string, key: "subject"
13
+ api_attribute :html, :string, key: "html"
14
+ api_attribute :mjml, :string, key: "mjml"
15
+ api_attribute :text, :string, key: "text"
16
+ api_attribute :channel_ids, key: "channelIds"
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class TemplateSummaryResponse
5
+ include Helo::Core::Model
6
+
7
+ api_attribute :id, :string, key: "id"
8
+ api_attribute :created_at, :datetime, key: "createdAt"
9
+ api_attribute :updated_at, :datetime, key: "updatedAt"
10
+ api_attribute :name, :string, key: "name"
11
+ api_attribute :subject, :string, key: "subject"
12
+ api_attribute :channel_ids, key: "channelIds"
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ # Generated request model for query parameters
5
+ class TemplatesListRequest
6
+ include Helo::Core::Model
7
+
8
+ api_attribute :limit, :integer, key: "limit"
9
+ api_attribute :offset, :integer, key: "offset"
10
+ api_attribute :name, :string, key: "name"
11
+ api_attribute :channel_ids, key: "channelIds", explode: false
12
+ end
13
+ end
@@ -5,5 +5,6 @@ module Helo
5
5
  include Helo::Core::Model
6
6
 
7
7
  api_attribute :channel_ids, key: "channelIds"
8
+ api_attribute :enable_custom_tracking, :boolean, key: "enableCustomTracking"
8
9
  end
9
10
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helo
4
+ class UpdateTemplateRequest
5
+ include Helo::Core::Model
6
+
7
+ api_attribute :name, :string, key: "name"
8
+ api_attribute :subject, :string, key: "subject"
9
+ api_attribute :html, :string, key: "html", nullable: true
10
+ api_attribute :mjml, :string, key: "mjml", nullable: true
11
+ api_attribute :text, :string, key: "text", nullable: true
12
+ api_attribute :channel_ids, key: "channelIds", nullable: true
13
+ api_attribute :version, :integer, key: "version"
14
+ end
15
+ end
data/lib/helo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Helo
4
- VERSION = "1.1.0"
4
+ VERSION = "1.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helo-email-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Helo Email
@@ -111,6 +111,7 @@ files:
111
111
  - lib/helo/apis/sending.rb
112
112
  - lib/helo/apis/statistics.rb
113
113
  - lib/helo/apis/suppressions.rb
114
+ - lib/helo/apis/templates.rb
114
115
  - lib/helo/apis/webhooks.rb
115
116
  - lib/helo/client.rb
116
117
  - lib/helo/configuration.rb
@@ -161,6 +162,7 @@ files:
161
162
  - lib/helo/models/create_domain_request.rb
162
163
  - lib/helo/models/create_suppressions_request.rb
163
164
  - lib/helo/models/create_suppressions_response.rb
165
+ - lib/helo/models/create_template_request.rb
164
166
  - lib/helo/models/create_webhook_request.rb
165
167
  - lib/helo/models/delivered_details.rb
166
168
  - lib/helo/models/delivery_stats.rb
@@ -198,6 +200,7 @@ files:
198
200
  - lib/helo/models/paginated_response_of_broadcast_suppression.rb
199
201
  - lib/helo/models/paginated_response_of_domain_response.rb
200
202
  - lib/helo/models/paginated_response_of_suppression_response.rb
203
+ - lib/helo/models/paginated_response_of_template_summary_response.rb
201
204
  - lib/helo/models/pagination_result_of_channel_basic_response.rb
202
205
  - lib/helo/models/pagination_result_of_webhook_response.rb
203
206
  - lib/helo/models/recipient_complained_webhook_payload.rb
@@ -208,6 +211,9 @@ files:
208
211
  - lib/helo/models/remove_suppression_result.rb
209
212
  - lib/helo/models/remove_suppressions_request.rb
210
213
  - lib/helo/models/remove_suppressions_response.rb
214
+ - lib/helo/models/render_draft_request.rb
215
+ - lib/helo/models/render_template_request.rb
216
+ - lib/helo/models/render_template_response.rb
211
217
  - lib/helo/models/resubscribed_details.rb
212
218
  - lib/helo/models/return_path_domain_verification_failed_payload.rb
213
219
  - lib/helo/models/return_path_domain_verified_payload.rb
@@ -235,10 +241,14 @@ files:
235
241
  - lib/helo/models/suppression_response.rb
236
242
  - lib/helo/models/suppression_result.rb
237
243
  - lib/helo/models/suppressions_list_request.rb
244
+ - lib/helo/models/template_response.rb
245
+ - lib/helo/models/template_summary_response.rb
246
+ - lib/helo/models/templates_list_request.rb
238
247
  - lib/helo/models/unsubscribed_details.rb
239
248
  - lib/helo/models/update_channel_request.rb
240
249
  - lib/helo/models/update_channel_tracking.rb
241
250
  - lib/helo/models/update_domain_request.rb
251
+ - lib/helo/models/update_template_request.rb
242
252
  - lib/helo/models/update_webhook_request.rb
243
253
  - lib/helo/models/validation_error.rb
244
254
  - lib/helo/models/webhook_header.rb