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
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'swin'
|
2
2
|
require 'Win32API'
|
3
3
|
require 'timeout'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
4
|
+
require 'skype/os/etc'
|
5
|
+
require 'skype/os/window_event_queue'
|
6
|
+
require 'skype/os/window_messagehandler'
|
7
7
|
|
8
|
-
module
|
8
|
+
module Skype
|
9
9
|
module OS
|
10
10
|
WAIT_CMD_LIMIT = 30.0 #sec
|
11
11
|
PING_CYCLE = 10.0 #sec
|
@@ -29,7 +29,7 @@ module SkypeAPI
|
|
29
29
|
|
30
30
|
class Windows < Abstruct
|
31
31
|
|
32
|
-
def initialize
|
32
|
+
def initialize appname=nil
|
33
33
|
@send_count = 0
|
34
34
|
@queue = WindowsEventQueue.new(self)
|
35
35
|
|
@@ -43,7 +43,7 @@ module SkypeAPI
|
|
43
43
|
@detached_mutex = Mutex.new
|
44
44
|
|
45
45
|
add_hook :available do
|
46
|
-
|
46
|
+
Skype.attach
|
47
47
|
end
|
48
48
|
|
49
49
|
@wmHandler = SWin::LWFactory.new(SWin::Application.hInstance).newwindow nil, MessageHandler
|
@@ -57,7 +57,7 @@ module SkypeAPI
|
|
57
57
|
attr_reader :invoke_callback_mutex, :cv, :wmHandler
|
58
58
|
attr_accessor :attached, :first_attached#,:received,:sent
|
59
59
|
|
60
|
-
#引数にmethodかブロックを渡しておくと
|
60
|
+
#引数にmethodかブロックを渡しておくとSkypeのNotification(コマンドのレスポンは除く)があった場合呼ばれる。
|
61
61
|
#ブロックはNotificationの文字列を一つ与えられて呼ばれる。
|
62
62
|
def set_notify_selector block=Proc.new
|
63
63
|
@queue.set_notify_selector block
|
@@ -87,7 +87,7 @@ module SkypeAPI
|
|
87
87
|
alias exist_event? exist_hook?
|
88
88
|
alias get_event get_hook
|
89
89
|
|
90
|
-
#
|
90
|
+
#SkypeにAttachする。ブロックはしないのでつながるまで待つならばadd_hookでイベントを追加するか,attach_waitを使う。
|
91
91
|
def attach name = nil #,&block)
|
92
92
|
@wmHandler.attach
|
93
93
|
end
|
@@ -106,7 +106,7 @@ module SkypeAPI
|
|
106
106
|
end
|
107
107
|
private :detached?
|
108
108
|
|
109
|
-
#
|
109
|
+
#Skypeにコマンドを発行する。Skypeから返り値が戻ってくるまでブロックする。
|
110
110
|
def invoke cmd
|
111
111
|
super cmd
|
112
112
|
end
|
@@ -138,7 +138,7 @@ module SkypeAPI
|
|
138
138
|
rescue Timeout::Error
|
139
139
|
if detached?
|
140
140
|
if @raise_when_detached
|
141
|
-
raise
|
141
|
+
raise Skype::Error::Timeout.new("timeout #{send_count} #{cmd}")
|
142
142
|
else
|
143
143
|
status2detache
|
144
144
|
retry_flag = true
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Skype
|
2
2
|
class Profile < AbstractObject
|
3
3
|
OBJECT_NAME = "PROFILE"
|
4
4
|
|
@@ -114,8 +114,8 @@ module SkypeAPI
|
|
114
114
|
cfs = str.split ' '
|
115
115
|
cfs = cfs.map{ |cf|
|
116
116
|
cf = cf.split ','
|
117
|
-
cf[2] =
|
118
|
-
[cf[0].to_i, cf[1].to_i, (cf[2] =~ /^\+/ ? cf[2] :
|
117
|
+
cf[2] = Skype::User.new(cf[2]) unless cf[2] =~ /^\+/
|
118
|
+
[cf[0].to_i, cf[1].to_i, (cf[2] =~ /^\+/ ? cf[2] : Skype::User.new(cf[2]))]
|
119
119
|
}
|
120
120
|
}
|
121
121
|
alias getCallForwardRules get_call_forward_rules
|
@@ -57,7 +57,7 @@ class FalseClass #:nodoc: all-
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
module
|
60
|
+
module Skype
|
61
61
|
|
62
62
|
module ShareFunctions #:nodoc: all
|
63
63
|
#private
|
@@ -67,7 +67,7 @@ module SkypeAPI
|
|
67
67
|
def invoke_echo cmd
|
68
68
|
begin
|
69
69
|
invoke(cmd) == cmd
|
70
|
-
rescue
|
70
|
+
rescue Skype::APIError => e
|
71
71
|
e.backtrace.shift
|
72
72
|
e.backtrace.shift
|
73
73
|
raise e
|
@@ -82,7 +82,7 @@ module SkypeAPI
|
|
82
82
|
end
|
83
83
|
begin
|
84
84
|
invoke(cmd) =~ /^#{regExp} (.*)$/m
|
85
|
-
rescue
|
85
|
+
rescue Skype::APIError => e
|
86
86
|
e.backtrace.shift
|
87
87
|
e.backtrace.shift
|
88
88
|
raise e
|
@@ -99,7 +99,7 @@ module SkypeAPI
|
|
99
99
|
end
|
100
100
|
begin
|
101
101
|
invoke(cmd) =~ /^#{reg} (.*)$/m
|
102
|
-
rescue
|
102
|
+
rescue Skype::APIError => e
|
103
103
|
e.backtrace.shift
|
104
104
|
e.backtrace.shift
|
105
105
|
raise e
|
@@ -112,7 +112,7 @@ module SkypeAPI
|
|
112
112
|
reg = "#{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{@id ? @id.to_s + ' ' : ''}#{prop}"
|
113
113
|
begin
|
114
114
|
str = invoke_one cmd, reg
|
115
|
-
rescue
|
115
|
+
rescue Skype::APIError => e
|
116
116
|
e.backtrace.shift
|
117
117
|
e.backtrace.shift
|
118
118
|
raise e
|
@@ -134,7 +134,7 @@ module SkypeAPI
|
|
134
134
|
#res = "ALTER #{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{prop}"
|
135
135
|
begin
|
136
136
|
invoke(cmd)# == res
|
137
|
-
rescue
|
137
|
+
rescue Skype::APIError => e
|
138
138
|
e.backtrace.shift
|
139
139
|
e.backtrace.shift
|
140
140
|
raise e
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module
|
1
|
+
module Skype
|
2
2
|
class SMS< AbstractObject
|
3
3
|
OBJECT_NAME = "SMS"
|
4
4
|
class << self
|
5
5
|
def create target, type="OUTGOING"
|
6
|
-
res =
|
6
|
+
res = Skype.invoke "CREATE SMS #{type} #{target}"
|
7
7
|
res =~ /^SMS (\d+) STATUS (.+)$/
|
8
8
|
id, status = $1, $2
|
9
9
|
return id, status
|
@@ -15,7 +15,7 @@ module SkypeAPI
|
|
15
15
|
alias create_confirmation_code_request createConfirmationCodeRequest
|
16
16
|
|
17
17
|
def delete id
|
18
|
-
|
18
|
+
Skype.invoke_echo "DELETE SMS #{id}"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module
|
1
|
+
module Skype
|
2
2
|
class VoiceMail < AbstractObject
|
3
3
|
OBJECT_NAME = "VOICEMAIL"
|
4
4
|
|
5
5
|
def self.create target
|
6
|
-
|
6
|
+
Skype.invoke "CALLVOICEMAIL #{target}"
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.open id
|
10
|
-
|
10
|
+
Skype.invoke "OPEN VOICEMAIL #{id}"
|
11
11
|
end
|
12
12
|
|
13
13
|
def get_type() invoke_get("TYPE") end
|
@@ -15,7 +15,7 @@ module SkypeAPI
|
|
15
15
|
alias getType get_type
|
16
16
|
|
17
17
|
def get_partner() parse :partner, invoke_get("PARTNER_HANDLE") end
|
18
|
-
def_parser(:partner,"PARTNER_HANDLE"){|str|
|
18
|
+
def_parser(:partner,"PARTNER_HANDLE"){|str| Skype::User.new str}
|
19
19
|
alias getPartner get_partner
|
20
20
|
|
21
21
|
def get_partner_dispname() invoke_get("PARTNER_DISPNAME") end
|
@@ -1,21 +1,19 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
require 'skype'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
describe SkypeAPI::Application do
|
4
|
+
describe Skype::Application do
|
7
5
|
before(:all) do
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
Skype.init 'hogehogehoge'
|
7
|
+
Skype.start_messageloop
|
8
|
+
Skype.attach_wait
|
11
9
|
end
|
12
10
|
|
13
11
|
after :all do
|
14
|
-
|
12
|
+
Skype.close
|
15
13
|
end
|
16
14
|
|
17
15
|
before :each do
|
18
|
-
@app =
|
16
|
+
@app = Skype::Application.new('testApp')
|
19
17
|
@app.create
|
20
18
|
end
|
21
19
|
|
@@ -25,23 +23,23 @@ describe SkypeAPI::Application do
|
|
25
23
|
|
26
24
|
it 'get_connectable each should be instance of User' do
|
27
25
|
pending 'connectable empty' if @app.get_connectable.empty?
|
28
|
-
@app.get_connectable.each{|user| user.should be_instance_of
|
26
|
+
@app.get_connectable.each{|user| user.should be_instance_of Skype::User}
|
29
27
|
end
|
30
28
|
|
31
29
|
it 'get_connecting each should be instance of User' do
|
32
30
|
pending 'connection empty' if @app.get_connecting.empty?
|
33
|
-
@app.get_connecting.each{|user| user.should be_instance_of
|
31
|
+
@app.get_connecting.each{|user| user.should be_instance_of Skype::User}
|
34
32
|
end
|
35
33
|
|
36
34
|
it 'get_streams each should be instance of Stream' do
|
37
35
|
pending 'streams empty' if @app.get_streams.empty?
|
38
|
-
@app.get_streams.each{|stream| stream.should be_instance_of
|
36
|
+
@app.get_streams.each{|stream| stream.should be_instance_of Skype::Stream}
|
39
37
|
end
|
40
38
|
|
41
39
|
it 'get_sending each should {:stream,:bytes}' do
|
42
40
|
pending 'sending empty' if @app.get_sending.empty?
|
43
41
|
@app.get_sending.each{|hash|
|
44
|
-
hash[:stream].should be_instance_of
|
42
|
+
hash[:stream].should be_instance_of Skype::Stream
|
45
43
|
hash[:bytes].should be_kind_of Integer
|
46
44
|
}
|
47
45
|
end
|
@@ -49,7 +47,7 @@ describe SkypeAPI::Application do
|
|
49
47
|
it 'get_received each should {:stream,:bytes}' do
|
50
48
|
pending 'received empty' if @app.get_received.empty?
|
51
49
|
@app.get_received.each{|hash|
|
52
|
-
hash[:stream].should be_instance_of
|
50
|
+
hash[:stream].should be_instance_of Skype::Stream
|
53
51
|
hash[:bytes].should be_kind_of Integer
|
54
52
|
}
|
55
53
|
end
|
@@ -1,33 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require 'skypeapi'
|
1
|
+
$LOAD_PATH << 'lib'
|
2
|
+
require 'skype'
|
5
3
|
|
6
4
|
Thread.abort_on_exception = true
|
7
5
|
|
8
|
-
describe
|
6
|
+
describe Skype::Chat do
|
9
7
|
before :all do
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
Skype.init 'hogehogehoge'
|
9
|
+
Skype.start_messageloop
|
10
|
+
Skype.attach_wait
|
13
11
|
end
|
14
12
|
|
15
13
|
after(:all) do
|
16
|
-
|
14
|
+
Skype.close
|
17
15
|
end
|
18
16
|
|
19
17
|
describe 'notify' do
|
20
18
|
before do
|
21
19
|
@f = false
|
22
|
-
|
20
|
+
Skype::ChatMessage.set_notify :status, 'RECEIVED' do |c|
|
23
21
|
@f = true
|
24
22
|
end
|
25
|
-
|
23
|
+
Skype::Chat.create('echo123').send_message('hoge')
|
26
24
|
end
|
27
25
|
|
28
26
|
it "should" do
|
29
27
|
begin
|
30
|
-
timeout(10){sleep 1
|
28
|
+
timeout(10){sleep 1 until @f}
|
31
29
|
rescue Timeout::Error
|
32
30
|
violated
|
33
31
|
end
|
@@ -36,7 +34,7 @@ describe SkypeAPI::Chat do
|
|
36
34
|
|
37
35
|
describe '1on1' do
|
38
36
|
before(:each) do
|
39
|
-
@chat =
|
37
|
+
@chat = Skype::Chat.create 'echo123'#, 'hogehoge_002'
|
40
38
|
end
|
41
39
|
|
42
40
|
after(:each) do
|
@@ -44,22 +42,22 @@ describe SkypeAPI::Chat do
|
|
44
42
|
end
|
45
43
|
|
46
44
|
|
47
|
-
it "
|
48
|
-
|
45
|
+
it "Skype::Chat.create(string) should be instance of Chat" do
|
46
|
+
Skype::Chat.create('echo123').should be_instance_of Skype::Chat
|
49
47
|
end
|
50
48
|
|
51
|
-
it "
|
52
|
-
|
49
|
+
it "Skype::Chat.create(Skype::User) should be instance of Chat" do
|
50
|
+
Skype::Chat.create(Skype.user('echo123')).should be_instance_of Skype::Chat
|
53
51
|
end
|
54
52
|
|
55
|
-
it "
|
56
|
-
lambda{
|
53
|
+
it "Skype::Chat.findUsingBlob(@chat.get_blob) should raise error Skype::Error::API" do
|
54
|
+
lambda{Skype::Chat.findUsingBlob(@chat.get_blob)}.should raise_error Skype::Error::API
|
57
55
|
#ERROR 610 CHAT: FINDUSINGBLOB: No existing chat for given blob found or invalid blob
|
58
56
|
#get_bolb = > ''
|
59
57
|
end
|
60
58
|
|
61
|
-
it "
|
62
|
-
lambda{
|
59
|
+
it "Skype::Chat.createUsingBlob(@chat.get_blob) should raise error Skype::Error::API" do
|
60
|
+
lambda{Skype::Chat.createUsingBlob(@chat.get_blob)}.should raise_error Skype::Error::API
|
63
61
|
#ERROR 611 CHAT: CREATEUSINGBLOB: Unable to create chat, invalid blob
|
64
62
|
#get_bolb = > ''
|
65
63
|
end
|
@@ -90,14 +88,14 @@ describe SkypeAPI::Chat do
|
|
90
88
|
@chat.sendMessage 'hoge'
|
91
89
|
pending 'no posters' if @chat.get_posters.empty?
|
92
90
|
@chat.get_posters.each do |user|
|
93
|
-
user.should be_instance_of
|
91
|
+
user.should be_instance_of Skype::User
|
94
92
|
end
|
95
93
|
end
|
96
94
|
|
97
95
|
it "get_members each should be instance of ChatMember" do
|
98
96
|
pending 'no member'# if @chat.get_members.empty?
|
99
97
|
@chat.getMembers.each do |chat_member|
|
100
|
-
chat_member.should be_instance_of
|
98
|
+
chat_member.should be_instance_of Skype::ChatMember
|
101
99
|
end
|
102
100
|
end
|
103
101
|
|
@@ -106,8 +104,8 @@ describe SkypeAPI::Chat do
|
|
106
104
|
@chat.getTopic.should be_empty
|
107
105
|
end
|
108
106
|
|
109
|
-
it "set_topic(string) should raise_error
|
110
|
-
lambda{@chat.setTopic('TEST')}.should raise_error
|
107
|
+
it "set_topic(string) should raise_error Skype::Error::API" do
|
108
|
+
lambda{@chat.setTopic('TEST')}.should raise_error Skype::Error::API
|
111
109
|
end
|
112
110
|
|
113
111
|
it "get_topic_xml should be instance of String and empty" do
|
@@ -115,21 +113,21 @@ describe SkypeAPI::Chat do
|
|
115
113
|
@chat.getTopicXML.should be_empty
|
116
114
|
end
|
117
115
|
|
118
|
-
it "set_topic_xml(string) should raise error
|
119
|
-
lambda{@chat.setTopicXML('<BLINK>topic is blinking</BLINK>')}.should raise_error
|
116
|
+
it "set_topic_xml(string) should raise error Skype::Error::API" do
|
117
|
+
lambda{@chat.setTopicXML('<BLINK>topic is blinking</BLINK>')}.should raise_error Skype::Error::API
|
120
118
|
end
|
121
119
|
|
122
120
|
it "get_chat_messages each should be instance of ChatMessage" do
|
123
121
|
@chat.send_message 'hoge'
|
124
122
|
@chat.getChatMessages.each do |chat_message|
|
125
|
-
chat_message.should be_instance_of
|
123
|
+
chat_message.should be_instance_of Skype::ChatMessage
|
126
124
|
end
|
127
125
|
end
|
128
126
|
|
129
127
|
it "get_active_members each should be instance of ChatMember" do
|
130
128
|
pending 'user or member'
|
131
129
|
@chat.getActiveMembers.each do |member|
|
132
|
-
member.should be_instance_of
|
130
|
+
member.should be_instance_of Skype::ChatMember
|
133
131
|
end
|
134
132
|
end
|
135
133
|
|
@@ -140,7 +138,7 @@ describe SkypeAPI::Chat do
|
|
140
138
|
it "get_recent_chat_messages each should be instance of Chat" do
|
141
139
|
@chat.send_message 'hoge'
|
142
140
|
@chat.getRecentChatMessages.each do |chat_message|
|
143
|
-
chat_message.should be_instance_of
|
141
|
+
chat_message.should be_instance_of Skype::ChatMessage
|
144
142
|
end
|
145
143
|
end
|
146
144
|
|
@@ -153,7 +151,7 @@ describe SkypeAPI::Chat do
|
|
153
151
|
|
154
152
|
it "get_member_objects each should be instance of ChatMember" do
|
155
153
|
@chat.getMemberObjects.each do |chat_member|
|
156
|
-
chat_member.should be_instance_of
|
154
|
+
chat_member.should be_instance_of Skype::ChatMember
|
157
155
|
end
|
158
156
|
end
|
159
157
|
|
@@ -162,16 +160,16 @@ describe SkypeAPI::Chat do
|
|
162
160
|
@chat.getPasswordHint.should be_empty
|
163
161
|
end
|
164
162
|
|
165
|
-
it "set_guid_lines(string) should be raise error
|
166
|
-
lambda{@chat.setGuideLines('TEST')}.should raise_error
|
163
|
+
it "set_guid_lines(string) should be raise error Skype::Error::API" do
|
164
|
+
lambda{@chat.setGuideLines('TEST')}.should raise_error Skype::Error::API
|
167
165
|
end
|
168
166
|
|
169
167
|
it "get_options should be_kind_of" do
|
170
168
|
@chat.getOptions.should be_kind_of Integer
|
171
169
|
end
|
172
170
|
|
173
|
-
it "set_options(integer) should raise error
|
174
|
-
lambda{@chat.setOptions(1)}.should raise_error
|
171
|
+
it "set_options(integer) should raise error Skype::Error::API" do
|
172
|
+
lambda{@chat.setOptions(1)}.should raise_error Skype::Error::API
|
175
173
|
end
|
176
174
|
|
177
175
|
it "get_description should be instance of String" do
|
@@ -180,7 +178,7 @@ describe SkypeAPI::Chat do
|
|
180
178
|
|
181
179
|
it "get_dialog_partner should be instance of User or nil" do
|
182
180
|
pending 'nil' if @chat.getDialogPartner.nil?
|
183
|
-
@chat.getDialogPartner.should be_instance_of
|
181
|
+
@chat.getDialogPartner.should be_instance_of Skype::User
|
184
182
|
end
|
185
183
|
|
186
184
|
it "get_activity_timestamp should be instance of Time" do
|
@@ -208,16 +206,16 @@ describe SkypeAPI::Chat do
|
|
208
206
|
it "get_applicants each should be instance of User" do
|
209
207
|
pending 'no,,,' if @chat.getApplicants.empty?
|
210
208
|
@chat.getApplicants.each do |user|
|
211
|
-
user.should be_instance_of
|
209
|
+
user.should be_instance_of Skype::User
|
212
210
|
end
|
213
211
|
end
|
214
212
|
|
215
|
-
it "leave should raise
|
216
|
-
lambda{@chat.leave}.should raise_error
|
213
|
+
it "leave should raise Skype::Error::API" do
|
214
|
+
lambda{@chat.leave}.should raise_error Skype::Error::API
|
217
215
|
end
|
218
216
|
|
219
|
-
it "join should raise error
|
220
|
-
lambda{@chat.join}.should raise_error
|
217
|
+
it "join should raise error Skype::Error::API" do
|
218
|
+
lambda{@chat.join}.should raise_error Skype::Error::API
|
221
219
|
end
|
222
220
|
|
223
221
|
it "clearRecentMessages should be true" do
|
@@ -228,61 +226,61 @@ describe SkypeAPI::Chat do
|
|
228
226
|
@chat.setAlertString('hoge').should be_true
|
229
227
|
end
|
230
228
|
|
231
|
-
it "acceptadd should should raise error
|
232
|
-
lambda{@chat.acceptadd}.should raise_error
|
229
|
+
it "acceptadd should should raise error Skype::Error::API" do
|
230
|
+
lambda{@chat.acceptadd}.should raise_error Skype::Error::API
|
233
231
|
end
|
234
232
|
|
235
|
-
it "disband should should raise error
|
236
|
-
lambda{@chat.disband}.should raise_error
|
233
|
+
it "disband should should raise error Skype::Error::API" do
|
234
|
+
lambda{@chat.disband}.should raise_error Skype::Error::API
|
237
235
|
end
|
238
236
|
|
239
|
-
it "set_password(string) should raise enrror
|
240
|
-
lambda{@chat.setPassword('hogehoge')}.should raise_error
|
237
|
+
it "set_password(string) should raise enrror Skype::Error::API" do
|
238
|
+
lambda{@chat.setPassword('hogehoge')}.should raise_error Skype::Error::API
|
241
239
|
end
|
242
240
|
|
243
|
-
it "enter_password(string) should raise error
|
244
|
-
lambda{@chat.enterPassword('hogehoge')}.should raise_error
|
241
|
+
it "enter_password(string) should raise error Skype::Error::API" do
|
242
|
+
lambda{@chat.enterPassword('hogehoge')}.should raise_error Skype::Error::API
|
245
243
|
end
|
246
244
|
|
247
|
-
it "kick(string) should raise error
|
248
|
-
lambda{@chat.kick('echo123')}.should raise_error
|
245
|
+
it "kick(string) should raise error Skype::Error::API" do
|
246
|
+
lambda{@chat.kick('echo123')}.should raise_error Skype::Error::API
|
249
247
|
end
|
250
248
|
|
251
|
-
it "kick(user) should raise error
|
252
|
-
lambda{@chat.kick(
|
249
|
+
it "kick(user) should raise error Skype::Error::API" do
|
250
|
+
lambda{@chat.kick(Skype.user('echo123'))}.should raise_error Skype::Error::API
|
253
251
|
end
|
254
252
|
|
255
|
-
it "kick_ban(string) should raise error
|
256
|
-
lambda{@chat.kickban('echo123')}.should raise_error
|
253
|
+
it "kick_ban(string) should raise error Skype::Error::API" do
|
254
|
+
lambda{@chat.kickban('echo123')}.should raise_error Skype::Error::API
|
257
255
|
end
|
258
256
|
|
259
|
-
it "kick_ban(user) should raise error
|
260
|
-
lambda{@chat.kickban(
|
257
|
+
it "kick_ban(user) should raise error Skype::Error::API" do
|
258
|
+
lambda{@chat.kickban(Skype.user('echo123'))}.should raise_error Skype::Error::API
|
261
259
|
end
|
262
260
|
|
263
261
|
it "send_message should be instance of" do
|
264
|
-
@chat.sendMessage('test').should be_instance_of
|
262
|
+
@chat.sendMessage('test').should be_instance_of Skype::ChatMessage
|
265
263
|
end
|
266
264
|
end
|
267
265
|
|
268
266
|
describe 'in 3 people' do
|
269
267
|
before :each do
|
270
268
|
#pending 'hoge'
|
271
|
-
@chat =
|
269
|
+
@chat = Skype::Chat.create 'echo123','hogehoge_001'
|
272
270
|
end
|
273
271
|
|
274
272
|
after :each do
|
275
273
|
@chat.leave if @chat
|
276
274
|
end
|
277
275
|
|
278
|
-
it "
|
279
|
-
|
276
|
+
it "Skype::Chat.findUsingBlob(@chat.get_blob) should raise error Skype::Error::API" do
|
277
|
+
Skype::Chat.findUsingBlob(@chat.get_blob).should == @chat
|
280
278
|
#ERROR 610 CHAT: FINDUSINGBLOB: No existing chat for given blob found or invalid blob
|
281
279
|
#get_bolb = > ''
|
282
280
|
end
|
283
281
|
|
284
|
-
it "
|
285
|
-
|
282
|
+
it "Skype::Chat.createUsingBlob(@chat.get_blob) should raise error Skype::Error::API" do
|
283
|
+
Skype::Chat.createUsingBlob(@chat.get_blob).should == @chat
|
286
284
|
#ERROR 611 CHAT: CREATEUSINGBLOB: Unable to create chat, invalid blob
|
287
285
|
#get_bolb = > ''
|
288
286
|
end
|
@@ -293,46 +291,46 @@ describe SkypeAPI::Chat do
|
|
293
291
|
blob.should_not be_empty
|
294
292
|
end
|
295
293
|
|
296
|
-
it "set_topic(string) should raise_error
|
294
|
+
it "set_topic(string) should raise_error Skype::Error::API" do
|
297
295
|
@chat.setTopic('TEST').should be_true
|
298
296
|
end
|
299
297
|
|
300
|
-
it "set_topic_xml(string) should raise error
|
298
|
+
it "set_topic_xml(string) should raise error Skype::Error::API" do
|
301
299
|
@chat.setTopicXML('<BLINK>topic is blinking</BLINK>').should be_true
|
302
300
|
end
|
303
301
|
|
304
302
|
it "set_options(integer) should be true" do
|
305
|
-
lambda{@chat.setOptions(1)}.should raise_error
|
303
|
+
lambda{@chat.setOptions(1)}.should raise_error Skype::Error::API
|
306
304
|
end
|
307
305
|
|
308
|
-
it "set_guid_lines(string) should be raise error
|
309
|
-
lambda{@chat.setGuideLines('TEST')}.should raise_error
|
306
|
+
it "set_guid_lines(string) should be raise error Skype::Error::API" do
|
307
|
+
lambda{@chat.setGuideLines('TEST')}.should raise_error Skype::Error::API
|
310
308
|
end
|
311
309
|
|
312
|
-
it "leave should raise
|
310
|
+
it "leave should raise Skype::Error::API" do
|
313
311
|
@chat.leave.should be_true
|
314
312
|
@chat = nil
|
315
313
|
end
|
316
314
|
|
317
|
-
it "join should raise error
|
315
|
+
it "join should raise error Skype::Error::API" do
|
318
316
|
@chat.join.should be_true
|
319
317
|
end
|
320
318
|
|
321
|
-
it "acceptadd should should raise error
|
319
|
+
it "acceptadd should should raise error Skype::Error::API" do
|
322
320
|
@chat.acceptadd.should be_true
|
323
321
|
#
|
324
322
|
end
|
325
323
|
|
326
324
|
it "disband should should be true" do
|
327
|
-
lambda{@chat.disband}.should raise_error
|
325
|
+
lambda{@chat.disband}.should raise_error Skype::Error::API
|
328
326
|
end
|
329
327
|
|
330
|
-
it "set_password(string) should raise error
|
328
|
+
it "set_password(string) should raise error Skype::Error::API" do
|
331
329
|
@chat.setPassword('hogehoge').should be_true
|
332
330
|
end
|
333
331
|
|
334
|
-
it "enter_password(string) should raise error
|
335
|
-
lambda{@chat.enterPassword('hogehoge')}.should raise_error
|
332
|
+
it "enter_password(string) should raise error Skype::Error::API" do
|
333
|
+
lambda{@chat.enterPassword('hogehoge')}.should raise_error Skype::Error::API
|
336
334
|
end
|
337
335
|
|
338
336
|
it "kick(string) should be true" do
|
@@ -340,7 +338,7 @@ describe SkypeAPI::Chat do
|
|
340
338
|
end
|
341
339
|
|
342
340
|
it "kick(user) should be true" do
|
343
|
-
@chat.kick(
|
341
|
+
@chat.kick(Skype.user('echo123')).should be_true
|
344
342
|
end
|
345
343
|
|
346
344
|
it "kick_ban(string) should be true" do
|
@@ -348,7 +346,7 @@ describe SkypeAPI::Chat do
|
|
348
346
|
end
|
349
347
|
|
350
348
|
it "kick_ban(user) should be true" do
|
351
|
-
@chat.kickban(
|
349
|
+
@chat.kickban(Skype.user('echo123')).should be_true
|
352
350
|
end
|
353
351
|
|
354
352
|
end
|