Class: SendGridActionMailerAdapter::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgrid_actionmailer_adapter/configuration.rb

Constant Summary collapse

DEFAULT_RETRY_MAX_COUNT =
0
DEFAULT_RETRY_WAIT_SECONDS =
1.0

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



9
10
11
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 9

def api_key
  @api_key
end

.hostObject

Returns the value of attribute host.



9
10
11
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 9

def host
  @host
end

.request_headersObject

Returns the value of attribute request_headers.



9
10
11
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 9

def request_headers
  @request_headers
end

.retry_max_countObject

Returns the value of attribute retry_max_count.



9
10
11
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 9

def retry_max_count
  @retry_max_count
end

.retry_wait_secondsObject

Returns the value of attribute retry_wait_seconds.



9
10
11
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 9

def retry_wait_seconds
  @retry_wait_seconds
end

.return_responseObject

Returns the value of attribute return_response.



9
10
11
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 9

def return_response
  @return_response
end

.versionObject

Returns the value of attribute version.



9
10
11
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 9

def version
  @version
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Set your configuration with block.

Yields:

  • (_self)

Yield Parameters:



13
14
15
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 13

def configure
  yield(self)
end

.reset!Object

Reset settings for test.



37
38
39
40
41
42
43
44
45
46
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 37

def reset!
  self.api_key = nil
  self.host = nil
  self.request_headers = nil
  self.version = nil
  self.retry_max_count = nil
  self.retry_wait_seconds = nil
  self.return_response = nil
  @settings = nil
end

.settingsHash

Returns configuration hash.

Returns:

  • (Hash)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sendgrid_actionmailer_adapter/configuration.rb', line 20

def settings
  @settings ||= {
    sendgrid: {
      api_key: api_key || '',
      host: host,
      request_headers: request_headers,
      version: version,
    },
    retry: {
      max_count: retry_max_count || DEFAULT_RETRY_MAX_COUNT,
      wait_seconds: retry_wait_seconds || DEFAULT_RETRY_WAIT_SECONDS,
    },
    return_response: return_response,
  }.freeze
end