Class: Skype::Call

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Call

Returns a new instance of Call.



11
12
13
14
15
# File 'lib/skype/wrappers/call.rb', line 11

def initialize(id)
  @id = id.to_i
  @time = Time.at ::Skype.exec("GET CALL #{id} TIMESTAMP").split(/\s/).last.to_i
  @to = ::Skype.exec("GET CALL #{id} PARTNER_HANDLE").scan(/PARTNER_HANDLE (.+)$/)[0][0] rescue @to = ""
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/skype/wrappers/call.rb', line 9

def id
  @id
end

#timeObject (readonly)

Returns the value of attribute time.



9
10
11
# File 'lib/skype/wrappers/call.rb', line 9

def time
  @time
end

#toObject (readonly)

Returns the value of attribute to.



9
10
11
# File 'lib/skype/wrappers/call.rb', line 9

def to
  @to
end

Instance Method Details

#hangupObject



29
30
31
# File 'lib/skype/wrappers/call.rb', line 29

def hangup
  ::Skype.exec "ALTER CALL #{@id} HANGUP"
end

#statusObject



17
18
19
20
21
22
23
# File 'lib/skype/wrappers/call.rb', line 17

def status
  begin
    return ::Skype.exec("GET CALL #{@id} STATUS", :response_filter => false).scan(/([A-Z]+)$/)[0][0].downcase.to_sym
  rescue
    return :api_error
  end
end

#talking?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/skype/wrappers/call.rb', line 25

def talking?
  status == :inprogress
end