Ruby4Skype 0.3.1 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +95 -7
- data/Rakefile +3 -3
- data/lib/{skypeapi.rb → skype.rb} +102 -89
- data/lib/{skypeapi → skype}/application.rb +5 -5
- data/lib/{skypeapi → skype}/call.rb +9 -9
- data/lib/{skypeapi → skype}/chat.rb +176 -176
- data/lib/{skypeapi → skype}/chatmember.rb +31 -31
- data/lib/{skypeapi → skype}/chatmessage.rb +9 -9
- data/lib/{skypeapi → skype}/error.rb +1 -1
- data/lib/{skypeapi → skype}/event.rb +2 -2
- data/lib/{skypeapi → skype}/filetransfer.rb +2 -2
- data/lib/{skypeapi → skype}/group.rb +8 -8
- data/lib/{skypeapi → skype}/menuitem.rb +4 -4
- data/lib/{skypeapi → skype}/message.rb +1 -1
- data/lib/{skypeapi → skype}/object.rb +16 -15
- data/lib/{skypeapi → skype}/os/etc.rb +35 -9
- data/lib/skype/os/linux.rb +115 -0
- data/lib/skype/os/linux.rb~ +117 -0
- data/lib/skype/os/mac.rb +217 -0
- data/lib/{skypeapi → skype}/os/notifier.rb +1 -1
- data/lib/skype/os/timer.rb +108 -0
- data/lib/{skypeapi → skype}/os/window_event_queue.rb +16 -16
- data/lib/{skypeapi → skype}/os/window_messagehandler.rb +12 -12
- data/lib/{skypeapi → skype}/os/windows.rb +10 -10
- data/lib/{skypeapi → skype}/profile.rb +3 -3
- data/lib/{skypeapi → skype}/sharefunctions.rb +6 -6
- data/lib/{skypeapi → skype}/sms.rb +3 -3
- data/lib/{skypeapi → skype}/user.rb +1 -1
- data/lib/{skypeapi → skype}/version.rb +2 -2
- data/lib/{skypeapi → skype}/voicemail.rb +4 -4
- data/spec/{skypeapi → skype}/application_spec.rb +13 -15
- data/spec/{skypeapi → skype}/chat_spec.rb +75 -77
- data/spec/{skypeapi → skype}/chatmember_spec.rb +13 -13
- data/spec/{skypeapi → skype}/chatmessage_spec.rb +12 -13
- data/spec/skype/event_spec.rb +33 -0
- data/spec/{skypeapi → skype}/filetransfer_spec.rb +10 -11
- data/spec/skype/group_spec.rb +15 -0
- data/spec/{skypeapi → skype}/menuitem_spec.rb +11 -9
- data/spec/skype/os/linux_spec.rb +59 -0
- data/spec/skype/os/linux_spec.rb~ +58 -0
- data/spec/{skypeapi → skype}/os/windows_spec.rb +8 -8
- data/spec/skype/profile_spec.rb +24 -0
- data/spec/skype/user_spec.rb +25 -0
- data/spec/skype_spec.rb +530 -0
- metadata +44 -40
- data/lib/skypeapi/os/linux.rb +0 -110
- data/lib/skypeapi/os/mac.rb +0 -98
- data/spec/skypeapi/event_spec.rb +0 -31
- data/spec/skypeapi/group_spec.rb +0 -16
- data/spec/skypeapi/profile_spec.rb +0 -22
- data/spec/skypeapi/user_spec.rb +0 -25
- data/spec/skypeapi_spec.rb +0 -528
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Ruby4Skype
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bopper
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-11 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -26,45 +26,49 @@ files:
|
|
26
26
|
- LICENSE
|
27
27
|
- README
|
28
28
|
- Rakefile
|
29
|
-
- lib/
|
30
|
-
- lib/
|
31
|
-
- lib/
|
32
|
-
- lib/
|
33
|
-
- lib/
|
34
|
-
- lib/
|
35
|
-
- lib/
|
36
|
-
- lib/
|
37
|
-
- lib/
|
38
|
-
- lib/
|
39
|
-
- lib/
|
40
|
-
- lib/
|
41
|
-
- lib/
|
42
|
-
- lib/
|
43
|
-
- lib/
|
44
|
-
- lib/
|
45
|
-
- lib/
|
46
|
-
- lib/
|
47
|
-
- lib/
|
48
|
-
- lib/
|
49
|
-
- lib/
|
50
|
-
- lib/
|
51
|
-
- lib/
|
52
|
-
- lib/
|
53
|
-
- lib/
|
54
|
-
- lib/
|
29
|
+
- lib/skype/application.rb
|
30
|
+
- lib/skype/call.rb
|
31
|
+
- lib/skype/chat.rb
|
32
|
+
- lib/skype/chatmember.rb
|
33
|
+
- lib/skype/chatmessage.rb
|
34
|
+
- lib/skype/error.rb
|
35
|
+
- lib/skype/event.rb
|
36
|
+
- lib/skype/filetransfer.rb
|
37
|
+
- lib/skype/group.rb
|
38
|
+
- lib/skype/menuitem.rb
|
39
|
+
- lib/skype/message.rb
|
40
|
+
- lib/skype/object.rb
|
41
|
+
- lib/skype/os/etc.rb
|
42
|
+
- lib/skype/os/linux.rb
|
43
|
+
- lib/skype/os/linux.rb~
|
44
|
+
- lib/skype/os/mac.rb
|
45
|
+
- lib/skype/os/notifier.rb
|
46
|
+
- lib/skype/os/timer.rb
|
47
|
+
- lib/skype/os/windows.rb
|
48
|
+
- lib/skype/os/window_event_queue.rb
|
49
|
+
- lib/skype/os/window_messagehandler.rb
|
50
|
+
- lib/skype/profile.rb
|
51
|
+
- lib/skype/sharefunctions.rb
|
52
|
+
- lib/skype/sms.rb
|
53
|
+
- lib/skype/user.rb
|
54
|
+
- lib/skype/version.rb
|
55
|
+
- lib/skype/voicemail.rb
|
56
|
+
- lib/skype.rb
|
55
57
|
- spec/matcher_be_boolean.rb
|
56
|
-
- spec/
|
57
|
-
- spec/
|
58
|
-
- spec/
|
59
|
-
- spec/
|
60
|
-
- spec/
|
61
|
-
- spec/
|
62
|
-
- spec/
|
63
|
-
- spec/
|
64
|
-
- spec/
|
65
|
-
- spec/
|
66
|
-
- spec/
|
67
|
-
- spec/
|
58
|
+
- spec/skype/application_spec.rb
|
59
|
+
- spec/skype/chatmember_spec.rb
|
60
|
+
- spec/skype/chatmessage_spec.rb
|
61
|
+
- spec/skype/chat_spec.rb
|
62
|
+
- spec/skype/event_spec.rb
|
63
|
+
- spec/skype/filetransfer_spec.rb
|
64
|
+
- spec/skype/group_spec.rb
|
65
|
+
- spec/skype/menuitem_spec.rb
|
66
|
+
- spec/skype/os/linux_spec.rb
|
67
|
+
- spec/skype/os/linux_spec.rb~
|
68
|
+
- spec/skype/os/windows_spec.rb
|
69
|
+
- spec/skype/profile_spec.rb
|
70
|
+
- spec/skype/user_spec.rb
|
71
|
+
- spec/skype_spec.rb
|
68
72
|
has_rdoc: true
|
69
73
|
homepage: http://rubyforge.org/projects/skyperapper/
|
70
74
|
licenses: []
|
data/lib/skypeapi/os/linux.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
require 'dbus'
|
2
|
-
require "thread"
|
3
|
-
|
4
|
-
module SkypeAPI
|
5
|
-
module OS
|
6
|
-
class Linux < Abstruct
|
7
|
-
class Notify < DBus::Object
|
8
|
-
dbus_interface "com.Skype.API.Client" do
|
9
|
-
dbus_method :Notify, "in data:s" do |res|
|
10
|
-
@os.push_queue res
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def initialize service_name="org.ruby.service"
|
16
|
-
super()
|
17
|
-
bus = DBus.session_bus
|
18
|
-
exobj = Notify.new("/com/Skype/Client")
|
19
|
-
#exobj.instance_variable_set(:@queue, @queue)
|
20
|
-
exobj.instance_variable_set(:@os, self)
|
21
|
-
bus.request_service(service_name).export(exobj)
|
22
|
-
service = bus.service 'com.Skype.API'
|
23
|
-
@invoker = service.object '/com/Skype'
|
24
|
-
@invoker.default_iface = 'com.Skype.API'
|
25
|
-
@invoker.introspect
|
26
|
-
|
27
|
-
#l = DBus::Main.new
|
28
|
-
#l << bus
|
29
|
-
#Thread.new do
|
30
|
-
# l.run
|
31
|
-
#end
|
32
|
-
end
|
33
|
-
|
34
|
-
def attach name
|
35
|
-
invoke "NAME #{name}"
|
36
|
-
invoke "PROTOCOL 9999"
|
37
|
-
if @first_attached
|
38
|
-
@queue.push proc{do_event :attached}
|
39
|
-
else
|
40
|
-
@queue.push proc{do_event :reattached}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def invoke_prototype(cmd)
|
45
|
-
res = @invoker.Invoke('#' + @send_count.to_s + ' ' + cmd)[0]
|
46
|
-
old_count = @send_count.to_s
|
47
|
-
@send_count+=1
|
48
|
-
@queue.push proc{do_event :sent, '#' + old_count + ' ' + cmd}
|
49
|
-
@queue.push proc{do_event :received, res}
|
50
|
-
res =~ /^##{old_count} (.*)$/m
|
51
|
-
return $1
|
52
|
-
end
|
53
|
-
|
54
|
-
alias :invoke_block :invoke_prototype
|
55
|
-
|
56
|
-
def invoke_callcack cmd,cb=Proc.new
|
57
|
-
res = send_prototype(cmd)
|
58
|
-
cb.call(res)
|
59
|
-
end
|
60
|
-
|
61
|
-
def close
|
62
|
-
end
|
63
|
-
|
64
|
-
def polling
|
65
|
-
flag = true
|
66
|
-
begin
|
67
|
-
while flag
|
68
|
-
proc = @queue.shift true
|
69
|
-
proc.call
|
70
|
-
end
|
71
|
-
rescue
|
72
|
-
flag = false
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def push_queue res
|
77
|
-
@queue.push(proc{do_event(:received, res)})
|
78
|
-
|
79
|
-
if res == 'CONNSTATUS LOGGEDOUT'
|
80
|
-
@attached = false
|
81
|
-
@queue.push(proc{do_event(:detached)})
|
82
|
-
SkypeAPI.attach
|
83
|
-
end
|
84
|
-
|
85
|
-
flag = false
|
86
|
-
@notify.each do |reg,action|
|
87
|
-
if res =~ reg
|
88
|
-
tmp = $1
|
89
|
-
@queue.push(proc{action.call(tmp)})
|
90
|
-
flag = true
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
unless flag
|
95
|
-
action = @notify[nil]
|
96
|
-
@queue.push(proc{action.call(cmd)})
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
def wait
|
102
|
-
end
|
103
|
-
|
104
|
-
def attach_wait(name)
|
105
|
-
@name = name
|
106
|
-
attach(name)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
data/lib/skypeapi/os/mac.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
require 'osx/cocoa'
|
2
|
-
OSX.require_framework 'Skype'
|
3
|
-
|
4
|
-
module SkypeAPI
|
5
|
-
module OS
|
6
|
-
class Mac
|
7
|
-
class Server < OSX::NSObject
|
8
|
-
def clientApplicationName
|
9
|
-
@client_application_name
|
10
|
-
end
|
11
|
-
|
12
|
-
addRubyMethod_withType 'skypeAttachResponse:', 'v@:i'
|
13
|
-
def skypeAttachResponse status
|
14
|
-
p [:skypeAttachResponse,status]
|
15
|
-
case status
|
16
|
-
when 0 #?
|
17
|
-
when 1 #sccess
|
18
|
-
@upper.attached = true
|
19
|
-
when 2 ####
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
#addRubyMethod_withType 'skypeBecameAviable:', 'v@:@'
|
24
|
-
def skypeBecameAvilable notification
|
25
|
-
p [:skypeBecameAvilable,notification]
|
26
|
-
end
|
27
|
-
|
28
|
-
#addRubyMethod_withType 'skypeBecameUnavialbe:', 'v@:@'
|
29
|
-
def skypeBecameUnavilable notification
|
30
|
-
p [:skypeBecameUnavilable,notification]
|
31
|
-
end
|
32
|
-
|
33
|
-
#addRubyMethod_withType 'skypeAttachResponse:', 'v@:@'
|
34
|
-
def skypeNotificationReceived notifation_string
|
35
|
-
p [:skypeNotificationReceived,notifation_string]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def initialize client_application_name='ruby4skype'
|
40
|
-
raise Skype::Error::NotImplement
|
41
|
-
|
42
|
-
@server = Server.alloc.init
|
43
|
-
@server.instance_variable_set :@upper, self
|
44
|
-
@server.instance_variable_set :@client_application_name, @client_application_name
|
45
|
-
OSX::SkypeAPI.setSkypeDelegate @server
|
46
|
-
|
47
|
-
@notify = Hash.new
|
48
|
-
@event = Hash.new do |h,k|
|
49
|
-
h[k] = Array.new
|
50
|
-
end
|
51
|
-
|
52
|
-
@attached = false
|
53
|
-
Thread.new do
|
54
|
-
OSX::NSRunLoop.currentRunLoop.run
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
attr_reader :attached
|
59
|
-
|
60
|
-
def attach
|
61
|
-
OSX::SkypeAPI.connect
|
62
|
-
end
|
63
|
-
|
64
|
-
def attach_wait
|
65
|
-
self.attach
|
66
|
-
loop do
|
67
|
-
break if @attached
|
68
|
-
sleep 0.123
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def dettach
|
73
|
-
OSX::SkypeAPI.disconnect
|
74
|
-
end
|
75
|
-
|
76
|
-
def skype_runnging?
|
77
|
-
OSX::SkypeAPI.isSkypeRunnging
|
78
|
-
end
|
79
|
-
|
80
|
-
def invoke_prototype cmd
|
81
|
-
res = OSX::SkypeAPI.sendSkypeCommand(cmd)
|
82
|
-
@queue.push(proc{do_event(:sent, cmd)}) if exist_event? :sent
|
83
|
-
@queue.push(proc{do_event(:received, res)}) if exist_event? :received
|
84
|
-
return res
|
85
|
-
end
|
86
|
-
|
87
|
-
def invoke_callback cmd,cb=Proc.new
|
88
|
-
res = invoke_prototype cmd
|
89
|
-
cb.call res
|
90
|
-
end
|
91
|
-
|
92
|
-
def invoke_block cmd, waitLimit = WAIT_CMD_LIMIT
|
93
|
-
res = invoke_prototype cmd
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
data/spec/skypeapi/event_spec.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'skypeapi'
|
2
|
-
require 'timeout'
|
3
|
-
|
4
|
-
describe SkypeAPI::Event do
|
5
|
-
before :all do
|
6
|
-
SkypeAPI.init
|
7
|
-
SkypeAPI.start_messageloop
|
8
|
-
SkypeAPI.attach_wait
|
9
|
-
end
|
10
|
-
|
11
|
-
after :all do
|
12
|
-
SkypeAPI.close
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should event create" do
|
16
|
-
pending 'skype event obs?'
|
17
|
-
flag = false
|
18
|
-
event = SkypeAPI::Event.create('testEvent','testEvent','Testhint') do
|
19
|
-
flag = true
|
20
|
-
end
|
21
|
-
event.should be_instance_of SkypeAPI::Event
|
22
|
-
|
23
|
-
puts 'click testEvent'
|
24
|
-
|
25
|
-
timeout(60){sleep 1 until flag}
|
26
|
-
|
27
|
-
event.delete.should be_true
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
data/spec/skypeapi/group_spec.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# To change this template, choose Tools | Templates
|
2
|
-
# and open the template in the editor.
|
3
|
-
|
4
|
-
require 'skypeapi'
|
5
|
-
|
6
|
-
describe SkypeAPI::Group do
|
7
|
-
before(:each) do
|
8
|
-
pending 'constructor is broken'
|
9
|
-
@group = Group.new
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should desc" do
|
13
|
-
# TODO
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'skypeapi'
|
2
|
-
|
3
|
-
describe SkypeAPI::Profile do
|
4
|
-
before :all do
|
5
|
-
SkypeAPI.init
|
6
|
-
SkypeAPI.start_messageloop
|
7
|
-
SkypeAPI.attach_wait
|
8
|
-
end
|
9
|
-
|
10
|
-
after :all do
|
11
|
-
SkypeAPI.close
|
12
|
-
end
|
13
|
-
|
14
|
-
before(:each) do
|
15
|
-
@profile = Profile.new
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should desc" do
|
19
|
-
# TODO
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
data/spec/skypeapi/user_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# To change this template, choose Tools | Templates
|
2
|
-
# and open the template in the editor.
|
3
|
-
|
4
|
-
require 'skypeapi'
|
5
|
-
|
6
|
-
describe SkypeAPI::User do
|
7
|
-
before :all do
|
8
|
-
SkypeAPI.init
|
9
|
-
SkypeAPI.start_messageloop
|
10
|
-
SkypeAPI.attach_wait
|
11
|
-
end
|
12
|
-
|
13
|
-
after :all do
|
14
|
-
SkypeAPI.close
|
15
|
-
end
|
16
|
-
|
17
|
-
before(:each) do
|
18
|
-
@user = User.new
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should desc" do
|
22
|
-
# TODO
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
data/spec/skypeapi_spec.rb
DELETED
@@ -1,528 +0,0 @@
|
|
1
|
-
require 'matcher_be_boolean'
|
2
|
-
require 'skypeapi'
|
3
|
-
require 'timeout'
|
4
|
-
|
5
|
-
describe SkypeAPI do
|
6
|
-
it "VERSION should 0.3.1" do
|
7
|
-
SkypeAPI::VERSION.to_s.should == '0.3.1'
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should init and attach and close" do
|
11
|
-
SkypeAPI.init
|
12
|
-
SkypeAPI.attach_wait
|
13
|
-
SkypeAPI.close
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should more time attach and close" do
|
17
|
-
10.times do
|
18
|
-
SkypeAPI.init
|
19
|
-
timeout(3){ SkypeAPI.attach_wait }
|
20
|
-
SkypeAPI.close
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
it "user(handle) should be instance of SkypeAPI::User" do
|
25
|
-
SkypeAPI.user('hoge').should be_instance_of SkypeAPI::User
|
26
|
-
end
|
27
|
-
|
28
|
-
describe 'when attached' do
|
29
|
-
before :each do
|
30
|
-
SkypeAPI.init
|
31
|
-
SkypeAPI.attach_wait
|
32
|
-
end
|
33
|
-
|
34
|
-
after :each do
|
35
|
-
SkypeAPI.close
|
36
|
-
end
|
37
|
-
|
38
|
-
it "SkypeAPI::Chat should create.send_message" do
|
39
|
-
SkypeAPI::Chat.create('echo123').send_message('hoge test')
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
describe SkypeAPI, 'general methods' do
|
47
|
-
before :all do
|
48
|
-
SkypeAPI.init
|
49
|
-
SkypeAPI.attach_wait
|
50
|
-
end
|
51
|
-
|
52
|
-
after :all do
|
53
|
-
SkypeAPI.close
|
54
|
-
end
|
55
|
-
|
56
|
-
it "ping should be true" do
|
57
|
-
SkypeAPI.ping.should be_true
|
58
|
-
end
|
59
|
-
|
60
|
-
it "get_skype_version should match \d\.\d\.\d\.\d" do
|
61
|
-
SkypeAPI.getSkypeVersion.should match /\d+\.\d+.\d+.\d+/
|
62
|
-
end
|
63
|
-
|
64
|
-
it "get_current_user_handle should be instance of String and not be empty" do
|
65
|
-
SkypeAPI.getCurrentUserHandle.should be_instance_of String
|
66
|
-
SkypeAPI.getCurrentUserHandle.should_not be_empty
|
67
|
-
end
|
68
|
-
|
69
|
-
it "get_user_status should match /^(UNKNOWN)|(ONLINE)|(OFFLINE)|(SKYPEME)|(AWAY)|(NA)|(DND)|(INVISIBLE)|(LOGGEDOUT)$/" do
|
70
|
-
SkypeAPI.getUserStatus.should match /^(UNKNOWN)|(ONLINE)|(OFFLINE)|(SKYPEME)|(AWAY)|(NA)|(DND)|(INVISIBLE)|(LOGGEDOUT)$/
|
71
|
-
end
|
72
|
-
|
73
|
-
it "set_user_status(s) should == s" do
|
74
|
-
s = SkypeAPI.getUserStatus
|
75
|
-
SkypeAPI.setUserStatus(s).should == s
|
76
|
-
end
|
77
|
-
|
78
|
-
it "get_privilege should be boolean" do
|
79
|
-
['SkypeOut','SkypeIn','VOICEMAIL'].each do |user_privilege|
|
80
|
-
SkypeAPI.getPrivilege(user_privilege).should be_boolean
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
it "get_predictive_dialer_country should be instance of String and size 2" do
|
85
|
-
pdCountry = SkypeAPI.getPredictiveDialerCountry
|
86
|
-
pdCountry.should be_instance_of String
|
87
|
-
pdCountry.size.should == 2
|
88
|
-
end
|
89
|
-
|
90
|
-
it "get_connstatus should match (OFFLINE)|(CONNECTING)|(PAUSING)|(ONLINE)" do
|
91
|
-
SkypeAPI.getConnstatus.should match /^(OFFLINE)|(CONNECTING)|(PAUSING)|(ONLINE)$/
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "device and file methods" do
|
95
|
-
it "get_adudio_in should be instance of String and not be empty" do
|
96
|
-
SkypeAPI.getAudioIn.should be_instance_of String
|
97
|
-
SkypeAPI.getAudioIn.should_not be_empty
|
98
|
-
end
|
99
|
-
|
100
|
-
it "set_audio_in(device) should device" do
|
101
|
-
device = SkypeAPI.getAudioIn
|
102
|
-
SkypeAPI.setAudioIn(device).should == device
|
103
|
-
end
|
104
|
-
|
105
|
-
it "get_adudio_out should be instance of String and not be empty" do
|
106
|
-
SkypeAPI.getAudioOut.should be_instance_of String
|
107
|
-
SkypeAPI.getAudioOut.should_not be_empty
|
108
|
-
end
|
109
|
-
|
110
|
-
it "set_audio_out(device) should device" do
|
111
|
-
device = SkypeAPI.getAudioOut
|
112
|
-
SkypeAPI.setAudioOut(device).should == device
|
113
|
-
end
|
114
|
-
|
115
|
-
it "get_ringer should be instance of String and not be empty" do
|
116
|
-
SkypeAPI.getRinger.should be_instance_of String
|
117
|
-
SkypeAPI.getRinger.should_not be_empty
|
118
|
-
end
|
119
|
-
|
120
|
-
it "set_ringer(device) should device" do
|
121
|
-
pending "SET RINGER speaker => ERROR 50 cannot set device"
|
122
|
-
device = SkypeAPI.getRinger
|
123
|
-
SkypeAPI.setRinger(device).should == device
|
124
|
-
end
|
125
|
-
|
126
|
-
it "get_mute should be boolean" do
|
127
|
-
SkypeAPI.getMute.should be_boolean
|
128
|
-
end
|
129
|
-
|
130
|
-
it "set_mute(flag) should flag" do
|
131
|
-
flag = SkypeAPI.getMute
|
132
|
-
SkypeAPI.setMute(flag).should == flag
|
133
|
-
end
|
134
|
-
|
135
|
-
def prepare_avator &block
|
136
|
-
path = File.dirname(File.expand_path(__FILE__ )) << '/skype_avatar.jpg'
|
137
|
-
violated "exist #{path}" if test(?e, path)
|
138
|
-
block.call path
|
139
|
-
File.delete path
|
140
|
-
end
|
141
|
-
|
142
|
-
it "get_avator(path) should be nil and save jpg file" do
|
143
|
-
prepare_avator do |path|
|
144
|
-
SkypeAPI.getAvatar(path).should be_nil
|
145
|
-
test(?e, path).should be_true
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
it "set_avator(path) should path" do
|
150
|
-
prepare_avator do |path|
|
151
|
-
SkypeAPI.getAvatar(path)
|
152
|
-
test(?e, path).should be_true
|
153
|
-
SkypeAPI.setAvatar(path).should == path
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
it "get_ringtone should be instance of String and not be empty" do
|
158
|
-
SkypeAPI.getRingtone.should be_instance_of String
|
159
|
-
SkypeAPI.getRingtone.should_not be_empty
|
160
|
-
end
|
161
|
-
|
162
|
-
it "set_ringtone(rt) should rt" do
|
163
|
-
pending "SET RINGTONE 1 call_in: => ERROR 111 SET File not found"
|
164
|
-
rt = SkypeAPI.getRingtone
|
165
|
-
SkypeAPI.setRingtone(rt).should rt
|
166
|
-
end
|
167
|
-
|
168
|
-
it "get_rigtone_status should be boolean" do
|
169
|
-
SkypeAPI.getRingtoneStatus.should be_boolean
|
170
|
-
end
|
171
|
-
|
172
|
-
it "set_rigtone_status(flag) should flag" do
|
173
|
-
flag = SkypeAPI.getRingtoneStatus
|
174
|
-
SkypeAPI.setRingtoneStatus(flag).should == flag
|
175
|
-
end
|
176
|
-
|
177
|
-
it "get_pc_bspeaker should be boolean" do
|
178
|
-
SkypeAPI.getPCSpeaker.should be_boolean
|
179
|
-
end
|
180
|
-
|
181
|
-
it "set_pc_speaker(flag) should flag" do
|
182
|
-
flag = SkypeAPI.getPCSpeaker
|
183
|
-
SkypeAPI.setPCSpeaker(flag).should == flag
|
184
|
-
end
|
185
|
-
|
186
|
-
it "get_agc should be boolean" do
|
187
|
-
SkypeAPI.getAGC.should be_boolean
|
188
|
-
end
|
189
|
-
|
190
|
-
it "set_agc(flag) should boolean" do
|
191
|
-
flag = SkypeAPI.getAGC
|
192
|
-
SkypeAPI.setAGC(flag).should == flag
|
193
|
-
end
|
194
|
-
|
195
|
-
it "get_aec should be boolean" do
|
196
|
-
SkypeAPI.getAEC.should be_boolean
|
197
|
-
end
|
198
|
-
|
199
|
-
it "set_aec(flag) should boolean" do
|
200
|
-
flag = SkypeAPI.getAEC
|
201
|
-
SkypeAPI.setAEC(flag).should == flag
|
202
|
-
end
|
203
|
-
|
204
|
-
it "reset_idle_timer.should be true" do
|
205
|
-
SkypeAPI.resetIdleTimer.should be_true
|
206
|
-
end
|
207
|
-
|
208
|
-
it "get_auto_away should be boolean" do
|
209
|
-
SkypeAPI.getAutoAway.should be_boolean
|
210
|
-
end
|
211
|
-
|
212
|
-
it "set_auto_away(flag) should flag" do
|
213
|
-
flag = SkypeAPI.getAutoAway
|
214
|
-
SkypeAPI.setAutoAway(flag).should == flag
|
215
|
-
end
|
216
|
-
|
217
|
-
it "get_video_in should be instance of String and not be empty" do
|
218
|
-
SkypeAPI.getVideoIn.should be_instance_of String
|
219
|
-
end
|
220
|
-
|
221
|
-
it "set_video_in(string) should string" do
|
222
|
-
string =SkypeAPI.getVideoIn
|
223
|
-
SkypeAPI.setVideoIn(string) == string
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
describe "UI methods" do
|
228
|
-
before{pending 'uzai'}
|
229
|
-
|
230
|
-
it "should focus" do
|
231
|
-
SkypeAPI.focus.should be_true
|
232
|
-
end
|
233
|
-
|
234
|
-
it "should minimize" do
|
235
|
-
SkypeAPI.minimize.should be_true
|
236
|
-
end
|
237
|
-
|
238
|
-
it "get_window_status should match /(NORMAL)|(MINIMIZED)|(MAXIMIZED)|(HIDDEN)/" do
|
239
|
-
SkypeAPI.getWindowState.should match /(NORMAL)|(MINIMIZED)|(MAXIMIZED)|(HIDDEN)/
|
240
|
-
end
|
241
|
-
|
242
|
-
it "set_window_status(string) should string" do
|
243
|
-
SkypeAPI.setWindowState('NORMAL').should == 'NORMAL'
|
244
|
-
end
|
245
|
-
|
246
|
-
it "should open_video_test" do
|
247
|
-
SkypeAPI.openVideoTest.should be_true
|
248
|
-
end
|
249
|
-
|
250
|
-
it "should open_video_mail" do
|
251
|
-
pending
|
252
|
-
#assert_equal SkypeAPI.openVoiceMail(1)
|
253
|
-
#IDが、、、後で調べる。
|
254
|
-
end
|
255
|
-
|
256
|
-
it "should open_add_friend(handle or user)" do
|
257
|
-
SkypeAPI.openAddAFriend('echo123').should be_true
|
258
|
-
SkypeAPI.openAddAFriend(SkypeAPI.user('echo123')).should be_true
|
259
|
-
end
|
260
|
-
|
261
|
-
it "should open_im(user, msg)" do
|
262
|
-
SkypeAPI.openIM('echo123','this is a test').should be_true
|
263
|
-
end
|
264
|
-
|
265
|
-
it "should open_chat(chat)" do
|
266
|
-
chat = SkypeAPI::Chat.create 'echo123'
|
267
|
-
SkypeAPI.openChat(chat).should be_true
|
268
|
-
end
|
269
|
-
|
270
|
-
it "should open_file_transfer(path,*user)" do
|
271
|
-
SkypeAPI.openFileTransfer(nil,SkypeAPI.user('kashi.9')).should be_true
|
272
|
-
end
|
273
|
-
|
274
|
-
it "should profile_live_tab" do
|
275
|
-
SkypeAPI.openLiveTab.should be_true
|
276
|
-
end
|
277
|
-
|
278
|
-
it "should open_profile" do
|
279
|
-
SkypeAPI.openProfile.should be_true
|
280
|
-
end
|
281
|
-
|
282
|
-
it "should open_user_info(user)" do
|
283
|
-
SkypeAPI.openUserInfo('echo123').should be_true
|
284
|
-
end
|
285
|
-
|
286
|
-
it "should open_conference" do
|
287
|
-
SkypeAPI.openConference.should be_true
|
288
|
-
end
|
289
|
-
|
290
|
-
it "should open_search" do
|
291
|
-
SkypeAPI.openSearch.should be_true
|
292
|
-
end
|
293
|
-
|
294
|
-
it "should open_options(nil|'general'|'privacy'|'notifications'|'soundalerts'|'sounddevices'|'hotkeys'|'connection'|'voicemail'|'callforward'|'video'|'advanced')" do
|
295
|
-
[nil,'general','privacy','notifications','soundalerts','sounddevices','hotkeys','connection','voicemail','callforward','video','advanced'].each do |page|
|
296
|
-
SkypeAPI.openOptions(page).should be_true
|
297
|
-
end
|
298
|
-
end
|
299
|
-
|
300
|
-
it "should open_call_history" do
|
301
|
-
SkypeAPI.openCallHistory.should be_true
|
302
|
-
end
|
303
|
-
|
304
|
-
it "should open_contancts" do
|
305
|
-
SkypeAPI.openContacts.should be_true
|
306
|
-
end
|
307
|
-
|
308
|
-
it "should open_dialpad" do
|
309
|
-
SkypeAPI.openDialPad.should be_true
|
310
|
-
end
|
311
|
-
|
312
|
-
it "should open_send_contancts" do
|
313
|
-
SkypeAPI.openSendContacts('hogehoge_001','hogehoge_002').should be_true
|
314
|
-
end
|
315
|
-
|
316
|
-
it "should open_blocked_users" do
|
317
|
-
SkypeAPI.openBlockedUsers.should be_true
|
318
|
-
end
|
319
|
-
|
320
|
-
it "should open_import_contancts" do
|
321
|
-
SkypeAPI.openImportContacts.should be_true
|
322
|
-
end
|
323
|
-
|
324
|
-
it "should open_getting_started" do
|
325
|
-
SkypeAPI.openGettingStarted.should be_true
|
326
|
-
end
|
327
|
-
|
328
|
-
it "should open_authorization" do
|
329
|
-
SkypeAPI.openAuthorization('hogehoge_1000'.should be_true)
|
330
|
-
end
|
331
|
-
|
332
|
-
it "should btn_pressed_released" do
|
333
|
-
9.times do |i|
|
334
|
-
SkypeAPI.BTNPressed(i).should be_true
|
335
|
-
sleep 0.5
|
336
|
-
SkypeAPI.BTNReleased(i).should be_true
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
it "get_contacts_focused should be instance of SkypeAPI::User" do
|
341
|
-
SkypeAPI.getContactsFocused.should be_instance_of SkypeAPI::User
|
342
|
-
end
|
343
|
-
|
344
|
-
it "get_ui_langualge should be instance of String and sieze 2" do
|
345
|
-
SkypeAPI.getUILanguage.should be_instance_of String
|
346
|
-
SkypeAPI.getUILanguage.size.should == 2
|
347
|
-
end
|
348
|
-
|
349
|
-
it "set_ui_langualge(string) should string" do
|
350
|
-
uil = SkypeAPI.getUILanguage
|
351
|
-
SkypeAPI.setUILanguage(uil).should == uil
|
352
|
-
end
|
353
|
-
|
354
|
-
it "get_wall_paper should be instance of String" do
|
355
|
-
SkypeAPI.getWallPaper.should be_instance_of String
|
356
|
-
end
|
357
|
-
|
358
|
-
it "set_wall_paper(string) should string" do
|
359
|
-
string = SkypeAPI.getWallPaper
|
360
|
-
SkypeAPI.setWallPaper(string).should == string
|
361
|
-
end
|
362
|
-
|
363
|
-
it "get_silent_mode should be boolean" do
|
364
|
-
SkypeAPI.getSilentMode.should be_boolean
|
365
|
-
end
|
366
|
-
|
367
|
-
it "set_silent_mode(flag) should flag" do
|
368
|
-
silent_mode = SkypeAPI.getSilentMode
|
369
|
-
SkypeAPI.setSilentMode(silent_mode).should == silent_mode
|
370
|
-
end
|
371
|
-
|
372
|
-
end
|
373
|
-
|
374
|
-
describe "search methods" do
|
375
|
-
|
376
|
-
it "search_frinends each should be instance of SkypeAPI::User" do
|
377
|
-
SkypeAPI.searchFriends.each do |user|
|
378
|
-
user.should be_instance_of SkypeAPI::User
|
379
|
-
end
|
380
|
-
end
|
381
|
-
|
382
|
-
it "search_users(String) each should be instance of SkypeAPI::User" do
|
383
|
-
SkypeAPI.searchUsers('echo123').each do |user|
|
384
|
-
user.should be_instance_of SkypeAPI::User
|
385
|
-
end
|
386
|
-
end
|
387
|
-
|
388
|
-
it "search_calls(String or User?) each should be instance of SkypeAPI::Call" do
|
389
|
-
SkypeAPI.searchCalls('echo123').each do |call|
|
390
|
-
call.should be_instance_of SkypeAPI::Call
|
391
|
-
end
|
392
|
-
end
|
393
|
-
|
394
|
-
it "search_active_calls each should be instance of SkypeAPI::Call" do
|
395
|
-
SkypeAPI.searchActiveCalls.each do |call|
|
396
|
-
call.should be_instance_of SkypeAPI::Call
|
397
|
-
end
|
398
|
-
end
|
399
|
-
|
400
|
-
it "search_missed_calls each should be instance of SkypeAPI::Call" do
|
401
|
-
SkypeAPI.searchMissedCalls.each do |call|
|
402
|
-
call.should be_instance_of SkypeAPI::Call
|
403
|
-
end
|
404
|
-
end
|
405
|
-
|
406
|
-
it "search_smss should each should be instance of SkypeAPI::SMS" do
|
407
|
-
SkypeAPI.searchSMSs.each do |sms|
|
408
|
-
sms.should be_instance_of SkypeAPI::SMS
|
409
|
-
end
|
410
|
-
end
|
411
|
-
|
412
|
-
it "search_missed_smss should each should be instance of SkypeAPI::Call" do
|
413
|
-
SkypeAPI.searchMissedSMSs.each do |call|
|
414
|
-
call.should be_instance_of SkypeAPI::Call
|
415
|
-
end
|
416
|
-
end
|
417
|
-
|
418
|
-
it "search_voice_mail should each should be instance of SkypeAPI::Call" do
|
419
|
-
SkypeAPI.searchVoiceMails.each do |call|
|
420
|
-
call.should be_instance_of SkypeAPI::Call
|
421
|
-
end
|
422
|
-
end
|
423
|
-
|
424
|
-
it "search_missed_voice_mail should each should be instance of SkypeAPI::VoiceMail" do
|
425
|
-
SkypeAPI.searchMissedVoiceMails.each do |vm|
|
426
|
-
vm.should be_instance_of SkypeAPI::VoiceMail
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
#OBS
|
431
|
-
#it "search_messages should" do
|
432
|
-
# SkypeAPI.searchMessages('skypeapitester').each do |msg|
|
433
|
-
# assert_instance_of(SkypeAPI::Message, msg)
|
434
|
-
# end
|
435
|
-
#end
|
436
|
-
|
437
|
-
it "search_missed_messages should each should be instance of SkypeAPI::Message" do
|
438
|
-
SkypeAPI.searchMissedMessages.each do |msg|
|
439
|
-
msg.should be_instance_of SkypeAPI::Message
|
440
|
-
end
|
441
|
-
end
|
442
|
-
|
443
|
-
it "search_chats should each should be instance of SkypeAPI::Chat" do
|
444
|
-
SkypeAPI.searchChats().each do |chat|
|
445
|
-
chat.should be_instance_of SkypeAPI::Chat
|
446
|
-
end
|
447
|
-
end
|
448
|
-
|
449
|
-
it "search_active_chats should each should be instance of SkypeAPI::Chat" do
|
450
|
-
SkypeAPI.searchActiveChats().each do |chat|
|
451
|
-
chat.should be_instance_of SkypeAPI::Chat
|
452
|
-
end
|
453
|
-
end
|
454
|
-
|
455
|
-
it "search_missed_chats should each should be instance of SkypeAPI::Chat" do
|
456
|
-
SkypeAPI.searchMissedChats.each do |chat|
|
457
|
-
chat.should be_instance_of SkypeAPI::Chat
|
458
|
-
end
|
459
|
-
end
|
460
|
-
|
461
|
-
it "search_recent_chats should each should be instance of SkypeAPI::Chat" do
|
462
|
-
SkypeAPI.searchRecentChats().each do |chat|
|
463
|
-
chat.should be_instance_of SkypeAPI::Chat
|
464
|
-
end
|
465
|
-
end
|
466
|
-
|
467
|
-
it "search_bookmarked_chats should each should be instance of SkypeAPI::Chat" do
|
468
|
-
SkypeAPI.searchBookMarkedChats().each do |chat|
|
469
|
-
chat.should be_instance_of SkypeAPI::Chat
|
470
|
-
end
|
471
|
-
end
|
472
|
-
|
473
|
-
it "search_chat_messages should each should be instance of SkypeAPI::ChatMessage" do
|
474
|
-
SkypeAPI.searchChatMessages('echo123').each do |chat_message|
|
475
|
-
chat_message.should be_instance_of SkypeAPI::ChatMessage
|
476
|
-
end
|
477
|
-
end
|
478
|
-
|
479
|
-
it "search_missed_chat_messages should each should be instance of SkypeAPI::ChatMessage" do
|
480
|
-
SkypeAPI.searchMissedChatMessages().each do |chat_message|
|
481
|
-
chat_message.should be_instance_of SkypeAPI::ChatMessage
|
482
|
-
end
|
483
|
-
end
|
484
|
-
|
485
|
-
it "search_users_waiting_my_authorization should each should be instance of SkypeAPI::User" do
|
486
|
-
SkypeAPI.searchUsersWaitingMyAuthorization.each do |user|
|
487
|
-
user.should be_instance_of SkypeAPI::User
|
488
|
-
end
|
489
|
-
end
|
490
|
-
|
491
|
-
it "search_groups should each should be instance of SkypeAPI::Group" do
|
492
|
-
SkypeAPI.searchGroups('ALL').each do |group|
|
493
|
-
group.should be_instance_of SkypeAPI::Group
|
494
|
-
end
|
495
|
-
end
|
496
|
-
|
497
|
-
it "search_file_transfers should each should be instance of SkypeAPI::FileTransfer" do
|
498
|
-
SkypeAPI.searchFileTransfers().each do |file_transfer|
|
499
|
-
file_transfer.should be_instance_of SkypeAPI::FileTransfer
|
500
|
-
end
|
501
|
-
end
|
502
|
-
|
503
|
-
it "search_active_file_transfers should each should be instance of SkypeAPI::FileTransfer" do
|
504
|
-
SkypeAPI.searchActiveFileTransfers().each do |file_transfer|
|
505
|
-
file_transfer.should be_instance_of SkypeAPI::FileTransfer
|
506
|
-
end
|
507
|
-
end
|
508
|
-
|
509
|
-
end
|
510
|
-
|
511
|
-
describe 'clear history methods' do
|
512
|
-
before do
|
513
|
-
pending "I do not want clear"
|
514
|
-
end
|
515
|
-
|
516
|
-
it "clear_chat_history should be_true" do
|
517
|
-
SkypeAPI.clearChatHistory.should be_true
|
518
|
-
end
|
519
|
-
|
520
|
-
it "clear_voice_mail_history should be true" do
|
521
|
-
SkypeAPI.clearVoiceMailHistory.should be_true
|
522
|
-
end
|
523
|
-
|
524
|
-
it "clear_call_history('ALL') should be true" do
|
525
|
-
SkypeAPI.clearCallHistory('ALL').should be_true
|
526
|
-
end
|
527
|
-
end
|
528
|
-
end
|