unione-ruby 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +99 -8
- data/Rakefile +52 -0
- data/config/response_schema/domain.yml +74 -0
- data/config/response_schema/email.yml +23 -0
- data/config/response_schema/event_dump.yml +75 -0
- data/config/response_schema/project.yml +59 -0
- data/config/response_schema/suppression.yml +71 -0
- data/config/response_schema/system.yml +33 -0
- data/config/response_schema/tag.yml +26 -0
- data/config/response_schema/template.yml +134 -0
- data/config/response_schema/unsubscribed.yml +45 -0
- data/config/response_schema/webhook.yml +141 -0
- data/examples/api/custom_api.rb +14 -0
- data/examples/api/domain.rb +14 -7
- data/examples/api/email/attachments.rb +28 -0
- data/examples/api/email/multiple_recipients.rb +24 -0
- data/examples/api/email/send.rb +25 -0
- data/examples/api/email/settings.rb +41 -0
- data/examples/api/email/subscribe.rb +14 -0
- data/examples/api/email/template.rb +26 -0
- data/examples/api/event_dump.rb +44 -0
- data/examples/api/project.rb +35 -11
- data/examples/api/suppression.rb +34 -0
- data/examples/api/system.rb +10 -0
- data/examples/api/tag.rb +15 -0
- data/examples/api/template.rb +40 -22
- data/examples/api/unsubscribed.rb +20 -12
- data/examples/api/webhook.rb +34 -24
- data/examples/helpers.rb +29 -0
- data/examples/send_mail.rb +44 -0
- data/examples/setup.rb +34 -0
- data/lib/unione/client/domain.rb +19 -46
- data/lib/unione/client/email.rb +14 -21
- data/lib/unione/client/event_dump.rb +37 -0
- data/lib/unione/client/project.rb +19 -43
- data/lib/unione/client/suppression.rb +38 -0
- data/lib/unione/client/system.rb +19 -0
- data/lib/unione/client/tag.rb +24 -0
- data/lib/unione/client/template.rb +19 -65
- data/lib/unione/client/unsubscribed.rb +18 -31
- data/lib/unione/client/webhook.rb +19 -38
- data/lib/unione/client.rb +42 -17
- data/lib/unione/connection.rb +24 -16
- data/lib/unione/helpers.rb +22 -0
- data/lib/unione/response/raise_error.rb +4 -5
- data/lib/unione/validation.rb +32 -12
- data/lib/unione/version.rb +1 -1
- data/lib/unione-ruby.rb +0 -3
- data/test/CONFIGFILE.yml +71 -0
- data/unione-ruby.gemspec +2 -2
- metadata +36 -11
- data/examples/1_setup.rb +0 -25
- data/examples/2_mail_sending.rb +0 -23
- data/examples/api/email.rb +0 -36
- data/lib/unione/helpers/mail/mail.rb +0 -37
- data/lib/unione/helpers/template/template.rb +0 -31
- data/lib/unione/helpers/webhook/webhook.rb +0 -17
@@ -1,31 +0,0 @@
|
|
1
|
-
module UniOne
|
2
|
-
class Template
|
3
|
-
attr_accessor :name, :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
|
-
subject: self.subject,
|
19
|
-
template_engine: self.template_engine,
|
20
|
-
global_substitutions: self.global_substitutions,
|
21
|
-
headers: self.headers,
|
22
|
-
body: self.body,
|
23
|
-
attachments: self.attachments,
|
24
|
-
inline_attachments: self.inline_attachments,
|
25
|
-
options: self.options
|
26
|
-
}.merge(self.from)
|
27
|
-
.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module UniOne
|
2
|
-
class Webhook
|
3
|
-
attr_accessor :url, :settings, :events
|
4
|
-
|
5
|
-
def initialize
|
6
|
-
@settings = {}
|
7
|
-
end
|
8
|
-
|
9
|
-
def to_json(*)
|
10
|
-
{
|
11
|
-
url: self.url,
|
12
|
-
events: self.events
|
13
|
-
}.merge(self.settings)
|
14
|
-
.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|