submail 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 60abf6ad268c820bec49bba1a220d98753eae04b
4
+ data.tar.gz: 8d214ec10494b15db7e796f1adeae5b08a70a54e
5
+ SHA512:
6
+ metadata.gz: 9c051b2fc794026025bb42c3b68264a3463161a3cd05d02953bdcdea4d56c0b45fc0cd3947641f0f4efe08f885e262184748a8d94250cb9100ebced35710cf11
7
+ data.tar.gz: c61d9bfb2e048e33b55e24c0864579bf82480ca6da8751c9a68705cc9f1e62e6ef9da94de180cd33be4129974e314c8f4f16b14d04f1a62f4a5a8a65f5d8c90f
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,3 @@
1
+ # v0.1.0 / 2015-06-24
2
+
3
+ Create project
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in submail.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Chen Yi-Cyuan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # Submail
2
+
3
+ Submail client api.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'submail'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install submail
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## License
24
+ The project is released under the [MIT license](http://www.opensource.org/licenses/MIT).
25
+
26
+ ## Contact
27
+ The project's website is located at https://github.com/emn178/submail
28
+ Author: emn178@gmail.com
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # require "net/http"
2
+ require "net/https"
3
+ require "json"
4
+ require "digest/md5"
5
+ require "digest/sha1"
6
+
7
+ require "submail/version"
8
+ require "submail/configuration"
9
+ require "submail/helper"
10
+ require "submail/address_book_mail"
11
+ require "submail/address_book_message"
12
+ require "submail/mail_send"
13
+ require "submail/mail_x_send"
14
+ require "submail/message_x_send"
15
+
16
+ module Submail
17
+ def self.configure(&block)
18
+ yield configuration
19
+ end
20
+
21
+ def self.configuration
22
+ @configuration ||= Configuration.new
23
+ end
24
+ end
@@ -0,0 +1,48 @@
1
+ module Submail
2
+ class AddressBookMail
3
+ include Helper
4
+
5
+ def initialize(config)
6
+ @address = ""
7
+ @target = ""
8
+ @config = config
9
+ end
10
+
11
+ def set_address(address,name)
12
+ @address = "%s<%s>" %[name,address]
13
+ end
14
+
15
+ def set_addressbook(addressbook)
16
+ @target = addressbook
17
+ end
18
+
19
+ def build_request
20
+ request = {}
21
+ if @address != ""
22
+ request["address"] = @address
23
+ end
24
+ if @target != ""
25
+ request["target"] = @target
26
+ end
27
+ request
28
+ end
29
+
30
+ def mail_subscribe
31
+ url = "https://api.submail.cn/addressbook/mail/subscribe.json"
32
+ request = self.build_request()
33
+ request["appid"] = @config["appid"]
34
+ request["timestamp"] = get_timestamp()
35
+ request["signature"] = create_signatrue(request, @config)
36
+ JSON.parse http_post(url, request)
37
+ end
38
+
39
+ def mail_unsubscribe
40
+ url = "https://api.submail.cn/addressbook/mail/unsubscribe.json"
41
+ request = self.build_request()
42
+ request["appid"] = @config["appid"]
43
+ request["timestamp"] = get_timestamp()
44
+ request["signature"] = create_signatrue(request, @config)
45
+ JSON.parse http_post(url, request)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ module Submail
2
+ class AddressBookMessage
3
+ include Helper
4
+
5
+ def initialize(config)
6
+ @address = ""
7
+ @target = ""
8
+ @config = config
9
+ end
10
+
11
+ def set_address(address,name)
12
+ @address = "%s<%s>" %[name,address]
13
+ end
14
+
15
+ def set_addressbook(addressbook)
16
+ @target = addressbook
17
+ end
18
+
19
+ def build_request()
20
+ request = {}
21
+ if @address != ""
22
+ request["address"] = @address
23
+ end
24
+ if @target != ""
25
+ request["target"] = @target
26
+ end
27
+ request
28
+ end
29
+
30
+ def message_subscribe()
31
+ url = "https://api.submail.cn/addressbook/message/subscribe.json"
32
+ request = self.build_request()
33
+ request["appid"] = @config["appid"]
34
+ request["timestamp"] = get_timestamp()
35
+ request["signature"] = create_signatrue(request, @config)
36
+ JSON.parse http_post(url, request)
37
+ end
38
+
39
+ def message_unsubscribe()
40
+ url = "https://api.submail.cn/addressbook/message/unsubscribe.json"
41
+ request = self.build_request()
42
+ request["appid"] = @config["appid"]
43
+ request["timestamp"] = get_timestamp()
44
+ request["signature"] = create_signatrue(request, @config)
45
+ JSON.parse http_post(url, request)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,15 @@
1
+ module Submail
2
+ class Configuration
3
+ attr_accessor :message_app_id, :message_app_key, :signtype
4
+
5
+ def initialize(options = {})
6
+ options.each { |key, value|
7
+ instance_variable_set("@#{key}", value)
8
+ }
9
+ end
10
+
11
+ def message_json
12
+ { "appid" => message_app_id, "appkey" => message_app_key, "signtype" => signtype }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,48 @@
1
+ module Submail
2
+ module Helper
3
+ def http_get(url)
4
+ uri = URI.parse(url)
5
+ request = Net::HTTP::Get.new(uri.to_s)
6
+ http_request(uri, request)
7
+ end
8
+
9
+ def http_post(url, postdata)
10
+ uri = URI.parse(url)
11
+ request = Net::HTTP::Post.new(uri.to_s)
12
+ request.set_form_data postdata
13
+ http_request(uri, request)
14
+ end
15
+
16
+ def http_request(uri, request)
17
+ response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
18
+ http.request request
19
+ end
20
+ response.body
21
+ end
22
+
23
+ def get_timestamp
24
+ json = JSON.parse http_get("https://api.submail.cn/service/timestamp.json")
25
+ json["timestamp"]
26
+ end
27
+
28
+ def create_signatrue(request, config)
29
+ appkey = config["appkey"]
30
+ appid = config["appid"]
31
+ signtype = config["signtype"]
32
+ request["sign_type"] = signtype
33
+ keys = request.keys.sort
34
+ values = []
35
+ keys.each do |k|
36
+ values << "%s=%s"%[k,request[k]]
37
+ end
38
+ signstr = "%s%s%s%s%s"%[appid,appkey, values.join('&'),appid, appkey]
39
+ if signtype == "normal"
40
+ appkey
41
+ elsif signtype == "md5"
42
+ Digest::MD5.hexdigest(signstr)
43
+ else
44
+ Digest::SHA1.hexdigest(signstr)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,147 @@
1
+ module Submail
2
+ class MailSend
3
+ include Helper
4
+
5
+ def initialize(config)
6
+ @to = []
7
+ @addressbook = []
8
+ @from = ""
9
+ @fromname = ""
10
+ @reply = ""
11
+ @cc = []
12
+ @bcc = []
13
+ @subject = ""
14
+ @text = ""
15
+ @html = ""
16
+ @vars ={}
17
+ @links = {}
18
+ @headers = {}
19
+ @config = config
20
+ end
21
+
22
+ def add_to(address, name)
23
+ to = {}
24
+ to["address"] = address
25
+ to["name"] = name
26
+ @to << to
27
+ end
28
+
29
+ def add_addressbook(addressbook)
30
+ @addressbook = []
31
+ @addressbook << addressbook
32
+ end
33
+
34
+ def set_sender(from, fromname)
35
+ @from = from
36
+ @fromname = fromname
37
+ end
38
+
39
+ def set_reply(reply)
40
+ @reply = reply
41
+ end
42
+
43
+ def add_cc(address, name)
44
+ cc = {}
45
+ cc["address"] = address
46
+ cc["name"] = name
47
+ @cc << cc
48
+ end
49
+
50
+ def add_bcc(address, name)
51
+ bcc = {}
52
+ bcc["address"] = address
53
+ bcc["name"] = name
54
+ @bcc << bcc
55
+ end
56
+
57
+ def set_subject(subject)
58
+ @subject = subject
59
+ end
60
+
61
+ def set_text(text)
62
+ @text = text
63
+ end
64
+
65
+ def set_html(html)
66
+ @html = html
67
+ end
68
+
69
+ def add_var(key, value)
70
+ @vars[key] = value
71
+ end
72
+
73
+ def add_link(key, value)
74
+ @links[key] = value
75
+ end
76
+
77
+ def add_header(key, value)
78
+ @headers[key] = value
79
+ end
80
+
81
+ def build_request
82
+ request = {}
83
+ if @to.length != 0
84
+ to = []
85
+ @to.each do |k|
86
+ to << "%s<%s>" %[k["name"], k["address"]]
87
+ end
88
+ request["to"] = to.join(",")
89
+ end
90
+ if @addressbook.length != 0
91
+ request["addressbook"] = @addressbook.join(",")
92
+ end
93
+ if @from != ""
94
+ request["from"] = @from
95
+ end
96
+ if @fromname != ""
97
+ request["from_name"] = @fromname
98
+ end
99
+ if @reply != ""
100
+ request["reply"] = @reply
101
+ end
102
+ if @cc.length != 0
103
+ cc = []
104
+ @cc.each do |k|
105
+ cc << "%s<%s>" %[k["name"], k["address"]]
106
+ end
107
+ request["cc"] = cc.join(",")
108
+ end
109
+ if @bcc.length != 0
110
+ bcc = []
111
+ @bcc.each do |k|
112
+ bcc << "%s<%s>" %[k["name"], k["address"]]
113
+ end
114
+ request["bcc"] = bcc.join(",")
115
+ end
116
+ if @subject != ""
117
+ request["subject"] = @subject
118
+ end
119
+ if @text != ""
120
+ request["text"] = @text
121
+ end
122
+ if @html != ""
123
+ request["html"] = @html
124
+ end
125
+ if @vars.length != 0
126
+ request["vars"] = JSON.generate @vars
127
+ end
128
+ if @links.length != 0
129
+ request["links"] = JSON.generate @links
130
+ end
131
+
132
+ if @headers.length != 0
133
+ request["headers"] = JSON.generate @headers
134
+ end
135
+ request
136
+ end
137
+
138
+ def mail_send
139
+ request = self.build_request()
140
+ url = "https://api.submail.cn/mail/send.json"
141
+ request["appid"] = @config["appid"]
142
+ request["timestamp"] = get_timestamp()
143
+ request["signature"] = create_signatrue(request, @config)
144
+ JSON.parse http_post(url, request)
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,139 @@
1
+ module Submail
2
+ class MailXSend
3
+ include Helper
4
+
5
+ def initialize(config)
6
+ @to = []
7
+ @addressbook = []
8
+ @from = ""
9
+ @fromname = ""
10
+ @reply = ""
11
+ @cc = []
12
+ @bcc = []
13
+ @subject = ""
14
+ @project = ""
15
+ @vars ={}
16
+ @links = {}
17
+ @headers = {}
18
+ @config = config
19
+ end
20
+
21
+ def add_to(address, name)
22
+ to = {}
23
+ to["address"] = address
24
+ to["name"] = name
25
+ @to << to
26
+ end
27
+
28
+ def add_addressbook(addressbook)
29
+ @addressbook = []
30
+ @addressbook << addressbook
31
+ end
32
+
33
+ def set_sender(from, fromname)
34
+ @from = from
35
+ @fromname = fromname
36
+ end
37
+
38
+ def set_reply(reply)
39
+ @reply = reply
40
+ end
41
+
42
+ def add_cc(address, name)
43
+ cc = {}
44
+ cc["address"] = address
45
+ cc["name"] = name
46
+ @cc << cc
47
+ end
48
+
49
+ def add_bcc(address, name)
50
+ bcc = {}
51
+ bcc["address"] = address
52
+ bcc["name"] = name
53
+ @bcc << bcc
54
+ end
55
+
56
+ def set_subject(subject)
57
+ @subject = subject
58
+ end
59
+
60
+ def set_project(project)
61
+ @project = project
62
+ end
63
+
64
+ def add_var(key, value)
65
+ @vars[key] = value
66
+ end
67
+
68
+ def add_link(key, value)
69
+ @links[key] = value
70
+ end
71
+
72
+ def add_header(key, value)
73
+ @headers[key] = value
74
+ end
75
+
76
+ def build_request
77
+ request = {}
78
+ if @to.length != 0
79
+ to = []
80
+ @to.each do |k|
81
+ to << "%s<%s>" %[k["name"], k["address"]]
82
+ end
83
+ request["to"] = to.join(",")
84
+ end
85
+ if @addressbook.length != 0
86
+ request["addressbook"] = @addressbook.join(",")
87
+ end
88
+ if @from != ""
89
+ request["from"] = @from
90
+ end
91
+ if @fromname != ""
92
+ request["from_name"] = @fromname
93
+ end
94
+ if @reply != ""
95
+ request["reply"] = @reply
96
+ end
97
+ if @cc.length != 0
98
+ cc = []
99
+ @cc.each do |k|
100
+ cc << "%s<%s>" %[k["name"], k["address"]]
101
+ end
102
+ request["cc"] = cc.join(",")
103
+ end
104
+ if @bcc.length != 0
105
+ bcc = []
106
+ @bcc.each do |k|
107
+ bcc << "%s<%s>" %[k["name"], k["address"]]
108
+ end
109
+ request["bcc"] = bcc.join(",")
110
+ end
111
+ if @subject != ""
112
+ request["subject"] = @subject
113
+ end
114
+ if @project != ""
115
+ request["project"] = @project
116
+ end
117
+ if @vars.length != 0
118
+ request["vars"] = JSON.generate @vars
119
+ end
120
+ if @links.length != 0
121
+ request["links"] = JSON.generate @links
122
+ end
123
+
124
+ if @headers.length != 0
125
+ request["headers"] = JSON.generate @headers
126
+ end
127
+ request
128
+ end
129
+
130
+ def mail_xsend
131
+ request = self.build_request()
132
+ url = "https://api.submail.cn/mail/xsend.json"
133
+ request["appid"] = @config["appid"]
134
+ request["timestamp"] = get_timestamp()
135
+ request["signature"] = create_signatrue(request, @config)
136
+ JSON.parse http_post(url, request)
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,59 @@
1
+ module Submail
2
+ class MessageXSend
3
+ include Helper
4
+
5
+ def initialize(config = Submail::configuration.message_json)
6
+ @to = []
7
+ @addressbook = []
8
+ @project = ""
9
+ @vars ={}
10
+ @config = config
11
+ end
12
+
13
+ def add_to(address)
14
+ @to << address
15
+ end
16
+
17
+ def add_addressbook(addressbook)
18
+ @addressbook << addressbook
19
+ end
20
+
21
+ def set_project(project)
22
+ @project = project
23
+ end
24
+
25
+ def add_var(key, value)
26
+ @vars[key] = value
27
+ end
28
+
29
+ def add_vars(vars)
30
+ @vars.merge(vars)
31
+ end
32
+
33
+ def build_request
34
+ request = {}
35
+ if @to.length != 0
36
+ request["to"] = @to.join(",")
37
+ end
38
+ if @addressbook.length != 0
39
+ request["addressbook"] = @addressbook.join(",")
40
+ end
41
+ if @project != ""
42
+ request["project"] = @project
43
+ end
44
+ if @vars.length != 0
45
+ request["vars"] = JSON.generate @vars
46
+ end
47
+ request
48
+ end
49
+
50
+ def message_xsend
51
+ request = self.build_request
52
+ url = "https://api.submail.cn/message/xsend.json"
53
+ request["appid"] = @config["appid"]
54
+ request["timestamp"] = get_timestamp
55
+ request["signature"] = create_signatrue(request, @config)
56
+ JSON.parse http_post(url, request)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,3 @@
1
+ module Submail
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,50 @@
1
+ RSpec.describe Submail::MessageXSend do
2
+ describe "#message_xsend" do
3
+ subject { instance }
4
+
5
+ context "with config" do
6
+ let(:instance) {
7
+ Submail::MessageXSend.new({
8
+ "appid" => "your_message_app_id",
9
+ "appkey" => "your_message_app_key",
10
+ "signtype" => "md5" })
11
+ }
12
+ before {
13
+ allow(instance).to receive(:get_timestamp).and_return(0)
14
+ allow(instance).to receive(:http_post).and_return('{"status":"error","code":"101","msg":"Incorrect APP ID"}')
15
+ @result = instance.message_xsend
16
+ }
17
+ it { expect(subject).to have_received(:get_timestamp).once }
18
+ it {
19
+ expect(subject).to have_received(:http_post).with(kind_of(String), {
20
+ "appid" => "your_message_app_id", "timestamp" => 0, "sign_type" => "md5",
21
+ "signature" => "780aa10fa9e95f3bf91c90bf5d3e78c8"
22
+ }).once
23
+ }
24
+ it { expect(@result["code"]).to eq "101" }
25
+ end
26
+
27
+ context "without config" do
28
+ let(:instance) { Submail::MessageXSend.new }
29
+ before {
30
+ Submail.configure do |config|
31
+ config.message_app_id = "your_message_app_id"
32
+ config.message_app_key = "your_message_app_key"
33
+ config.signtype = "md5"
34
+ end
35
+
36
+ allow(instance).to receive(:get_timestamp).and_return(0)
37
+ allow(instance).to receive(:http_post).and_return('{"status":"error","code":"101","msg":"Incorrect APP ID"}')
38
+ @result = instance.message_xsend
39
+ }
40
+ it { expect(subject).to have_received(:get_timestamp).once }
41
+ it {
42
+ expect(subject).to have_received(:http_post).with(kind_of(String), {
43
+ "appid" => "your_message_app_id", "timestamp" => 0, "sign_type" => "md5",
44
+ "signature" => "780aa10fa9e95f3bf91c90bf5d3e78c8"
45
+ }).once
46
+ }
47
+ it { expect(@result["code"]).to eq "101" }
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,99 @@
1
+ require "submail"
2
+ require "rspec/its"
3
+
4
+ # This file was generated by the `rspec --init` command. Conventionally, all
5
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
7
+ # this file to always be loaded, without a need to explicitly require it in any
8
+ # files.
9
+ #
10
+ # Given that it is always loaded, you are encouraged to keep this file as
11
+ # light-weight as possible. Requiring heavyweight dependencies from this file
12
+ # will add to the boot time of your test suite on EVERY test run, even for an
13
+ # individual file that may not need all of that loaded. Instead, consider making
14
+ # a separate helper file that requires the additional dependencies and performs
15
+ # the additional setup, and require it from the spec files that actually need
16
+ # it.
17
+ #
18
+ # The `.rspec` file also contains a few flags that are not defaults but that
19
+ # users commonly want.
20
+ #
21
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22
+ RSpec.configure do |config|
23
+ # rspec-expectations config goes here. You can use an alternate
24
+ # assertion/expectation library such as wrong or the stdlib/minitest
25
+ # assertions if you prefer.
26
+ config.expect_with :rspec do |expectations|
27
+ # This option will default to `true` in RSpec 4. It makes the `description`
28
+ # and `failure_message` of custom matchers include text for helper methods
29
+ # defined using `chain`, e.g.:
30
+ # be_bigger_than(2).and_smaller_than(4).description
31
+ # # => "be bigger than 2 and smaller than 4"
32
+ # ...rather than:
33
+ # # => "be bigger than 2"
34
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35
+ end
36
+
37
+ # rspec-mocks config goes here. You can use an alternate test double
38
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
39
+ config.mock_with :rspec do |mocks|
40
+ # Prevents you from mocking or stubbing a method that does not exist on
41
+ # a real object. This is generally recommended, and will default to
42
+ # `true` in RSpec 4.
43
+ mocks.verify_partial_doubles = true
44
+ end
45
+
46
+ # The settings below are suggested to provide a good initial experience
47
+ # with RSpec, but feel free to customize to your heart's content.
48
+ =begin
49
+ # These two settings work together to allow you to limit a spec run
50
+ # to individual examples or groups you care about by tagging them with
51
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
52
+ # get run.
53
+ config.filter_run :focus
54
+ config.run_all_when_everything_filtered = true
55
+
56
+ # Allows RSpec to persist some state between runs in order to support
57
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
58
+ # you configure your source control system to ignore this file.
59
+ config.example_status_persistence_file_path = "spec/examples.txt"
60
+
61
+ # Limits the available syntax to the non-monkey patched syntax that is
62
+ # recommended. For more details, see:
63
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
64
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
65
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
66
+ config.disable_monkey_patching!
67
+
68
+ # This setting enables warnings. It's recommended, but in some cases may
69
+ # be too noisy due to issues in dependencies.
70
+ config.warnings = true
71
+
72
+ # Many RSpec users commonly either run the entire suite or an individual
73
+ # file, and it's useful to allow more verbose output when running an
74
+ # individual spec file.
75
+ if config.files_to_run.one?
76
+ # Use the documentation formatter for detailed output,
77
+ # unless a formatter has already been configured
78
+ # (e.g. via a command-line flag).
79
+ config.default_formatter = 'doc'
80
+ end
81
+
82
+ # Print the 10 slowest examples and example groups at the
83
+ # end of the spec run, to help surface which specs are running
84
+ # particularly slow.
85
+ config.profile_examples = 10
86
+
87
+ # Run specs in random order to surface order dependencies. If you find an
88
+ # order dependency and want to debug it, you can fix the order by providing
89
+ # the seed, which is printed after each run.
90
+ # --seed 1234
91
+ config.order = :random
92
+
93
+ # Seed global randomization in this process using the `--seed` CLI option.
94
+ # Setting this allows you to use `--seed` to deterministically reproduce
95
+ # test failures related to randomization by passing the same `--seed` value
96
+ # as the one that triggered the failure.
97
+ Kernel.srand config.seed
98
+ =end
99
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'submail/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "submail"
8
+ spec.version = Submail::VERSION
9
+ spec.authors = ["Chen Yi-Cyuan"]
10
+ spec.email = ["emn178@gmail.com"]
11
+ spec.description = %q{Submail client api.}
12
+ spec.summary = %q{Submail client api.}
13
+ spec.homepage = "https://github.com/emn178/submail"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "rspec", "~> 3.2"
21
+ spec.add_development_dependency "rspec-its", "~> 1.2.0"
22
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: submail
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chen Yi-Cyuan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-its
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.0
41
+ description: Submail client api.
42
+ email:
43
+ - emn178@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - CHANGELOG.md
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/submail.rb
56
+ - lib/submail/address_book_mail.rb
57
+ - lib/submail/address_book_message.rb
58
+ - lib/submail/configuration.rb
59
+ - lib/submail/helper.rb
60
+ - lib/submail/mail_send.rb
61
+ - lib/submail/mail_x_send.rb
62
+ - lib/submail/message_x_send.rb
63
+ - lib/submail/version.rb
64
+ - spec/message_x_send_spec.rb
65
+ - spec/spec_helper.rb
66
+ - submail.gemspec
67
+ homepage: https://github.com/emn178/submail
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.2.2
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Submail client api.
91
+ test_files:
92
+ - spec/message_x_send_spec.rb
93
+ - spec/spec_helper.rb