skype-api 0.0.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.
- checksums.yaml +7 -0
- data/lib/SkypeAPI.rb +32 -0
- data/lib/skype-api/application.rb +2 -0
- data/lib/skype-api/call.rb +2 -0
- data/lib/skype-api/chat.rb +62 -0
- data/lib/skype-api/chat_member.rb +2 -0
- data/lib/skype-api/connection/applescript_connection.rb +13 -0
- data/lib/skype-api/connection/dbus_connection.rb +12 -0
- data/lib/skype-api/group.rb +2 -0
- data/lib/skype-api/message.rb +43 -0
- data/lib/skype-api/profile.rb +2 -0
- data/lib/skype-api/sms.rb +2 -0
- data/lib/skype-api/user.rb +90 -0
- data/lib/skype-api/voice_mail.rb +2 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 88df0c4a42d09b222f3a15eaf1fdf956debc0a3f
|
4
|
+
data.tar.gz: 19d1260cc4df0dfc8a0c9ffdc19b1ca164c1e48a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 46e63a9b6a5271af45595fc714773439bbb23da54d302988c3bb3939c9859dd2ce800a5278e7d3b1a40246e5f5bb0b474773112d8a55143d2d61e70d4daa4ba3
|
7
|
+
data.tar.gz: 0c2a682624ef8ce5e4ac5dbe5afd2c7138c1662abf20856c61bb8b399d3053d2c2fd3dcfcd5cb10b288d1a934b6f44c84e694ad21c9a4104cceb5c7cd019f9b2
|
data/lib/SkypeAPI.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
case Gem::Platform.local.os
|
3
|
+
when /mswin|windows/i
|
4
|
+
throw RuntimeError.exception("Windows is not supported.")
|
5
|
+
when /linux|arch/i
|
6
|
+
require_relative("../lib/Skype-API/connection/dbus_connection")
|
7
|
+
module SkypeAPI
|
8
|
+
Connection = DbusConnection.new;
|
9
|
+
end
|
10
|
+
when /darwin/i
|
11
|
+
require_relative("../lib/Skype-API/connection/applescript_connection")
|
12
|
+
module SkypeAPI
|
13
|
+
Connection = ApplescriptConnection.new;
|
14
|
+
end
|
15
|
+
end
|
16
|
+
require_relative "../lib/Skype-API/application"
|
17
|
+
require_relative "../lib/Skype-API/call"
|
18
|
+
require_relative "../lib/Skype-API/chat"
|
19
|
+
require_relative "../lib/Skype-API/chat_member"
|
20
|
+
require_relative "../lib/Skype-API/group"
|
21
|
+
require_relative "../lib/Skype-API/message"
|
22
|
+
require_relative "../lib/Skype-API/profile"
|
23
|
+
require_relative "../lib/Skype-API/sms"
|
24
|
+
require_relative "../lib/Skype-API/user"
|
25
|
+
require_relative "../lib/Skype-API/voice_mail"
|
26
|
+
module SkypeAPI
|
27
|
+
AppName = "SkypeAPI"
|
28
|
+
def self.exec(cmd)
|
29
|
+
Connection.exec(cmd);
|
30
|
+
end
|
31
|
+
end
|
32
|
+
SkypeAPI::exec("PROTOCOL 7")
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module SkypeAPI
|
2
|
+
class Chat
|
3
|
+
@@chats = Hash.new;
|
4
|
+
def self.get_chats
|
5
|
+
recieved_chats = SkypeAPI::exec("SEARCH RECENTCHATS");
|
6
|
+
recieved_chats.sub("CHATS ","").split(", ").map {|chat| get_chat(chat)}
|
7
|
+
end
|
8
|
+
def self.get_chat(id)
|
9
|
+
if @@chats[id] == nil
|
10
|
+
@@chats[id] = Chat.new(id);
|
11
|
+
end
|
12
|
+
@@chats[id];
|
13
|
+
end
|
14
|
+
def initialize(id)
|
15
|
+
@id = id
|
16
|
+
end
|
17
|
+
def members
|
18
|
+
get_prop("MEMBERS").split(" ").map {|name| User.get_user(name)};
|
19
|
+
end
|
20
|
+
def topic
|
21
|
+
get_prop("TOPIC");
|
22
|
+
end
|
23
|
+
def id
|
24
|
+
@id
|
25
|
+
end
|
26
|
+
def adder
|
27
|
+
get_prop("ADDER");
|
28
|
+
end
|
29
|
+
def creation_timestamp
|
30
|
+
get_prop("TIMESTAMP");
|
31
|
+
end
|
32
|
+
def status
|
33
|
+
get_prop("STATUS")
|
34
|
+
end
|
35
|
+
def posters
|
36
|
+
get_prop("POSTERS")
|
37
|
+
end
|
38
|
+
def messages
|
39
|
+
get_prop("RECENTCHATMESSAGES").split(", ").map {|message| Message.new(message)};
|
40
|
+
end
|
41
|
+
def active_members
|
42
|
+
get_prop("ACTIVEMEMBERS");
|
43
|
+
end
|
44
|
+
def friendly_name
|
45
|
+
get_prop("FRIENDLYNAME");
|
46
|
+
|
47
|
+
end
|
48
|
+
def post(msg)
|
49
|
+
SkypeAPI::exec("CHATMESSAGE #{self.id} #{msg}");
|
50
|
+
end
|
51
|
+
def set_topic(topic)
|
52
|
+
SkypeAPI::exec("SET CHAT #{self.id} TOPIC #{topic}");
|
53
|
+
end
|
54
|
+
def to_s
|
55
|
+
@id.to_s
|
56
|
+
end
|
57
|
+
private
|
58
|
+
def get_prop(prop)
|
59
|
+
SkypeAPI::exec("GET CHAT #{self.id} #{prop}").sub("CHAT #{self.id} #{prop} ","")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rb-scpt'
|
2
|
+
|
3
|
+
module SkypeAPI
|
4
|
+
class ApplescriptConnection
|
5
|
+
include Appscript
|
6
|
+
def initialize
|
7
|
+
@api_reference = app("Skype");
|
8
|
+
end
|
9
|
+
def exec(str)
|
10
|
+
@api_reference.send_(:command => str, "script_name".to_sym => SkypeAPI::AppName)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'dbus'
|
2
|
+
module SkypeAPI
|
3
|
+
class DbusConnection
|
4
|
+
def initialize
|
5
|
+
@api_endpoint = DBus::SessionBus.instance.service("com.Skype.API").object("/com/Skype")
|
6
|
+
@api_endpoint.default_iface = "com.Skype.API"
|
7
|
+
end
|
8
|
+
def exec(str)
|
9
|
+
@api_endpoint.Invoke(str)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module SkypeAPI
|
2
|
+
class Message
|
3
|
+
def initialize(id)
|
4
|
+
@id = id
|
5
|
+
end
|
6
|
+
def id
|
7
|
+
@id
|
8
|
+
end
|
9
|
+
def timestamp
|
10
|
+
get_prop("TIMESTAMP")
|
11
|
+
end
|
12
|
+
def sender
|
13
|
+
User.get_user(get_prop("FROM_HANDLE"))
|
14
|
+
end
|
15
|
+
def type
|
16
|
+
get_prop("TYPE")
|
17
|
+
end
|
18
|
+
def status
|
19
|
+
get_prop("STATUS")
|
20
|
+
end
|
21
|
+
def editable
|
22
|
+
case get_prop("IS_EDITABLE")
|
23
|
+
when "FALSE"
|
24
|
+
return false
|
25
|
+
when "TRUE"
|
26
|
+
return true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
def edited_by
|
30
|
+
User.get_user(get_prop("EDITED_BY"))
|
31
|
+
end
|
32
|
+
def edit_time
|
33
|
+
get_prop("EDITED_TIMESTAMP")
|
34
|
+
end
|
35
|
+
def edit(new_body)
|
36
|
+
SkypeAPI::exec("SET CHATMESSAGE #{self.id} MESSAGE #{new_body}")
|
37
|
+
end
|
38
|
+
private
|
39
|
+
def get_prop(prop)
|
40
|
+
SkypeAPI::exec("GET CHATMESSAGE #{self.id} #{prop}").sub("CHATMESSAGE #{self.id} #{prop} ","")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module SkypeAPI
|
2
|
+
class User
|
3
|
+
@@users = Hash.new
|
4
|
+
def self.get_user(id)
|
5
|
+
if @@users[id] == nil then
|
6
|
+
@@users[id] = User.new(id)
|
7
|
+
end
|
8
|
+
@@users[id]
|
9
|
+
end
|
10
|
+
def initialize(id)
|
11
|
+
@id = id
|
12
|
+
end
|
13
|
+
def id
|
14
|
+
@id
|
15
|
+
end
|
16
|
+
def handle
|
17
|
+
@id
|
18
|
+
end
|
19
|
+
def name
|
20
|
+
get_prop("FULLNAME")
|
21
|
+
end
|
22
|
+
def nickname
|
23
|
+
get_prop("DISPLAYNAME")
|
24
|
+
end
|
25
|
+
def birthday
|
26
|
+
get_prop("BIRTHDAY")
|
27
|
+
end
|
28
|
+
def sex
|
29
|
+
get_prop("SEX")
|
30
|
+
end
|
31
|
+
def language
|
32
|
+
get_prop("LANGUAGE")
|
33
|
+
end
|
34
|
+
def country
|
35
|
+
get_prop("COUNTRY")
|
36
|
+
end
|
37
|
+
def province
|
38
|
+
get_prop("PROVINCE")
|
39
|
+
end
|
40
|
+
def city
|
41
|
+
get_prop("CITY")
|
42
|
+
end
|
43
|
+
def home_number
|
44
|
+
get_prop("PHONE_HOME")
|
45
|
+
end
|
46
|
+
def office_number
|
47
|
+
get_prop("PHONE_OFFICE")
|
48
|
+
end
|
49
|
+
def cell_number
|
50
|
+
get_prop("PHONE_MOBILE")
|
51
|
+
end
|
52
|
+
def homepage
|
53
|
+
get_prop("HOMEPAGE")
|
54
|
+
end
|
55
|
+
def about
|
56
|
+
get_prop("ABOUT")
|
57
|
+
end
|
58
|
+
def blocked?
|
59
|
+
case get_prop("ISBLOCKED")
|
60
|
+
when "TRUE"
|
61
|
+
true
|
62
|
+
when "FALSE"
|
63
|
+
false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
def online_status
|
67
|
+
get_prop("ONLINESTATUS")
|
68
|
+
end
|
69
|
+
def online?
|
70
|
+
status = self.online_status
|
71
|
+
return status == "ONLINE" || status == "DND"
|
72
|
+
end
|
73
|
+
def last_online
|
74
|
+
get_prop("LASTONLINETIMESTAMP")
|
75
|
+
end
|
76
|
+
def mood
|
77
|
+
get_prop("MOOD_TEXT")
|
78
|
+
end
|
79
|
+
def timezone
|
80
|
+
get_prop("TIMEZONE")
|
81
|
+
end
|
82
|
+
def set_nickname(name)
|
83
|
+
SkypeAPI::exec("SET USER #{self.id} DISPLAYNAME #{name}");
|
84
|
+
end
|
85
|
+
private
|
86
|
+
def get_prop(prop)
|
87
|
+
SkypeAPI::exec("GET USER #{self.id} #{prop}").sub("USER #{self.id} #{prop} ","")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: skype-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicolas Machado
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A gem for accessing the Skype API on OS X and Linux
|
14
|
+
email: nxnmq08@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/SkypeAPI.rb
|
20
|
+
- lib/skype-api/application.rb
|
21
|
+
- lib/skype-api/call.rb
|
22
|
+
- lib/skype-api/chat.rb
|
23
|
+
- lib/skype-api/chat_member.rb
|
24
|
+
- lib/skype-api/connection/applescript_connection.rb
|
25
|
+
- lib/skype-api/connection/dbus_connection.rb
|
26
|
+
- lib/skype-api/group.rb
|
27
|
+
- lib/skype-api/message.rb
|
28
|
+
- lib/skype-api/profile.rb
|
29
|
+
- lib/skype-api/sms.rb
|
30
|
+
- lib/skype-api/user.rb
|
31
|
+
- lib/skype-api/voice_mail.rb
|
32
|
+
homepage: http://rubygems.org/gems/skype-api
|
33
|
+
licenses:
|
34
|
+
- MIT
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.5.0
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Gem for accessing Skype API
|
56
|
+
test_files: []
|