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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +99 -8
  3. data/Rakefile +52 -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 +14 -0
  15. data/examples/api/domain.rb +14 -7
  16. data/examples/api/email/attachments.rb +28 -0
  17. data/examples/api/email/multiple_recipients.rb +24 -0
  18. data/examples/api/email/send.rb +25 -0
  19. data/examples/api/email/settings.rb +41 -0
  20. data/examples/api/email/subscribe.rb +14 -0
  21. data/examples/api/email/template.rb +26 -0
  22. data/examples/api/event_dump.rb +44 -0
  23. data/examples/api/project.rb +35 -11
  24. data/examples/api/suppression.rb +34 -0
  25. data/examples/api/system.rb +10 -0
  26. data/examples/api/tag.rb +15 -0
  27. data/examples/api/template.rb +40 -22
  28. data/examples/api/unsubscribed.rb +20 -12
  29. data/examples/api/webhook.rb +34 -24
  30. data/examples/helpers.rb +29 -0
  31. data/examples/send_mail.rb +44 -0
  32. data/examples/setup.rb +34 -0
  33. data/lib/unione/client/domain.rb +19 -46
  34. data/lib/unione/client/email.rb +14 -21
  35. data/lib/unione/client/event_dump.rb +37 -0
  36. data/lib/unione/client/project.rb +19 -43
  37. data/lib/unione/client/suppression.rb +38 -0
  38. data/lib/unione/client/system.rb +19 -0
  39. data/lib/unione/client/tag.rb +24 -0
  40. data/lib/unione/client/template.rb +19 -65
  41. data/lib/unione/client/unsubscribed.rb +18 -31
  42. data/lib/unione/client/webhook.rb +19 -38
  43. data/lib/unione/client.rb +42 -17
  44. data/lib/unione/connection.rb +24 -16
  45. data/lib/unione/helpers.rb +22 -0
  46. data/lib/unione/response/raise_error.rb +4 -5
  47. data/lib/unione/validation.rb +32 -12
  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 +36 -11
  53. data/examples/1_setup.rb +0 -25
  54. data/examples/2_mail_sending.rb +0 -23
  55. data/examples/api/email.rb +0 -36
  56. data/lib/unione/helpers/mail/mail.rb +0 -37
  57. data/lib/unione/helpers/template/template.rb +0 -31
  58. 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