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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 257b2839765515b3873c2b23d3a3b0f73377db5bc2617b328ba87aa346a9190d
4
- data.tar.gz: a16e178d363ef443467072e80b0eb67158aeb657e8b8471cfa703d2063e58762
3
+ metadata.gz: cda727e34e3f195024c8f79b1c1b1ea1f2fd91513bf5fbfb673259ba214f8905
4
+ data.tar.gz: b2614061c64a98dabe42ca0cd7fc50b8b2229178b745d1a775ab958f6ab5ba26
5
5
  SHA512:
6
- metadata.gz: 86c26c324b44c3a7fbe084f14e535250ed83f664a3914715a489baf5fec64ac219bb33c85890af5f48b4ff67f918bb98a5e1b5f9ea2f766260a5d697326bcef5
7
- data.tar.gz: e6d208ab2b81920a372d13c6f1b2efa1977b9767e355babfd9a6643a893f78dc8ce6b17c588d434a641bf3ac2a4762f7ff3814a5b052772baafd1e2d6e118511
6
+ metadata.gz: a8f566d825c3c781dd2b6054d06dded9b703ed897b179fbed7857cbd39312c468a52f9c48db4e73321c3e2daf97da41fe12f0e2a0b1b6b21f694beea37c5458d
7
+ data.tar.gz: cf9a201d07085fadc677d321d62acfb27a97025f8ceb27c8338763a21b7781feddf388eb62f501a8f73c935b2a4ba4374425551b1387f636c3204b714805c373
@@ -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
- return true
39
+ true
39
40
  end
40
41
  end
41
42
  end
@@ -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.dig(:x_ratelimit_reset) || Time.now.to_i
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
@@ -1,3 +1,3 @@
1
1
  module Improvmx
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.2'.freeze
3
3
  end
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.1.3
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-03-15 00:00:00.000000000 Z
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