blastengine 0.5.1 → 0.6.0
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 +4 -4
- data/blastengine.gemspec +39 -0
- data/lib/blastengine/base.rb +5 -0
- data/lib/blastengine/bulk.rb +18 -1
- data/lib/blastengine/mail.rb +8 -1
- data/lib/blastengine/transaction.rb +10 -1
- data/lib/blastengine/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ba1cbb4d5e111cb6b99560d4dfeb7b306a454781c5b0371693054e5840d47f3
|
4
|
+
data.tar.gz: 97eb8e49ae1f518f4c6524567e46e24ec29dec6f691c2879a4d21888845f73a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ac46c3d7d838628150e818cf674768d5a04a7f29b59b21c7a419549d1c3ce0316b59cb69e50089121328d44df93e60bcfa570b16af833311e59f855c23839b0
|
7
|
+
data.tar.gz: 025c7107e6d154debe100b3010f6593fd2585e41ad83021cacfe4d6ca83fbe70ddc3c6126760d18a87ca8a8382d6e05b1195bfd582704f5f79a79abe58ccc2c2
|
data/blastengine.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/blastengine/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "blastengine"
|
7
|
+
spec.version = Blastengine::VERSION
|
8
|
+
spec.authors = ["Atsushi Nakatsugawa"]
|
9
|
+
spec.email = ["atsushi@moongift.jp"]
|
10
|
+
|
11
|
+
spec.summary = "SDK for sending email by blastengine"
|
12
|
+
spec.description = "This is a SDK for sending email by blastengine."
|
13
|
+
spec.homepage = "https://blastengine.jp/"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/blastengineMania/blastengine-ruby"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/blastengineMania/blastengine-ruby/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, check out our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
end
|
data/lib/blastengine/base.rb
CHANGED
data/lib/blastengine/bulk.rb
CHANGED
@@ -6,11 +6,15 @@ require "date"
|
|
6
6
|
module Blastengine
|
7
7
|
class Bulk < Base
|
8
8
|
include Blastengine
|
9
|
-
attr_accessor :subject, :text_part, :encode, :html_part, :attachments, :delivery_id, :job
|
9
|
+
attr_accessor :subject, :text_part, :encode, :html_part, :attachments, :delivery_id, :job, :list_unsubscribe
|
10
10
|
def initialize
|
11
11
|
@to = []
|
12
12
|
@attachments = []
|
13
13
|
@encode = "UTF-8"
|
14
|
+
@list_unsubscribe = {
|
15
|
+
url: "",
|
16
|
+
email: ""
|
17
|
+
}
|
14
18
|
end
|
15
19
|
|
16
20
|
#
|
@@ -34,6 +38,12 @@ module Blastengine
|
|
34
38
|
}
|
35
39
|
# HTMLパートがある場合は追加
|
36
40
|
data[:html_part] = @html_part unless @html_part.nil?
|
41
|
+
# 退会リンクがある場合は追加
|
42
|
+
unless @list_unsubscribe.nil?
|
43
|
+
data[:list_unsubscribe] = {}
|
44
|
+
data[:list_unsubscribe][:url] = @list_unsubscribe[:url] if !@list_unsubscribe[:url].nil? && @list_unsubscribe[:url] != ""
|
45
|
+
data[:list_unsubscribe][:mailto] = "mailto:#{@list_unsubscribe[:email]}" if !@list_unsubscribe[:email].nil? && @list_unsubscribe[:email] != ""
|
46
|
+
end
|
37
47
|
# API実行
|
38
48
|
res = @@client.post path, data, @attachments
|
39
49
|
@delivery_id = res["delivery_id"]
|
@@ -75,6 +85,13 @@ module Blastengine
|
|
75
85
|
data[:from] = @_from unless @_from.nil?
|
76
86
|
data[:text_part] = @text_part unless @text_part.nil?
|
77
87
|
data[:html_part] = @html_part unless @html_part.nil?
|
88
|
+
|
89
|
+
# 退会リンクがある場合は追加
|
90
|
+
unless @list_unsubscribe.nil?
|
91
|
+
data[:list_unsubscribe] = {}
|
92
|
+
data[:list_unsubscribe][:url] = @list_unsubscribe[:url] if !@list_unsubscribe[:url].nil? && @list_unsubscribe[:url] != ""
|
93
|
+
data[:list_unsubscribe][:mailto] = "mailto:#{@list_unsubscribe[:email]}" if !@list_unsubscribe[:email].nil? && @list_unsubscribe[:email] != ""
|
94
|
+
end
|
78
95
|
# API実行
|
79
96
|
res = @@client.put path, data
|
80
97
|
return res["delivery_id"]
|
data/lib/blastengine/mail.rb
CHANGED
@@ -3,13 +3,18 @@ require 'date'
|
|
3
3
|
module Blastengine
|
4
4
|
class Mail < Base
|
5
5
|
include Blastengine
|
6
|
-
attr_accessor :to, :cc, :bcc, :subject, :text_part, :encode, :html_part, :attachments, :delivery_id
|
6
|
+
attr_accessor :to, :cc, :bcc, :subject, :text_part, :encode, :html_part, :attachments, :delivery_id, :list_unsubscribe
|
7
|
+
|
7
8
|
def initialize
|
8
9
|
@to = []
|
9
10
|
@cc = []
|
10
11
|
@bcc = []
|
11
12
|
@attachments = []
|
12
13
|
@encode = "UTF-8"
|
14
|
+
@list_unsubscribe = {
|
15
|
+
url: "",
|
16
|
+
email: ""
|
17
|
+
}
|
13
18
|
end
|
14
19
|
|
15
20
|
#
|
@@ -50,6 +55,7 @@ module Blastengine
|
|
50
55
|
bulk.encode = @encode
|
51
56
|
bulk.text_part = @text_part
|
52
57
|
bulk.html_part = @html_part
|
58
|
+
bulk.unsubscribe url: @list_unsubscribe[:url], email: @list_unsubscribe[:email]
|
53
59
|
if @attachments.size > 0
|
54
60
|
bulk.attachments = @attachments
|
55
61
|
end
|
@@ -74,6 +80,7 @@ module Blastengine
|
|
74
80
|
transaction.insert_code = @to[0][:insert_code] if @to[0][:insert_code].size > 0
|
75
81
|
transaction.cc = @cc if @cc.size > 0
|
76
82
|
transaction.bcc = @bcc if @bcc.size > 0
|
83
|
+
transaction.unsubscribe url: @list_unsubscribe[:url], email: @list_unsubscribe[:email]
|
77
84
|
if @attachments.size > 0
|
78
85
|
transaction.attachments = @attachments
|
79
86
|
end
|
@@ -3,7 +3,7 @@ require 'date'
|
|
3
3
|
module Blastengine
|
4
4
|
class Transaction < Base
|
5
5
|
include Blastengine
|
6
|
-
attr_accessor :to, :cc, :bcc, :subject, :text_part, :encode, :html_part, :attachments, :insert_code
|
6
|
+
attr_accessor :to, :cc, :bcc, :subject, :text_part, :encode, :html_part, :attachments, :insert_code, :list_unsubscribe
|
7
7
|
def initialize
|
8
8
|
@to = ""
|
9
9
|
@cc = []
|
@@ -11,6 +11,10 @@ module Blastengine
|
|
11
11
|
@attachments = []
|
12
12
|
@encode = "UTF-8"
|
13
13
|
@insert_code = {}
|
14
|
+
@list_unsubscribe = {
|
15
|
+
url: "",
|
16
|
+
email: ""
|
17
|
+
}
|
14
18
|
end
|
15
19
|
|
16
20
|
#
|
@@ -46,6 +50,11 @@ module Blastengine
|
|
46
50
|
}
|
47
51
|
end
|
48
52
|
end
|
53
|
+
unless @list_unsubscribe.nil?
|
54
|
+
data[:list_unsubscribe] = {}
|
55
|
+
data[:list_unsubscribe][:url] = @list_unsubscribe[:url] if !@list_unsubscribe[:url].nil? && @list_unsubscribe[:url] != ""
|
56
|
+
data[:list_unsubscribe][:mailto] = "mailto:#{@list_unsubscribe[:email]}" if !@list_unsubscribe[:email].nil? && @list_unsubscribe[:email] != ""
|
57
|
+
end
|
49
58
|
# API実行
|
50
59
|
res = @@client.post path, data, @attachments
|
51
60
|
# エラーがあったら例外を投げるので、この場合は通常終了
|
data/lib/blastengine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blastengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Atsushi Nakatsugawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a SDK for sending email by blastengine.
|
14
14
|
email:
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- LICENSE
|
26
26
|
- README.md
|
27
27
|
- Rakefile
|
28
|
+
- blastengine.gemspec
|
28
29
|
- lib/blastengine.rb
|
29
30
|
- lib/blastengine/base.rb
|
30
31
|
- lib/blastengine/bulk.rb
|