Class: MailRoom::Delivery::Postback::Options

Inherits:
Struct
  • Object
show all
Defined in:
lib/mail_room/delivery/postback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mailbox) ⇒ Options

Returns a new instance of Options.


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mail_room/delivery/postback.rb', line 9

def initialize(mailbox)
  url =
    mailbox.delivery_url ||
    mailbox.delivery_options[:delivery_url] ||
    mailbox.delivery_options[:url]

  token =
    mailbox.delivery_token ||
    mailbox.delivery_options[:delivery_token] ||
    mailbox.delivery_options[:token]

  username = mailbox.delivery_options[:username]
  password = mailbox.delivery_options[:password]

  logger = mailbox.logger

  super(url, token, username, password, logger)
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger

Returns:

  • (Object)

    the current value of logger


8
9
10
# File 'lib/mail_room/delivery/postback.rb', line 8

def logger
  @logger
end

#passwordObject

Returns the value of attribute password

Returns:

  • (Object)

    the current value of password


8
9
10
# File 'lib/mail_room/delivery/postback.rb', line 8

def password
  @password
end

#tokenObject

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token


8
9
10
# File 'lib/mail_room/delivery/postback.rb', line 8

def token
  @token
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url


8
9
10
# File 'lib/mail_room/delivery/postback.rb', line 8

def url
  @url
end

#usernameObject

Returns the value of attribute username

Returns:

  • (Object)

    the current value of username


8
9
10
# File 'lib/mail_room/delivery/postback.rb', line 8

def username
  @username
end

Instance Method Details

#basic_auth?Boolean

Returns:

  • (Boolean)

32
33
34
# File 'lib/mail_room/delivery/postback.rb', line 32

def basic_auth?
  !self[:username].nil? && !self[:password].nil?
end

#token_auth?Boolean

Returns:

  • (Boolean)

28
29
30
# File 'lib/mail_room/delivery/postback.rb', line 28

def token_auth?
  !self[:token].nil?
end