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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +90 -10
  3. data/Rakefile +49 -0
  4. data/config/response_schema/domain.yml +74 -0
  5. data/config/response_schema/email.yml +23 -0
  6. data/config/response_schema/event_dump.yml +75 -0
  7. data/config/response_schema/project.yml +59 -0
  8. data/config/response_schema/suppression.yml +71 -0
  9. data/config/response_schema/system.yml +33 -0
  10. data/config/response_schema/tag.yml +26 -0
  11. data/config/response_schema/template.yml +134 -0
  12. data/config/response_schema/unsubscribed.yml +45 -0
  13. data/config/response_schema/webhook.yml +141 -0
  14. data/examples/api/custom_api.rb +13 -0
  15. data/examples/api/domain.rb +13 -7
  16. data/examples/api/email/attachments.rb +27 -0
  17. data/examples/api/email/multiple_recipients.rb +23 -0
  18. data/examples/api/email/send.rb +25 -0
  19. data/examples/api/email/settings.rb +40 -0
  20. data/examples/api/email/subscribe.rb +13 -0
  21. data/examples/api/email/template.rb +25 -0
  22. data/examples/api/event_dump.rb +43 -0
  23. data/examples/api/project.rb +29 -23
  24. data/examples/api/suppression.rb +33 -0
  25. data/examples/api/system.rb +5 -6
  26. data/examples/api/tag.rb +14 -0
  27. data/examples/api/template.rb +39 -28
  28. data/examples/api/unsubscribed.rb +16 -11
  29. data/examples/api/webhook.rb +27 -25
  30. data/examples/helpers.rb +28 -0
  31. data/examples/send_mail.rb +44 -0
  32. data/examples/setup.rb +20 -14
  33. data/lib/unione/client/domain.rb +21 -45
  34. data/lib/unione/client/email.rb +16 -15
  35. data/lib/unione/client/event_dump.rb +37 -0
  36. data/lib/unione/client/project.rb +19 -61
  37. data/lib/unione/client/suppression.rb +38 -0
  38. data/lib/unione/client/system.rb +12 -17
  39. data/lib/unione/client/tag.rb +24 -0
  40. data/lib/unione/client/template.rb +19 -66
  41. data/lib/unione/client/unsubscribed.rb +18 -31
  42. data/lib/unione/client/webhook.rb +19 -65
  43. data/lib/unione/client.rb +34 -12
  44. data/lib/unione/connection.rb +7 -3
  45. data/lib/unione/helpers.rb +22 -0
  46. data/lib/unione/response/raise_error.rb +4 -5
  47. data/lib/unione/validation.rb +34 -9
  48. data/lib/unione/version.rb +1 -1
  49. data/lib/unione-ruby.rb +0 -3
  50. data/test/CONFIGFILE.yml +71 -0
  51. data/unione-ruby.gemspec +2 -2
  52. metadata +33 -9
  53. data/examples/api/email.rb +0 -51
  54. data/examples/sending_mail.rb +0 -32
@@ -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