Class: AliyunExmailCSVGenerator::Account
- Inherits:
-
Object
- Object
- AliyunExmailCSVGenerator::Account
- Defined in:
- lib/aliyun_exmail_csv_generator/account.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ workno: nil, password: 'Hello1234', department: '公司', phone_ext: nil, title: nil, mobile: nil, capacity: 2048 }
Instance Attribute Summary collapse
-
#capacity ⇒ Object
Returns the value of attribute capacity.
-
#department ⇒ Object
Returns the value of attribute department.
-
#email ⇒ Object
Returns the value of attribute email.
-
#mobile ⇒ Object
Returns the value of attribute mobile.
-
#name ⇒ Object
Returns the value of attribute name.
-
#password ⇒ Object
Returns the value of attribute password.
-
#phone_ext ⇒ Object
Returns the value of attribute phone_ext.
-
#title ⇒ Object
Returns the value of attribute title.
-
#workno ⇒ Object
Returns the value of attribute workno.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, email, options = DEFAULT_OPTIONS) ⇒ Account
constructor
A new instance of Account.
- #to_csv_row ⇒ Object
Constructor Details
#initialize(name, email, options = DEFAULT_OPTIONS) ⇒ Account
Returns a new instance of Account.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 18 def initialize(name, email, = DEFAULT_OPTIONS) ||= DEFAULT_OPTIONS @name = name @email = email @workno = [:workno] || DEFAULT_OPTIONS[:workno] @password = [:password] || DEFAULT_OPTIONS[:password] @department = [:department] || DEFAULT_OPTIONS[:department] @phone_ext = [:phone_ext] || DEFAULT_OPTIONS[:phone_ext] @title = [:title] || DEFAULT_OPTIONS[:title] @mobile = [:mobile] || DEFAULT_OPTIONS[:mobile] @capacity = [:capacity] || DEFAULT_OPTIONS[:capacity] end |
Instance Attribute Details
#capacity ⇒ Object
Returns the value of attribute capacity.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def capacity @capacity end |
#department ⇒ Object
Returns the value of attribute department.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def department @department end |
#email ⇒ Object
Returns the value of attribute email.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def email @email end |
#mobile ⇒ Object
Returns the value of attribute mobile.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def mobile @mobile end |
#name ⇒ Object
Returns the value of attribute name.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def name @name end |
#password ⇒ Object
Returns the value of attribute password.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def password @password end |
#phone_ext ⇒ Object
Returns the value of attribute phone_ext.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def phone_ext @phone_ext end |
#title ⇒ Object
Returns the value of attribute title.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def title @title end |
#workno ⇒ Object
Returns the value of attribute workno.
16 17 18 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 16 def workno @workno end |
Class Method Details
.from(name_list, options = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 37 def from(name_list, = nil) accounts = [] name_list.each do |name| = (name) email = "#{name_pinyin}@qcpt.org" accounts << Account.new(name, email, ) end accounts end |
.name_to_pinyin(name) ⇒ Object
47 48 49 50 51 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 47 def (name) = PinYin.of_string(name) = .push('.').rotate! if .length > 1 .map(&:downcase).join end |
Instance Method Details
#to_csv_row ⇒ Object
32 33 34 |
# File 'lib/aliyun_exmail_csv_generator/account.rb', line 32 def to_csv_row [@name, @email, @workno, @password, @department, @phone_ext, @title, @mobile, @capacity] end |