Class: One::EmailDirect::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/one/email_direct/credentials.rb

Overview

Class to hold EmailDirect API credentials.

Author:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account, password, encrypted_password = '') ⇒ Credentials

Constructs a Credentials instance.

Parameters:

  • account (String)

    the EmailDirect account.

  • password (String)

    the EmailDirect API password.



19
20
21
22
23
24
25
# File 'lib/one/email_direct/credentials.rb', line 19

def initialize(, password, encrypted_password='')
  encrypted_password ||= ''

  @account = 
  @password = password
  @encrypted_password = encrypted_password
end

Instance Attribute Details

#accountString (readonly)

EmailDirect account username.

Returns:

  • (String)

    the current value of account



9
10
11
# File 'lib/one/email_direct/credentials.rb', line 9

def 
  @account
end

#encrypted_passwordString (readonly)

optional encryped password (future use).

Returns:

  • (String)

    the current value of encrypted_password



9
10
11
# File 'lib/one/email_direct/credentials.rb', line 9

def encrypted_password
  @encrypted_password
end

#passwordString (readonly)

the API password configured in the EmailDirect web interface.

Returns:

  • (String)

    the current value of password



9
10
11
# File 'lib/one/email_direct/credentials.rb', line 9

def password
  @password
end

Class Method Details

.create_from(config) ⇒ One::EmailDirect::Credentials

Create credentials from a hash.

Parameters:

  • config (Hash)

    a hash which contains the EmailDirect account credentials.

Returns:



35
36
37
38
39
40
# File 'lib/one/email_direct/credentials.rb', line 35

def self.create_from(config)
  return One::EmailDirect::Credentials.new(
    config[:account],
    config[:password],
    config[:encrypted_password])
end