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.



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

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]

  jwt = initialize_jwt(mailbox.delivery_options)

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

  logger = mailbox.logger

  content_type = mailbox.delivery_options[:content_type]

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

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type

Returns:

  • (Object)

    the current value of content_type



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

def content_type
  @content_type
end

#jwtObject

Returns the value of attribute jwt

Returns:

  • (Object)

    the current value of jwt



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

def jwt
  @jwt
end

#loggerObject

Returns the value of attribute logger

Returns:

  • (Object)

    the current value of logger



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

def logger
  @logger
end

#passwordObject

Returns the value of attribute password

Returns:

  • (Object)

    the current value of password



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

def password
  @password
end

#tokenObject

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token



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

def token
  @token
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



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

def url
  @url
end

#usernameObject

Returns the value of attribute username

Returns:

  • (Object)

    the current value of username



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

def username
  @username
end

Instance Method Details

#basic_auth?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/mail_room/delivery/postback.rb', line 41

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

#jwt_auth?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/mail_room/delivery/postback.rb', line 37

def jwt_auth?
  self[:jwt].valid?
end

#token_auth?Boolean

Returns:

  • (Boolean)


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

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