Giter Club home page Giter Club logo

skype-ruby's Introduction

Skype

Skype Desktop API Ruby wrapper for Mac/Linux.

Platforms

  • AppleScript + Mac OSX
  • DBus + Linux (testing on Ubuntu 12.04)

Installation

for Mac

% gem install skype
% skype-chat

for Linux

% gem install skype ruby-dbus
% skype-chat

Gemfile

gem "skype"
gem "ruby-dbus" if RUBY_PLATFORM =~ /linux/i

Usage

please read API Reference before use.

load

require 'rubygems'
require 'skype'

Skype.config :app_name => "my_skype_app"

Skype API

send message

Skype.message "USER_NAME", "hello!!"
Skype.exec "MESSAGE USER_NAME hello!!"  # execute API directly

call

Skype.call "USER_NAME"
Skype.exec "CALL USER_NAME"

video call

Skype.exec "VIDEOCALL USER_NAME"

Chat API

find a chat

chat = Skype.chats.find{|c| c.members.include? "shokaishokai" and c.topic =~ /testchat/ }

post message to the chat

chat.post "hello chat!!"

show chat messages

chat.messages.each do |m|
  puts m
end

Call API

call

call = Skype.call "shokaishokai"

check status

puts call.status   # => :routing, :ringing, :inprogress, :finished, :missed, :cancelled
puts call.talking? # => true, false

hangup

call.hangup

Samples

Test

test requires 2 skype accounts.

% gem install bundler
% bundle install
% export SKYPE_FROM=your_skype_name1
% export SKYPE_TO=your_skype_name2
% rake test

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

skype-ruby's People

Contributors

chrisbolt avatar shokai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

skype-ruby's Issues

select dbus/appscript

this is not working in gemspec

  spec.add_dependency "ruby-dbus" if RUBY_PLATFORM =~ /linux/
  spec.add_dependency "rb-appscript" if RUBY_PLATFORM =~ /darwin/

wrap the return value of chat message with Skype::Chat::Message

linux

CHATMESSAGE 12345 STATUS SENT

mac

MESSAGE 12345 STATUS SENDING

regex

/^(CHAT)?MESSAGE (\d+) STATUS (SENT|SENDING)$/

返り値が特定のパターンに当てはまる場合に加工するフィルタを登録する機構が必要かもしれない

test_chat.rb failed on Mac OSX

probably Skype.app for MacOSX changed API.

% bundle exec ruby test/test_chat.rb
Run options: --seed 4781

# Running:

.FFF

Finished in 2.051583s, 1.9497 runs/s, 6.3366 assertions/s.

  1) Failure:
TestSkypeChat#test_message_escape [test/test_chat.rb:29]:
Expected: "shokaishokai"
  Actual: nil


  2) Failure:
TestSkypeChat#test_message [test/test_chat.rb:21]:
Expected: "shokaishokai"
  Actual: nil


  3) Failure:
TestSkypeChat#test_exec [test/test_chat.rb:13]:
Expected: "shokaishokai"
  Actual: nil

4 runs, 13 assertions, 3 failures, 0 errors, 0 skips

Chat not found

Hello guys.
I'm using chat_list.rb sample to see my list chats, but the chat i want is not displayed.

usefull chat wrapper

wrapper

chat = Skype.chats.find{|c| c.members.include? "shokaishokai" }
chat.post "hello"
chat.messages.each do |m|
  puts m
end

methods

get recent_chats

Skype.search("recentchats").scan(/(#[^\s,]+)[\s,]/).map{|i| i[0] }

get messages in chat

exec("GET CHAT #{chat_id} RECENTCHATMESSAGES").
  split(/,* /).
  reject{|i|
  i !~ /^\d+$/
}.map{|i|
  i.to_i
}.sort.reverse

gem a message

{
  :user => Skype.exec("GET CHATMESSAGE #{id} from_handle").split(/ /).last,
  :body => Skype.exec("GET CHATMESSAGE #{id} body").gsub(/^MESSAGE \d+ BODY /i,''),
  :time =>  = Time.at Skype.exec("GET CHATMESSAGE #{id} timestamp").split(/ /).last.to_i
}

Unable to list chats using skype and ubuntu 12.04

Steps to reproduce:
Install skype from latest deb package
Start skype using skype -enable-dbus
Run the following:
require 'skype'
Skype.chats

From here it hangs, and if i ctrl+c the running program i get the following.
/var/lib/gems/1.9.1/gems/ruby-dbus-0.9.2/lib/dbus/bus.rb:559:in select': Interrupt from /var/lib/gems/1.9.1/gems/ruby-dbus-0.9.2/lib/dbus/bus.rb:559:inwait_for_message'
from /var/lib/gems/1.9.1/gems/ruby-dbus-0.9.2/lib/dbus/bus.rb:576:in send_sync' from /var/lib/gems/1.9.1/gems/ruby-dbus-0.9.2/lib/dbus/bus.rb:405:insend_sync_or_async'
from /var/lib/gems/1.9.1/gems/ruby-dbus-0.9.2/lib/dbus/introspect.rb:274:in block (2 levels) in define_method_from_descriptor' from /var/lib/gems/1.9.1/gems/ruby-dbus-0.9.2/lib/dbus/introspect.rb:438:incall'
from /var/lib/gems/1.9.1/gems/ruby-dbus-0.9.2/lib/dbus/introspect.rb:438:in block (3 levels) in define_shortcut_methods' from /var/lib/gems/1.9.1/gems/skype-0.2.7/lib/skype/platforms/linux.rb:17:ininvoke'
from /var/lib/gems/1.9.1/gems/skype-0.2.7/lib/skype/platforms/linux.rb:12:in initialize' from /var/lib/gems/1.9.1/gems/skype-0.2.7/lib/skype/platforms/linux.rb:36:innew'
from /var/lib/gems/1.9.1/gems/skype-0.2.7/lib/skype/platforms/linux.rb:36:in exec' from /var/lib/gems/1.9.1/gems/skype-0.2.7/lib/skype/main.rb:14:inmethod_missing'
from /var/lib/gems/1.9.1/gems/skype-0.2.7/lib/skype/wrappers/chat.rb:8:in chats' from skype-bot/bot.rb:5:in

'

Any help with this would be greatly appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.