Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CHANGE ALL TEH FILES

  • Loading branch information...
commit 224ad66dbd05e327eeaba7e0ac3f84bab1e33fa4 1 parent 85b94a5
@nfelger authored
View
2  Gemfile
@@ -1,4 +1,4 @@
source "http://rubygems.org"
-# Specify your gem's dependencies in skype.gemspec
+# Specify your gem's dependencies in rype.gemspec
gemspec
View
4 Rakefile
@@ -25,12 +25,12 @@ task :default => ["spec", "features"]
spec = Gem::Specification.new do |s|
# Change these as appropriate
- s.name = "skype"
+ s.name = "rype"
s.version = "0.1.0"
s.summary = "Skype Api wrapper"
s.author = "Niko Felger"
s.email = "niko.felger@gmail.com"
- s.homepage = "http://github.com/nfelger/skype"
+ s.homepage = "http://github.com/nfelger/rype"
s.has_rdoc = false
# You should probably have a README of some kind. Change the filename
View
6 examples/chats/echo_server.rb
@@ -2,10 +2,10 @@
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', 'lib')
-require 'skype'
+require 'rype'
require 'pp'
-Skype.on(:chatmessage_received) do |chatmessage|
+Rype.on(:chatmessage_received) do |chatmessage|
chatmessage.chat do |chat|
chatmessage.body do |body|
chat.send_message(body)
@@ -13,4 +13,4 @@
end
end
-Skype.attach.join
+Rype.attach.join
View
6 examples/chats/list_chats.rb
@@ -2,12 +2,12 @@
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', 'lib')
-require 'skype'
+require 'rype'
require 'pp'
-Skype.attach
+Rype.attach
-Skype.chats do |chats|
+Rype.chats do |chats|
chats.each do |chat|
p chat
end
View
6 examples/chats/send_chat.rb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', 'lib')
-require 'skype'
+require 'rype'
-Skype.attach
+Rype.attach
chat_id, message_body = ARGV[0..1]
-Skype.chat(chat_id).send_message(message_body)
+Rype.chat(chat_id).send_message(message_body)
View
10 features/step_definitions/skype_steps.rb
@@ -2,7 +2,7 @@
# Silence constant re-assignment warning.
original_verbosity = $VERBOSE
$VERBOSE = nil
- Skype::Api = Skype::FakeApi
+ Rype::Api = Rype::FakeApi
$VERBOSE = original_verbosity
end
@@ -19,19 +19,19 @@
false
end
end
- Skype::Api.on_notification(scope, @callback)
+ Rype::Api.on_notification(scope, @callback)
end
When /^I send a chatmessage "([^\"]*)" to "([^\"]*)"$/ do |message_body, chat_id|
- Skype::Chat.new(chat_id).send_message(message_body)
+ Rype::Chat.new(chat_id).send_message(message_body)
end
When /^Skype issues a notification "([^\"]*)"$/ do |notification|
- Skype::Api.notify(notification)
+ Rype::Api.notify(notification)
end
Then /^the Skype Api should receive the message$/ do |string|
- Skype::Api.recorded_messages.should include(string)
+ Rype::Api.recorded_messages.should include(string)
end
Then /^the callback should be called$/ do
View
2  features/support/env.rb
@@ -1,3 +1,3 @@
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', 'lib')
-require 'skype'
+require 'rype'
View
4 features/support/lib/fake_api.rb
@@ -1,6 +1,6 @@
require 'forwardable'
-module Skype
+module Rype
class FakeApi < Api
class << self
extend Forwardable
@@ -19,4 +19,4 @@ def recorded_messages
@recorded_messages ||= []
end
end
-end
+end
View
23 lib/rype.rb
@@ -0,0 +1,23 @@
+require 'forwardable'
+
+require 'rype/api'
+require 'rype/chat'
+require 'rype/chatmessage'
+require 'rype/events'
+
+module Rype
+ Offline = Class.new StandardError
+ Denied = Class.new StandardError
+
+ class << self
+ extend Forwardable
+
+ def_delegators Rype::Api, :instance, :attach, :thread
+ def_delegator Rype::Chat, :new, :chat
+ def_delegator Rype::Chat, :all, :chats
+ def_delegator Rype::Events, :on
+
+ Rype::Events.initialize_listeners
+ end
+end
+
View
10 lib/skype/api.rb → lib/rype/api.rb
@@ -1,7 +1,7 @@
require 'dbus'
require 'forwardable'
-module Skype
+module Rype
class Notify < DBus::Object
dbus_interface "com.Skype.API.Client" do
dbus_method :Notify, "in data:s" do |message|
@@ -22,16 +22,16 @@ def instance
attr_reader :thread
- def attach(application_name="ruby-skype")
+ def attach(application_name="rype")
raise "Already attached." if attached?
# Say hi to Skype.
status, = api.Invoke "NAME #{application_name}"
if status == 'CONNSTATUS OFFLINE'
- raise Skype::Offline
+ raise Rype::Offline
elsif status != 'OK'
- raise SKype::Denied
+ raise Rype::Denied
end
api.Invoke "PROTOCOL 7"
@@ -40,7 +40,7 @@ def attach(application_name="ruby-skype")
end
def invoke(message, &block)
- raise "Not attached to skype. Call Skype::Api.attach first." unless attached?
+ raise "Not attached to Skype. Call Rype::Api.attach first." unless attached?
log_outgoing message
if block_given?
View
4 lib/skype/chat.rb → lib/rype/chat.rb
@@ -1,6 +1,6 @@
-require 'skype/events'
+require 'rype/events'
-module Skype
+module Rype
class Chat
class << self
attr_accessor :chats
View
2  lib/skype/chatmessage.rb → lib/rype/chatmessage.rb
@@ -1,4 +1,4 @@
-module Skype
+module Rype
class Chatmessage
def initialize(id)
@chatmessage_id = id
View
10 lib/skype/events.rb → lib/rype/events.rb
@@ -1,18 +1,18 @@
require 'thread'
-module Skype
+module Rype
class Events
class << self
def on(event)
case event
when :chatmessage_received
- Skype::Api.instance.on_notification("CHATMESSAGE (.*) STATUS RECEIVED") do |chatmessage_id|
+ Rype::Api.instance.on_notification("CHATMESSAGE (.*) STATUS RECEIVED") do |chatmessage_id|
yield Chatmessage.new(chatmessage_id)
end
when :chats_received
- Skype::Api.instance.on_notification("CHATS (.*)") do |chatlist|
+ Rype::Api.instance.on_notification("CHATS (.*)") do |chatlist|
yield chatlist.split(', ').map { |chatname| Chat.new(chatname) }
end
end
@@ -20,8 +20,8 @@ def on(event)
def initialize_listeners
mutex = Mutex.new
- Skype::Events.on(:chats_received) do |chats|
- mutex.synchronize { Skype::Chat.chats = chats }
+ Rype::Events.on(:chats_received) do |chats|
+ mutex.synchronize { Rype::Chat.chats = chats }
end
end
end
View
23 lib/skype.rb
@@ -1,23 +0,0 @@
-require 'forwardable'
-
-require 'skype/api'
-require 'skype/chat'
-require 'skype/chatmessage'
-require 'skype/events'
-
-module Skype
- Offline = Class.new StandardError
- Denied = Class.new StandardError
-
- class << self
- extend Forwardable
-
- def_delegators Skype::Api, :instance, :attach, :thread
- def_delegator Skype::Chat, :new, :chat
- def_delegator Skype::Chat, :all, :chats
- def_delegator Skype::Events, :on
-
- Skype::Events.initialize_listeners
- end
-end
-
View
14 readme.md
@@ -1,4 +1,4 @@
-# skype – library to talk to the Skype API
+# rype – Ruby library to talk to the Skype API
## Description
@@ -9,12 +9,12 @@ Currently, it has the following capabilities:
* Get a list of your chats,
* send chat messages,
* receive chat messages,
-* use the raw Skype protocol via Skype::Api#invoke and Skype::Api#on_notification. More information about the protocol at [developer.skype.com](http://developer.skype.com)
+* use the raw Skype protocol via Rype::Api#invoke and Rype::Api#on_notification. More information about the protocol at [developer.skype.com](http://developer.skype.com)
## Installation
-In order to work with the skype gem, there are a few requirements:
+In order to work with the rype gem, there are a few requirements:
- You need to be on Linux
- You need to have Skype running
@@ -37,9 +37,9 @@ To confirm it's working, start skype and sign in. Then, open an irb session and:
client_to_skype = skype_service.object('/com/Skype')
client_to_skype.introspect
api = client_to_skype["com.Skype.API"]
- api.Invoke("NAME ruby-skype")
+ api.Invoke("NAME rype")
-If everything is set up correctly, Skype will now ask whether "ruby-skype" should be allowed to connect.
+If everything is set up correctly, Skype will now ask whether "rype" should be allowed to connect.
## Usage
@@ -48,9 +48,9 @@ There are a few examples in `examples/` that should give you an idea of how
to use the gem.
-## Head-less skype
+## Head-less Skype
-Say you want to be running an app that connects to skype on a box that won't have a display attached. For this use case, Xvfb is quite handy:
+Say you want to be running an app that connects to Skype on a box that won't have a display attached. For this use case, Xvfb is quite handy:
> "Xvfb or X virtual framebuffer is an X11 server that performs all graphical operations in memory, not showing any screen output." (wikipedia)"
View
6 skype.gemspec → rype.gemspec
@@ -3,16 +3,14 @@ $:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.version = "0.0.1"
- s.name = "skype"
+ s.name = "rype"
s.platform = Gem::Platform::RUBY
s.authors = ["Niko Felger"]
s.email = ["niko.felger@gmail.com"]
- s.homepage = "https://github.com/nfelger/skype"
+ s.homepage = "https://github.com/nfelger/rype"
s.summary = %q{Unofficial Skype Api wrapper}
s.description = %q{Unofficial Skype Api wrapper}
- s.rubyforge_project = "skype"
-
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
View
24 spec/lib/skype/chat_spec.rb → spec/lib/rype/chat_spec.rb
@@ -1,11 +1,11 @@
-require 'skype/chat'
+require 'rype/chat'
-# describe Skype::Chat, '.all' do
-# subject { Skype::Chat }
+# describe Rype::Chat, '.all' do
+# subject { Rype::Chat }
#
# it "should get the list of chats from the api" do
-# Skype.instance.should_receive(:invoke).with("SEARCH CHATS") do
-# Skype.instance.notify("CHATS")
+# Rype.instance.should_receive(:invoke).with("SEARCH CHATS") do
+# Rype.instance.notify("CHATS")
# end
#
# subject.all
@@ -13,27 +13,27 @@
#
# context "when the response contains chats" do
# before(:each) do
-# Skype.instance.stub!(:invoke).with("SEARCH CHATS") do
-# Skype.instance.notify("CHATS #bitman/$jessy;eb06e65612353279, #bitman/$jdenton;9244e98f82d7d391")
+# Rype.instance.stub!(:invoke).with("SEARCH CHATS") do
+# Rype.instance.notify("CHATS #bitman/$jessy;eb06e65612353279, #bitman/$jdenton;9244e98f82d7d391")
# end
# end
#
# it "should return a new Chat object for each chat id in the response" do
# subject.all do |chats|
-# chats.all?{|chat| chat.should be_a(Skype::Chat)}
+# chats.all?{|chat| chat.should be_a(Rype::Chat)}
# chats.map{|chat| chat.chatname}.should == ["#bitman/$jessy;eb06e65612353279", "#bitman/$jdenton;9244e98f82d7d391"]
# end
# end
# end
# end
-describe Skype::Chat, '#send_message' do
- subject { Skype::Chat.new('#test/$echo123;2010fc482c5ce233') }
+describe Rype::Chat, '#send_message' do
+ subject { Rype::Chat.new('#test/$echo123;2010fc482c5ce233') }
it "should tell the api to send the message" do
- Skype.instance.should_receive(:invoke).
+ Rype.instance.should_receive(:invoke).
with("CHATMESSAGE #test/$echo123;2010fc482c5ce233 ohai Zkaip")
subject.send_message("ohai Zkaip")
end
-end
+end
View
43 spec/lib/rype_spec.rb
@@ -0,0 +1,43 @@
+require 'spec_helper'
+require 'rype'
+
+describe Rype do
+ describe '.instance' do
+ subject { Rype.instance }
+ it { should be_a(Rype::Api) }
+ end
+
+ describe '.attach' do
+ it "should delegate to Rype::Api" do
+ Rype::Api.should_receive(:attach).with("chat id")
+ Rype.attach("chat id")
+ end
+ end
+
+ describe '.chat' do
+ subject { Rype.chat('chat id') }
+ it { should be_a(Rype::Chat) }
+ end
+
+ describe '.chats' do
+ it "should delegate to Rype::Chat" do
+ Rype::Chat.should_receive(:all)
+ Rype.chats
+ end
+ end
+
+ describe '.on' do
+ it "should delegate to Rype::Events" do
+ Rype::Events.should_receive(:on)
+ Rype.on
+ end
+ end
+
+ describe '.thread' do
+ it 'should delegate to Rype::Api' do
+ Rype::Api.should_receive(:thread)
+ Rype.thread
+ end
+ end
+end
+
View
43 spec/lib/skype_spec.rb
@@ -1,43 +0,0 @@
-require 'spec_helper'
-require 'skype'
-
-describe Skype do
- describe '.instance' do
- subject { Skype.instance }
- it { should be_a(Skype::Api) }
- end
-
- describe '.attach' do
- it "should delegate to Skype::Api" do
- Skype::Api.should_receive(:attach).with("chat id")
- Skype.attach("chat id")
- end
- end
-
- describe '.chat' do
- subject { Skype.chat('chat id') }
- it { should be_a(Skype::Chat) }
- end
-
- describe '.chats' do
- it "should delegate to Skype::Chat" do
- Skype::Chat.should_receive(:all)
- Skype.chats
- end
- end
-
- describe '.on' do
- it "should delegate to Skype::Events" do
- Skype::Events.should_receive(:on)
- Skype.on
- end
- end
-
- describe '.thread' do
- it 'should delegate to Skype::Api' do
- Skype::Api.should_receive(:thread)
- Skype.thread
- end
- end
-end
-
View
4 spec/spec_helper.rb
@@ -1,5 +1,5 @@
-require 'skype'
+require 'rype'
require File.join(File.dirname(__FILE__), '..', 'features', 'support', 'lib', 'fake_api')
require 'pp'
-Skype::Api.instance_variable_set(:"@instance", Skype::FakeApi.instance)
+Rype::Api.instance_variable_set(:"@instance", Rype::FakeApi.instance)
Please sign in to comment.
Something went wrong with that request. Please try again.