Ruby4Skype 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,26 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require 'skypeapi'
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
$LOAD_PATH << 'spec'
|
3
|
+
require 'skype'
|
5
4
|
require 'matcher_be_boolean'
|
6
5
|
|
7
|
-
describe
|
6
|
+
describe Skype::ChatMember do
|
8
7
|
before(:all) do
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
Skype.init 'hogehogehoge'
|
9
|
+
Skype.start_messageloop
|
10
|
+
Skype.attach_wait
|
12
11
|
end
|
13
12
|
before(:each) do
|
14
|
-
@chat =
|
15
|
-
@
|
13
|
+
@chat = Skype::Chat.create 'echo123'
|
14
|
+
@chat.send_message 'chat_member tests'
|
15
|
+
@chatmember = @chat.get_member_objects.first
|
16
16
|
end
|
17
17
|
|
18
18
|
it "get_chat should be instance of Chat" do
|
19
|
-
@chatmember.get_chat.should be_instance_of
|
19
|
+
@chatmember.get_chat.should be_instance_of Skype::Chat
|
20
20
|
end
|
21
21
|
|
22
22
|
it "get_user should be instance of User" do
|
23
|
-
@chatmember.get_user.should be_instance_of
|
23
|
+
@chatmember.get_user.should be_instance_of Skype::User
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'get_role should match /^(CREATOR)|(MASTER)|(HELPER)|(USER)|(LISTENER)|(APPLICANT)$/' do
|
@@ -36,7 +36,7 @@ describe SkypeAPI::ChatMember do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "set_role_to('MASTER') should raise error" do
|
39
|
-
lambda{@chatmember.set_role_to('MASTER')}.should raise_error
|
39
|
+
lambda{@chatmember.set_role_to('MASTER')}.should raise_error Skype::Error::API
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -1,19 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require 'skypeapi'
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
$LOAD_PATH << 'spec'
|
3
|
+
require 'skype'
|
5
4
|
require 'matcher_be_boolean'
|
6
5
|
|
7
|
-
describe
|
6
|
+
describe Skype::ChatMessage do
|
8
7
|
|
9
8
|
before :all do
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
Skype.init 'hogehogehoge'
|
10
|
+
Skype.start_messageloop
|
11
|
+
Skype.attach_wait
|
13
12
|
end
|
14
13
|
|
15
14
|
before(:each) do
|
16
|
-
@chat =
|
15
|
+
@chat = Skype::Chat.create('echo123', 'fk.8600gt')
|
17
16
|
@chatmessage = @chat.send_message 'chatmessage test'
|
18
17
|
end
|
19
18
|
|
@@ -26,7 +25,7 @@ describe SkypeAPI::ChatMessage do
|
|
26
25
|
end
|
27
26
|
|
28
27
|
it "get_from should be instance of User" do
|
29
|
-
@chatmessage.get_from.should be_instance_of
|
28
|
+
@chatmessage.get_from.should be_instance_of Skype::User
|
30
29
|
end
|
31
30
|
|
32
31
|
it "get_from_dispname should be instance of String" do
|
@@ -48,11 +47,11 @@ describe SkypeAPI::ChatMessage do
|
|
48
47
|
end
|
49
48
|
|
50
49
|
it 'get_chat should be instance of Chat' do
|
51
|
-
@chatmessage.get_chat.should be_instance_of
|
50
|
+
@chatmessage.get_chat.should be_instance_of Skype::Chat
|
52
51
|
end
|
53
52
|
|
54
53
|
it 'get_users each should be instance of User' do
|
55
|
-
@chatmessage.get_users.each{|user| user.should be_instance_of
|
54
|
+
@chatmessage.get_users.each{|user| user.should be_instance_of Skype::User}
|
56
55
|
end
|
57
56
|
|
58
57
|
it 'get_is_editable? should be boolean' do
|
@@ -62,7 +61,7 @@ describe SkypeAPI::ChatMessage do
|
|
62
61
|
it 'get_edited_by should be nil or instance of User' do
|
63
62
|
@chatmessage.get_edited_by.should be_nil
|
64
63
|
@chatmessage.set_body('testEdit')
|
65
|
-
@chatmessage.get_edited_by.should be_instance_of
|
64
|
+
@chatmessage.get_edited_by.should be_instance_of Skype::User
|
66
65
|
end
|
67
66
|
|
68
67
|
it 'get_edited_timestamp should be nil or instance of Time' do
|
@@ -0,0 +1,33 @@
|
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
$LOAD_PATH << 'spec'
|
3
|
+
require 'skype'
|
4
|
+
require 'timeout'
|
5
|
+
|
6
|
+
describe Skype::Event do
|
7
|
+
before :all do
|
8
|
+
Skype.init 'hogehogehoge'
|
9
|
+
Skype.start_messageloop
|
10
|
+
Skype.attach_wait
|
11
|
+
end
|
12
|
+
|
13
|
+
after :all do
|
14
|
+
Skype.close
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should event create" do
|
18
|
+
pending 'skype event obs?'
|
19
|
+
flag = false
|
20
|
+
event = Skype::Event.create('testEvent','testEvent','Testhint') do
|
21
|
+
flag = true
|
22
|
+
end
|
23
|
+
event.should be_instance_of Skype::Event
|
24
|
+
|
25
|
+
puts 'click testEvent'
|
26
|
+
|
27
|
+
timeout(60){sleep 1 until flag}
|
28
|
+
|
29
|
+
event.delete.should be_true
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
@@ -1,22 +1,21 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
$LOAD_PATH << 'spec'
|
3
|
+
require 'skype'
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
describe SkypeAPI::FileTransfer do
|
5
|
+
describe Skype::FileTransfer do
|
7
6
|
before :all do
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
Skype.init 'hogehogehoge'
|
8
|
+
Skype.start_messageloop
|
9
|
+
Skype.attach_wait
|
11
10
|
end
|
12
11
|
|
13
12
|
before(:each) do
|
14
|
-
@filetransfer =
|
13
|
+
@filetransfer = Skype.searchFileTransfers[0]
|
15
14
|
pending 'a file_trasfer is nothing.' unless @filetransfer
|
16
15
|
end
|
17
16
|
|
18
17
|
after :all do
|
19
|
-
|
18
|
+
Skype.close
|
20
19
|
end
|
21
20
|
|
22
21
|
it 'get_type should match /(INCOMING)|(OUTGOING)/' do
|
@@ -32,7 +31,7 @@ describe SkypeAPI::FileTransfer do
|
|
32
31
|
end
|
33
32
|
|
34
33
|
it 'get_partner should be instance of User' do
|
35
|
-
@filetransfer.get_partner.should be_instance_of
|
34
|
+
@filetransfer.get_partner.should be_instance_of Skype::User
|
36
35
|
end
|
37
36
|
|
38
37
|
it 'get_partner_dispname should be instance of String' do
|
@@ -1,30 +1,32 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
$LOAD_PATH << 'spec'
|
3
|
+
require 'skype'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe Skype::MenuItem do
|
4
6
|
before :all do
|
5
|
-
|
6
|
-
|
7
|
-
|
7
|
+
Skype.init 'hogehogehoge'
|
8
|
+
Skype.start_messageloop
|
9
|
+
Skype.attach_wait
|
8
10
|
end
|
9
11
|
|
10
12
|
after :all do
|
11
|
-
|
13
|
+
Skype.close
|
12
14
|
end
|
13
15
|
|
14
16
|
it "should,,," do
|
15
17
|
pending 'menu_item obs?'
|
16
18
|
flag = false
|
17
|
-
menuitem =
|
19
|
+
menuitem = Skype::MenuItem.create(:id => 'testMenu', :context => 'CONTACT', :caption => 'testMenu') do |instance, context, user, context_id|
|
18
20
|
menuitem.should == instance
|
19
21
|
context.should be_instance_of String
|
20
|
-
user.should be_instance_of
|
22
|
+
user.should be_instance_of Skype::User
|
21
23
|
context_id.should be_nil
|
22
24
|
flag = true
|
23
25
|
end
|
24
26
|
|
25
27
|
puts "click user context menu changeCap"
|
26
28
|
|
27
|
-
menuitem.should be_instance_of
|
29
|
+
menuitem.should be_instance_of Skype::MenuItem
|
28
30
|
menuitem.setCaption('changeCap').should be_true
|
29
31
|
menuitem.setHint('changeHint').should be_true
|
30
32
|
menuitem.setEnabled(false).should be_true
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'skype/os/linux.rb'
|
2
|
+
|
3
|
+
require 'skype.rb'
|
4
|
+
|
5
|
+
Thread.abort_on_exception = true
|
6
|
+
|
7
|
+
# describe Skype do
|
8
|
+
# it 'os should be instance of Linux' do
|
9
|
+
# Skype.init
|
10
|
+
# Skype.os.should be_instance_of Skype::OS::Linux
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
|
14
|
+
# describe Skype::OS::Linux do
|
15
|
+
|
16
|
+
# it "should attach and close" do
|
17
|
+
# @linux = Skype::OS::Linux.new
|
18
|
+
# @linux.start_messageloop
|
19
|
+
# @linux.attach_wait('hoge')
|
20
|
+
# @linux.invoke('GET SKYPEVERSION').should match /SKYPEVERSION \d+\.\d+.\d+/
|
21
|
+
# @linux.close
|
22
|
+
# end
|
23
|
+
|
24
|
+
describe 'attached' do
|
25
|
+
before :each do
|
26
|
+
@linux = Skype::OS::Linux.new
|
27
|
+
@linux.start_messageloop
|
28
|
+
@linux.attach_wait('hogehoge')
|
29
|
+
sleep 1
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
@linux.close
|
34
|
+
end
|
35
|
+
|
36
|
+
def send_chat msg
|
37
|
+
@linux.invoke('CHAT CREATE echo123') =~ /CHAT (.+?) /
|
38
|
+
chat_id = $1
|
39
|
+
@linux.invoke("CHATMESSAGE #{chat_id} #{msg}")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should send chat" do
|
43
|
+
i = 0
|
44
|
+
@linux.set_notify_selector do |res|
|
45
|
+
p res
|
46
|
+
if res =~ /CHATMESSAGE RECEIVED/
|
47
|
+
#send_chat 'linux test'
|
48
|
+
i+=1
|
49
|
+
end
|
50
|
+
end
|
51
|
+
send_chat 'linux test'
|
52
|
+
sleep 0.1 while i < 0
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
#end
|
59
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'skypeapi/os/linux.rb'
|
2
|
+
|
3
|
+
require 'skypeapi.rb'
|
4
|
+
|
5
|
+
Thread.abort_on_exception = true
|
6
|
+
|
7
|
+
# describe SkypeAPI do
|
8
|
+
# it 'os should be instance of Linux' do
|
9
|
+
# SkypeAPI.init
|
10
|
+
# SkypeAPI.os.should be_instance_of SkypeAPI::OS::Linux
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
|
14
|
+
# describe SkypeAPI::OS::Linux do
|
15
|
+
|
16
|
+
# it "should attach and close" do
|
17
|
+
# @linux = SkypeAPI::OS::Linux.new
|
18
|
+
# @linux.start_messageloop
|
19
|
+
# @linux.attach_wait('hoge')
|
20
|
+
# @linux.invoke('GET SKYPEVERSION').should match /SKYPEVERSION \d+\.\d+.\d+/
|
21
|
+
# @linux.close
|
22
|
+
# end
|
23
|
+
|
24
|
+
describe 'attached' do
|
25
|
+
before :each do
|
26
|
+
@linux = SkypeAPI::OS::Linux.new
|
27
|
+
@linux.start_messageloop
|
28
|
+
@linux.attach_wait('hoge')
|
29
|
+
end
|
30
|
+
|
31
|
+
after do
|
32
|
+
@linux.close
|
33
|
+
end
|
34
|
+
|
35
|
+
def send_chat msg
|
36
|
+
@linux.invoke('CHAT CREATE echo123') =~ /CHAT (.+?) /
|
37
|
+
chat_id = $1
|
38
|
+
@linux.invoke("CHATMESSAGE #{chat_id} #{msg}")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should send chat" do
|
42
|
+
i = 0
|
43
|
+
@linux.set_notify_selector do |res|
|
44
|
+
p res
|
45
|
+
if res =~ /CHATMESSAGE RECEIVED/
|
46
|
+
send_chat 'linux test'
|
47
|
+
i+=1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
send_chat 'linux test'
|
51
|
+
sleep 1 while i < 10
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
#end
|
58
|
+
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# To change this template, choose Tools | Templates
|
2
2
|
# and open the template in the editor.
|
3
3
|
|
4
|
-
require '
|
5
|
-
require '
|
4
|
+
require 'skype/os/etc'
|
5
|
+
require 'skype/os/windows'
|
6
6
|
|
7
7
|
Thread.abort_on_exception = true
|
8
8
|
|
9
|
-
describe
|
9
|
+
describe Skype::OS::Windows do
|
10
10
|
describe 'before attach' do
|
11
11
|
describe 'attach' do
|
12
12
|
before(:each) do
|
13
13
|
@message = Array.new
|
14
|
-
@win =
|
14
|
+
@win = Skype::OS::Windows.new
|
15
15
|
@win.set_notify_selector{ |msg| @message.push msg }
|
16
16
|
@win.start_messageloop
|
17
17
|
end
|
@@ -31,13 +31,13 @@ describe SkypeAPI::OS::Windows do
|
|
31
31
|
it "should many attach and close" do
|
32
32
|
@win.close
|
33
33
|
10.times do |i|
|
34
|
-
@win =
|
34
|
+
@win = Skype::OS::Windows.new
|
35
35
|
@win.set_notify_selector{ |msg| @message.push msg }
|
36
36
|
@win.start_messageloop
|
37
37
|
@win.attach_wait
|
38
38
|
@win.close
|
39
39
|
end
|
40
|
-
@win =
|
40
|
+
@win = Skype::OS::Windows.new
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should call attached event" do
|
@@ -52,7 +52,7 @@ describe SkypeAPI::OS::Windows do
|
|
52
52
|
|
53
53
|
describe "windows event queue process on main thread" do
|
54
54
|
before(:each) do
|
55
|
-
@win =
|
55
|
+
@win = Skype::OS::Windows.new
|
56
56
|
end
|
57
57
|
|
58
58
|
after(:each) do
|
@@ -92,7 +92,7 @@ describe SkypeAPI::OS::Windows do
|
|
92
92
|
|
93
93
|
|
94
94
|
before :each do
|
95
|
-
@win =
|
95
|
+
@win = Skype::OS::Windows.new
|
96
96
|
@win.start_messageloop
|
97
97
|
@win.attach_wait
|
98
98
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
$LOAD_PATH << 'spec'
|
3
|
+
require 'skype'
|
4
|
+
|
5
|
+
describe Skype::Profile do
|
6
|
+
before :all do
|
7
|
+
Skype.init'hogehogehoge'
|
8
|
+
Skype.start_messageloop
|
9
|
+
Skype.attach_wait
|
10
|
+
end
|
11
|
+
|
12
|
+
after :all do
|
13
|
+
Skype.close
|
14
|
+
end
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
@profile = Profile.new
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should desc" do
|
21
|
+
# TODO
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
$LOAD_PATH << 'spec'
|
3
|
+
|
4
|
+
require 'skype'
|
5
|
+
|
6
|
+
describe Skype::User do
|
7
|
+
before :all do
|
8
|
+
Skype.init 'hogehogehoge'
|
9
|
+
Skype.start_messageloop
|
10
|
+
Skype.attach_wait
|
11
|
+
end
|
12
|
+
|
13
|
+
after :all do
|
14
|
+
Skype.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
|
+
|