Class: CallDetail
- Inherits:
-
Object
- Object
- CallDetail
- Defined in:
- lib/tbr/call_detail.rb
Instance Attribute Summary collapse
-
#area ⇒ Object
readonly
OBS record type DC - page 41.
-
#call_type ⇒ Object
readonly
OBS record type DC - page 41.
-
#cost ⇒ Object
readonly
OBS record type DC - page 41.
-
#destination ⇒ Object
readonly
OBS record type DC - page 41.
-
#duration ⇒ Object
readonly
OBS record type DC - page 41.
-
#start_date ⇒ Object
readonly
OBS record type DC - page 41.
-
#start_time ⇒ Object
readonly
OBS record type DC - page 41.
Instance Method Summary collapse
-
#initialize(record, call_type) ⇒ CallDetail
constructor
A new instance of CallDetail.
Constructor Details
#initialize(record, call_type) ⇒ CallDetail
Returns a new instance of CallDetail.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/tbr/call_detail.rb', line 9 def initialize(record,call_type) fields = record.split(',') if fields[0] == 'DC' && fields[8] == 'D' then # Call Detail record @call_type = call_type.desc(fields[9]) @duration = Time.at(fields[10].to_i).gmtime.strftime('%R:%S') @destination = fields[12] @area = fields[16] @start_date = Time.parse(fields[18]).strftime('%d/%m/%Y') @start_time = fields[20] @cost = fields[33].to_f else raise ArgumentError, "Invalid record type - " + fields[0], caller end end |
Instance Attribute Details
#area ⇒ Object (readonly)
OBS record type DC - page 41
7 8 9 |
# File 'lib/tbr/call_detail.rb', line 7 def area @area end |
#call_type ⇒ Object (readonly)
OBS record type DC - page 41
7 8 9 |
# File 'lib/tbr/call_detail.rb', line 7 def call_type @call_type end |
#cost ⇒ Object (readonly)
OBS record type DC - page 41
7 8 9 |
# File 'lib/tbr/call_detail.rb', line 7 def cost @cost end |
#destination ⇒ Object (readonly)
OBS record type DC - page 41
7 8 9 |
# File 'lib/tbr/call_detail.rb', line 7 def destination @destination end |
#duration ⇒ Object (readonly)
OBS record type DC - page 41
7 8 9 |
# File 'lib/tbr/call_detail.rb', line 7 def duration @duration end |
#start_date ⇒ Object (readonly)
OBS record type DC - page 41
7 8 9 |
# File 'lib/tbr/call_detail.rb', line 7 def start_date @start_date end |
#start_time ⇒ Object (readonly)
OBS record type DC - page 41
7 8 9 |
# File 'lib/tbr/call_detail.rb', line 7 def start_time @start_time end |