unione-ruby 1.0.0 → 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 +4 -4
- data/README.md +1 -2
- data/examples/api/custom_api.rb +0 -1
- data/examples/api/domain.rb +0 -1
- data/examples/api/email/attachments.rb +0 -1
- data/examples/api/email/multiple_recipients.rb +0 -1
- data/examples/api/email/settings.rb +0 -1
- data/examples/api/email/subscribe.rb +0 -1
- data/examples/api/email/template.rb +0 -1
- data/examples/api/event_dump.rb +0 -1
- data/examples/api/project.rb +0 -1
- data/examples/api/suppression.rb +0 -1
- data/examples/api/system.rb +0 -1
- data/examples/api/tag.rb +0 -1
- data/examples/api/template.rb +0 -1
- data/examples/api/unsubscribed.rb +0 -1
- data/examples/api/webhook.rb +0 -1
- data/examples/helpers.rb +0 -1
- data/examples/setup.rb +0 -1
- data/lib/unione/client.rb +1 -1
- data/lib/unione/helpers/mail/mail.rb +42 -0
- data/lib/unione/helpers/template/template.rb +32 -0
- data/lib/unione/helpers/webhook/webhook.rb +18 -0
- data/lib/unione/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 723f886c86c9fcef331e71f468bfdd747ca7abeafb63cc4008c2401ac84da507
|
|
4
|
+
data.tar.gz: '0498a65064ce7c6dbf1904da0e0d034ee1df39cf056b16ffc00185602f392bfd'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3acfce371615ce3688eac8d3b827712e0f907bef46dd52404236901a26cb28bacb60da4249d6c2522fb7ed14ced4ad8987a11ca18ba273ed543bdd76a5cf72c6
|
|
7
|
+
data.tar.gz: 9ed9e2bd82d602963b1d367d5e359035f0f64782dabebd71ef9d60ae23861a4df9620426f518d6fad8040565a84b0b97130d16efad48c45b7c2dfdbfec3bf7ff
|
data/README.md
CHANGED
|
@@ -10,7 +10,7 @@ UniOne (unione.io) integration gem for Ruby
|
|
|
10
10
|
|
|
11
11
|
## Working with API responses
|
|
12
12
|
|
|
13
|
-
This library
|
|
13
|
+
This library uses [faraday](https://github.com/lostisland/faraday) gem for making HTTP queries along with [mashify middleware](https://github.com/hashie/hashie#mash) for post-processing response body. So, you can use extended syntax for accessing response fields.
|
|
14
14
|
|
|
15
15
|
Example of work with responses:
|
|
16
16
|
|
|
@@ -19,7 +19,6 @@ require 'unione-ruby'
|
|
|
19
19
|
|
|
20
20
|
unione = UniOne::Client.new(
|
|
21
21
|
hostname: 'eu1.unione.io',
|
|
22
|
-
lang: 'en',
|
|
23
22
|
api_key: ENV['UNIONE_API_KEY']
|
|
24
23
|
)
|
|
25
24
|
|
data/examples/api/custom_api.rb
CHANGED
data/examples/api/domain.rb
CHANGED
data/examples/api/event_dump.rb
CHANGED
data/examples/api/project.rb
CHANGED
data/examples/api/suppression.rb
CHANGED
data/examples/api/system.rb
CHANGED
data/examples/api/tag.rb
CHANGED
data/examples/api/template.rb
CHANGED
data/examples/api/webhook.rb
CHANGED
data/examples/helpers.rb
CHANGED
data/examples/setup.rb
CHANGED
data/lib/unione/client.rb
CHANGED
|
@@ -44,7 +44,7 @@ module UniOne
|
|
|
44
44
|
# - +enable_logging+ -> boolean, enable logging
|
|
45
45
|
def initialize(params = {})
|
|
46
46
|
@hostname = params[:hostname]
|
|
47
|
-
@lang = params[:lang]
|
|
47
|
+
@lang = params[:lang] || 'en'
|
|
48
48
|
@api_key = params[:api_key]
|
|
49
49
|
@timeout = params[:timeout] || 5
|
|
50
50
|
@api_key_in_params = params[:api_key_in_params]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module UniOne
|
|
2
|
+
class Mail
|
|
3
|
+
attr_accessor :template, :body, :track, :from, :subject, :global_metadata, :headers, :options,
|
|
4
|
+
:global_substitutions, :recipients, :attachments, :inline_attachments,
|
|
5
|
+
:reply_to, :skip_unsubscribe, :force_send
|
|
6
|
+
|
|
7
|
+
def initialize
|
|
8
|
+
@template = {}
|
|
9
|
+
@from = {}
|
|
10
|
+
@track = {}
|
|
11
|
+
@global_substitutions = {}
|
|
12
|
+
@recipients = []
|
|
13
|
+
@attachments = []
|
|
14
|
+
@inline_attachments = []
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# backward compatibility
|
|
18
|
+
alias_method :"metadata=", :"global_metadata="
|
|
19
|
+
|
|
20
|
+
def to_json(*)
|
|
21
|
+
{
|
|
22
|
+
message: {
|
|
23
|
+
global_substitutions: self.global_substitutions,
|
|
24
|
+
body: self.body,
|
|
25
|
+
subject: self.subject,
|
|
26
|
+
reply_to: self.reply_to,
|
|
27
|
+
recipients: self.recipients,
|
|
28
|
+
global_metadata: self.global_metadata,
|
|
29
|
+
headers: self.headers,
|
|
30
|
+
attachments: self.attachments,
|
|
31
|
+
inline_attachments: self.inline_attachments,
|
|
32
|
+
options: self.options,
|
|
33
|
+
skip_unsubscribe: self.skip_unsubscribe,
|
|
34
|
+
force_send: self.force_send
|
|
35
|
+
}.merge(self.template)
|
|
36
|
+
.merge(self.from)
|
|
37
|
+
.merge(self.track)
|
|
38
|
+
.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module UniOne
|
|
2
|
+
class Template
|
|
3
|
+
attr_accessor :name, :editor_type, :subject, :template_engine, :global_substitutions, :from,
|
|
4
|
+
:headers, :body, :attachments, :inline_attachments, :options
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
7
|
+
@global_substitutions = {}
|
|
8
|
+
@from = {}
|
|
9
|
+
@attachments = []
|
|
10
|
+
@inline_attachments = []
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def to_json(*)
|
|
14
|
+
{
|
|
15
|
+
template: {
|
|
16
|
+
id: '',
|
|
17
|
+
name: self.name,
|
|
18
|
+
editor_type: self.editor_type,
|
|
19
|
+
subject: self.subject,
|
|
20
|
+
template_engine: self.template_engine,
|
|
21
|
+
global_substitutions: self.global_substitutions,
|
|
22
|
+
headers: self.headers,
|
|
23
|
+
body: self.body,
|
|
24
|
+
attachments: self.attachments,
|
|
25
|
+
inline_attachments: self.inline_attachments,
|
|
26
|
+
options: self.options
|
|
27
|
+
}.merge(self.from)
|
|
28
|
+
.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module UniOne
|
|
2
|
+
class Webhook
|
|
3
|
+
attr_accessor :url, :status, :settings, :events
|
|
4
|
+
|
|
5
|
+
def initialize
|
|
6
|
+
@settings = {}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def to_json(*)
|
|
10
|
+
{
|
|
11
|
+
url: self.url,
|
|
12
|
+
status: self.status,
|
|
13
|
+
events: self.events
|
|
14
|
+
}.merge(self.settings)
|
|
15
|
+
.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/unione/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unione-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- UniOne developer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -146,6 +146,9 @@ files:
|
|
|
146
146
|
- lib/unione/client/webhook.rb
|
|
147
147
|
- lib/unione/connection.rb
|
|
148
148
|
- lib/unione/helpers.rb
|
|
149
|
+
- lib/unione/helpers/mail/mail.rb
|
|
150
|
+
- lib/unione/helpers/template/template.rb
|
|
151
|
+
- lib/unione/helpers/webhook/webhook.rb
|
|
149
152
|
- lib/unione/response/raise_error.rb
|
|
150
153
|
- lib/unione/validation.rb
|
|
151
154
|
- lib/unione/version.rb
|
|
@@ -170,8 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
170
173
|
- !ruby/object:Gem::Version
|
|
171
174
|
version: '0'
|
|
172
175
|
requirements: []
|
|
173
|
-
|
|
174
|
-
rubygems_version: 2.7.6
|
|
176
|
+
rubygems_version: 3.0.3.1
|
|
175
177
|
signing_key:
|
|
176
178
|
specification_version: 4
|
|
177
179
|
summary: Official UniOne Gem
|