Class: Bvr::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/bvr/call.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#calltypeObject

Returns the value of attribute calltype.



3
4
5
# File 'lib/bvr/call.rb', line 3

def calltype
  @calltype
end

#chargeObject

Returns the value of attribute charge.



3
4
5
# File 'lib/bvr/call.rb', line 3

def charge
  @charge
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/bvr/call.rb', line 3

def id
  @id
end

#raw_destObject

Returns the value of attribute raw_dest.



3
4
5
# File 'lib/bvr/call.rb', line 3

def raw_dest
  @raw_dest
end

#raw_durationObject

Returns the value of attribute raw_duration.



3
4
5
# File 'lib/bvr/call.rb', line 3

def raw_duration
  @raw_duration
end

#raw_start_timeObject

Returns the value of attribute raw_start_time.



3
4
5
# File 'lib/bvr/call.rb', line 3

def raw_start_time
  @raw_start_time
end

Class Method Details

.new_from_response(h) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/bvr/call.rb', line 5

def self.new_from_response(h)
  self.new.tap do |call|
    call.id             = h['CallId']
    call.calltype       = h['CallType']
    call.raw_start_time = h['StartTime']
    call.raw_dest       = h['Destination']
    call.raw_duration   = h['Duration']
    call.charge         = h['Charge']
  end
end

Instance Method Details

#destObject



20
21
22
# File 'lib/bvr/call.rb', line 20

def dest
  @_dest ||= Bvr::Phone.new(self.raw_dest)
end

#durationObject



16
17
18
# File 'lib/bvr/call.rb', line 16

def duration
  @_duration ||= Time.parse(self.raw_duration, self.start_time)
end

#start_timeObject



24
25
26
# File 'lib/bvr/call.rb', line 24

def start_time
  @_start_time ||= Time.parse(self.raw_start_time)
end