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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8807a2fc79452659177a7447867e38ca650482c9bd691a6c701a20d7c115f20
4
- data.tar.gz: 9ecb1e6785c72f73d465c5469d754bbd93f41de4a64ecd8e6c042690886638fc
3
+ metadata.gz: 723f886c86c9fcef331e71f468bfdd747ca7abeafb63cc4008c2401ac84da507
4
+ data.tar.gz: '0498a65064ce7c6dbf1904da0e0d034ee1df39cf056b16ffc00185602f392bfd'
5
5
  SHA512:
6
- metadata.gz: 95b0951bef570f71a7481ec8e6f9460e57ff827c3fe3b9083645ed28ab71904bfbdde6f83f853008f0a7ce1707fe62b6dfb47fb941ac36f008eb98c63e72e92c
7
- data.tar.gz: 3cc19ac8f9641a6849a59f4fab4b7c72e5585f10928831ff0f41da3d24ddc38aa24d764183008e5fc6184d619a52d8bbeb544a9abae16afc97cdb56301ace9a7
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 using [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.
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
 
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
@@ -3,7 +3,6 @@ require 'json'
3
3
 
4
4
  unione = UniOne::Client.new(
5
5
  hostname: 'eu1.unione.io',
6
- lang: 'en',
7
6
  api_key: ENV['UNIONE_API_KEY']
8
7
  )
9
8
 
@@ -3,7 +3,6 @@ require 'json'
3
3
 
4
4
  unione = UniOne::Client.new(
5
5
  hostname: 'eu1.unione.io',
6
- lang: 'en',
7
6
  api_key: ENV['UNIONE_API_KEY']
8
7
  )
9
8
 
@@ -3,7 +3,6 @@ require 'json'
3
3
 
4
4
  unione = UniOne::Client.new(
5
5
  hostname: 'eu1.unione.io',
6
- lang: 'en',
7
6
  api_key: ENV['UNIONE_API_KEY']
8
7
  )
9
8
 
@@ -3,7 +3,6 @@ require 'json'
3
3
 
4
4
  unione = UniOne::Client.new(
5
5
  hostname: 'eu1.unione.io',
6
- lang: 'en',
7
6
  api_key: ENV['UNIONE_API_KEY']
8
7
  )
9
8
 
@@ -3,7 +3,6 @@ require 'json'
3
3
 
4
4
  unione = UniOne::Client.new(
5
5
  hostname: 'eu1.unione.io',
6
- lang: 'en',
7
6
  api_key: ENV['UNIONE_API_KEY']
8
7
  )
9
8
 
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
data/examples/api/tag.rb CHANGED
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
@@ -3,7 +3,6 @@ require 'json'
3
3
 
4
4
  unione = UniOne::Client.new(
5
5
  hostname: 'eu1.unione.io',
6
- lang: 'en',
7
6
  api_key: ENV['UNIONE_API_KEY']
8
7
  )
9
8
 
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
@@ -3,7 +3,6 @@ require 'json'
3
3
 
4
4
  unione = UniOne::Client.new(
5
5
  hostname: 'eu1.unione.io',
6
- lang: 'en',
7
6
  api_key: ENV['UNIONE_API_KEY']
8
7
  )
9
8
 
data/examples/helpers.rb CHANGED
@@ -2,7 +2,6 @@ require 'unione-ruby'
2
2
 
3
3
  unione = UniOne::Client.new(
4
4
  hostname: 'eu1.unione.io',
5
- lang: 'en',
6
5
  api_key: ENV['UNIONE_API_KEY']
7
6
  )
8
7
 
data/examples/setup.rb CHANGED
@@ -3,7 +3,6 @@ require 'json'
3
3
 
4
4
  unione = UniOne::Client.new(
5
5
  hostname: 'eu1.unione.io',
6
- lang: 'en',
7
6
  api_key: ENV['UNIONE_API_KEY']
8
7
  )
9
8
 
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
@@ -1,3 +1,3 @@
1
1
  module UniOne
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
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.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: 2023-06-23 00:00:00.000000000 Z
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
- rubyforge_project:
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