unione-ruby 0.0.2 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +90 -10
- data/Rakefile +49 -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 +13 -0
- data/examples/api/domain.rb +13 -7
- data/examples/api/email/attachments.rb +27 -0
- data/examples/api/email/multiple_recipients.rb +23 -0
- data/examples/api/email/send.rb +25 -0
- data/examples/api/email/settings.rb +40 -0
- data/examples/api/email/subscribe.rb +13 -0
- data/examples/api/email/template.rb +25 -0
- data/examples/api/event_dump.rb +43 -0
- data/examples/api/project.rb +29 -23
- data/examples/api/suppression.rb +33 -0
- data/examples/api/system.rb +5 -6
- data/examples/api/tag.rb +14 -0
- data/examples/api/template.rb +39 -28
- data/examples/api/unsubscribed.rb +16 -11
- data/examples/api/webhook.rb +27 -25
- data/examples/helpers.rb +28 -0
- data/examples/send_mail.rb +44 -0
- data/examples/setup.rb +20 -14
- data/lib/unione/client/domain.rb +21 -45
- data/lib/unione/client/email.rb +16 -15
- data/lib/unione/client/event_dump.rb +37 -0
- data/lib/unione/client/project.rb +19 -61
- data/lib/unione/client/suppression.rb +38 -0
- data/lib/unione/client/system.rb +12 -17
- data/lib/unione/client/tag.rb +24 -0
- data/lib/unione/client/template.rb +19 -66
- data/lib/unione/client/unsubscribed.rb +18 -31
- data/lib/unione/client/webhook.rb +19 -65
- data/lib/unione/client.rb +34 -12
- data/lib/unione/connection.rb +7 -3
- data/lib/unione/helpers.rb +22 -0
- data/lib/unione/response/raise_error.rb +4 -5
- data/lib/unione/validation.rb +34 -9
- 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 +33 -9
- data/examples/api/email.rb +0 -51
- data/examples/sending_mail.rb +0 -32
data/examples/sending_mail.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'unione-ruby'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
unione = UniOne::Client.new(data_center: 'eu1', lang: 'en', api_key: ENV['UNIONE_API_KEY'])
|
5
|
-
|
6
|
-
mail = UniOne::Mail.new
|
7
|
-
|
8
|
-
template_id = "bc0372d4-69f2-11eb-9d14-366b3a36c9e1"
|
9
|
-
mail.template = { template_engine: 'simple', template_id: template_id }
|
10
|
-
|
11
|
-
mail.from = { from_email: 'test@qadns.net', from_name: 'userName' }
|
12
|
-
|
13
|
-
substitutions = { 'substitutionName' => 'substitutionVal', to_name: 'Name Surname 1' }
|
14
|
-
recipient = { email: 'test1@example.com', substitutions: substitutions, metadata: { key1: 'val1' } }
|
15
|
-
mail.recipients << recipient
|
16
|
-
|
17
|
-
substitutions = { 'substitutionName' => 'substitutionVal', to_name: 'Name Surname 2' }
|
18
|
-
recipient = { email: 'test2@example.com', substitutions: substitutions, metadata: { key1: 'val1' } }
|
19
|
-
mail.recipients << recipient
|
20
|
-
|
21
|
-
mail.global_metadata = { key1: 'val1' }
|
22
|
-
mail.headers = { 'X-ReplyTo' => 'reply@example.com' }
|
23
|
-
mail.options = { unsubscribe_url: 'someurl' }
|
24
|
-
|
25
|
-
mail.attachments << { type: 'text/plain', name: 'myfile.txt', content: 'ZXhhbXBsZSBmaWxl' }
|
26
|
-
mail.inline_attachments << { type: 'image/png', name: 'IMAGECID', content: 'iVBORw0KGgo' }
|
27
|
-
|
28
|
-
response = unione.send_email(mail.to_json)
|
29
|
-
|
30
|
-
puts response.status
|
31
|
-
puts response.body.to_h
|
32
|
-
puts response.headers
|