motion_yak 0.0.14 → 0.0.15
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.
- data/Gemfile.lock +1 -1
- data/lib/motion_yak.rb +2 -48
- data/lib/motion_yak/base.rb +52 -0
- data/lib/motion_yak/version.rb +1 -1
- metadata +5 -3
data/Gemfile.lock
CHANGED
data/lib/motion_yak.rb
CHANGED
@@ -11,54 +11,8 @@ end
|
|
11
11
|
require 'motion_yak/request'
|
12
12
|
require 'motion_yak/config'
|
13
13
|
require 'motion_yak/json'
|
14
|
+
require 'motion_yak/base'
|
14
15
|
|
15
16
|
module MotionYak
|
16
|
-
|
17
|
-
MotionYak::Config.api_key = api_key
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.key
|
21
|
-
MotionYak::Config.api_key
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.base_url
|
25
|
-
'https://api.emailyak.com/v1'
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.api_url(url)
|
29
|
-
[self.base_url, MotionYak.key, 'json', url].join('/')
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.new_domain(domain, &b)
|
33
|
-
params = {'Domain' => domain, 'CallbackURL' => MotionYak::Config.callback, 'PushEmail' => MotionYak::Config.push_params}
|
34
|
-
MotionYak::Request.post self.api_url('register/domain/'), params do |json|
|
35
|
-
b.call(json)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.new_address(address, &b)
|
40
|
-
params = {'Address' => address, 'CallbackURL' => MotionYak::Config.callback, 'PushEmail' => MotionYak::Config.push_params}
|
41
|
-
MotionYak::Request.post self.api_url('register/address/'), params do |json|
|
42
|
-
b.call(json)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.send_email(options, &b)
|
47
|
-
params = {}
|
48
|
-
params['FromAddress'] = options[:from]
|
49
|
-
params['FromName'] = options[:from_name]
|
50
|
-
params['SenderAddress'] = options[:sender_address]
|
51
|
-
params['ToAddress'] = options[:to]
|
52
|
-
params['ReplyToAddress'] = options[:reply_address]
|
53
|
-
params['CcAddress'] = options[:cc]
|
54
|
-
params['BccAddress'] = options[:bcc]
|
55
|
-
params['Subject'] = options[:subject]
|
56
|
-
params['HtmlBody'] = options[:html]
|
57
|
-
params['TextBody'] = options[:text]
|
58
|
-
params['Headers'] = options[:headers]
|
59
|
-
params['Attachments'] = options[:attachments]
|
60
|
-
MotionYak::Request.post self.api_url('send/email/'), params do |json|
|
61
|
-
b.call(json)
|
62
|
-
end
|
63
|
-
end
|
17
|
+
|
64
18
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module MotionYak
|
2
|
+
module Base
|
3
|
+
def self.config(api_key)
|
4
|
+
MotionYak::Config.api_key = api_key
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.key
|
8
|
+
MotionYak::Config.api_key
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.base_url
|
12
|
+
'https://api.emailyak.com/v1'
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.api_url(url)
|
16
|
+
[self.base_url, MotionYak.key, 'json', url].join('/')
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.new_domain(domain, &b)
|
20
|
+
params = {'Domain' => domain, 'CallbackURL' => MotionYak::Config.callback, 'PushEmail' => MotionYak::Config.push_params}
|
21
|
+
MotionYak::Request.post self.api_url('register/domain/'), params do |json|
|
22
|
+
b.call(json)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.new_address(address, &b)
|
27
|
+
params = {'Address' => address, 'CallbackURL' => MotionYak::Config.callback, 'PushEmail' => MotionYak::Config.push_params}
|
28
|
+
MotionYak::Request.post self.api_url('register/address/'), params do |json|
|
29
|
+
b.call(json)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.send_email(options, &b)
|
34
|
+
params = {}
|
35
|
+
params['FromAddress'] = options[:from]
|
36
|
+
params['FromName'] = options[:from_name]
|
37
|
+
params['SenderAddress'] = options[:sender_address]
|
38
|
+
params['ToAddress'] = options[:to]
|
39
|
+
params['ReplyToAddress'] = options[:reply_address]
|
40
|
+
params['CcAddress'] = options[:cc]
|
41
|
+
params['BccAddress'] = options[:bcc]
|
42
|
+
params['Subject'] = options[:subject]
|
43
|
+
params['HtmlBody'] = options[:html]
|
44
|
+
params['TextBody'] = options[:text]
|
45
|
+
params['Headers'] = options[:headers]
|
46
|
+
params['Attachments'] = options[:attachments]
|
47
|
+
MotionYak::Request.post self.api_url('send/email/'), params do |json|
|
48
|
+
b.call(json)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/motion_yak/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion_yak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -34,6 +34,7 @@ executables: []
|
|
34
34
|
extensions: []
|
35
35
|
extra_rdoc_files:
|
36
36
|
- lib/motion_yak.rb
|
37
|
+
- lib/motion_yak/base.rb
|
37
38
|
- lib/motion_yak/config.rb
|
38
39
|
- lib/motion_yak/data/ca-certificate.crt
|
39
40
|
- lib/motion_yak/json.rb
|
@@ -46,6 +47,7 @@ files:
|
|
46
47
|
- Gemfile.lock
|
47
48
|
- Rakefile
|
48
49
|
- lib/motion_yak.rb
|
50
|
+
- lib/motion_yak/base.rb
|
49
51
|
- lib/motion_yak/config.rb
|
50
52
|
- lib/motion_yak/data/ca-certificate.crt
|
51
53
|
- lib/motion_yak/json.rb
|
@@ -66,7 +68,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
68
|
version: '0'
|
67
69
|
segments:
|
68
70
|
- 0
|
69
|
-
hash:
|
71
|
+
hash: -4246791457052316281
|
70
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
73
|
none: false
|
72
74
|
requirements:
|
@@ -75,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
77
|
version: '0'
|
76
78
|
segments:
|
77
79
|
- 0
|
78
|
-
hash:
|
80
|
+
hash: -4246791457052316281
|
79
81
|
requirements: []
|
80
82
|
rubyforge_project:
|
81
83
|
rubygems_version: 1.8.21
|