improvmx 0.1.3 → 0.2
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/lib/improvmx/aliases.rb +2 -1
- data/lib/improvmx/client.rb +2 -0
- data/lib/improvmx/exceptions/exceptions.rb +1 -1
- data/lib/improvmx/smtp.rb +22 -0
- data/lib/improvmx/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: cda727e34e3f195024c8f79b1c1b1ea1f2fd91513bf5fbfb673259ba214f8905
|
4
|
+
data.tar.gz: b2614061c64a98dabe42ca0cd7fc50b8b2229178b745d1a775ab958f6ab5ba26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8f566d825c3c781dd2b6054d06dded9b703ed897b179fbed7857cbd39312c468a52f9c48db4e73321c3e2daf97da41fe12f0e2a0b1b6b21f694beea37c5458d
|
7
|
+
data.tar.gz: cf9a201d07085fadc677d321d62acfb27a97025f8ceb27c8338763a21b7781feddf388eb62f501a8f73c935b2a4ba4374425551b1387f636c3204b714805c373
|
data/lib/improvmx/aliases.rb
CHANGED
@@ -27,6 +27,7 @@ module Improvmx
|
|
27
27
|
|
28
28
|
def create_or_update_alias(alias_name, forward_to, domain)
|
29
29
|
return true if update_alias(alias_name, forward_to, domain)
|
30
|
+
|
30
31
|
create_alias(alias_name, forward_to, domain)
|
31
32
|
end
|
32
33
|
|
@@ -35,7 +36,7 @@ module Improvmx
|
|
35
36
|
|
36
37
|
response.ok?
|
37
38
|
rescue NotFoundError
|
38
|
-
|
39
|
+
true
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
data/lib/improvmx/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'improvmx/aliases'
|
2
|
+
require 'improvmx/smtp'
|
2
3
|
require 'improvmx/response'
|
3
4
|
require 'improvmx/utils'
|
4
5
|
require 'improvmx/exceptions/exceptions'
|
@@ -6,6 +7,7 @@ require 'improvmx/exceptions/exceptions'
|
|
6
7
|
module Improvmx
|
7
8
|
class Client
|
8
9
|
include Improvmx::Aliases
|
10
|
+
include Improvmx::SMTP
|
9
11
|
include Improvmx::Utils
|
10
12
|
|
11
13
|
def initialize(api_key = Improvmx.api_key)
|
@@ -53,7 +53,7 @@ module Improvmx
|
|
53
53
|
super(message, response)
|
54
54
|
|
55
55
|
if response
|
56
|
-
reset_at = response.headers
|
56
|
+
reset_at = response.headers[:x_ratelimit_reset] || Time.now.to_i
|
57
57
|
@wait_seconds = reset_at.to_i - Time.now.to_i
|
58
58
|
else
|
59
59
|
@wait_seconds = 0
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Improvmx
|
2
|
+
# All SMTP related endpoints
|
3
|
+
module SMTP
|
4
|
+
def list_smtp(domain, params = {})
|
5
|
+
get("/domains/#{domain}/credentials/", params).to_h
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_smtp(username, password, domain)
|
9
|
+
response = post("/domains/#{domain}/credentials/", { username: username, password: password })
|
10
|
+
|
11
|
+
response.ok?
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete_smtp(username, domain)
|
15
|
+
response = delete("/domains/#{domain}/credentials/#{username}")
|
16
|
+
|
17
|
+
response.ok?
|
18
|
+
rescue NotFoundError
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/improvmx/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: improvmx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C.S.V. Alpha
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/improvmx/client.rb
|
40
40
|
- lib/improvmx/exceptions/exceptions.rb
|
41
41
|
- lib/improvmx/response.rb
|
42
|
+
- lib/improvmx/smtp.rb
|
42
43
|
- lib/improvmx/utils.rb
|
43
44
|
- lib/improvmx/version.rb
|
44
45
|
homepage: https://improvmx.com
|