skype 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9082c675c10000bdfb87daa0af61816fc6b13590
4
+ data.tar.gz: 986cd75e28a503019e7ce0bed39a79e887c8c376
5
+ SHA512:
6
+ metadata.gz: a9ebb195e034dd09292f1766dac9b5a5b4d4c1350b106375a4737ba95636276b8f47cf61eec85655dc6b9735ce6d00ffb61490f9f7f8719c2cf3aeccf7c6ee12
7
+ data.tar.gz: df6186b549f3aded375e40fe17a870b8e3291e35b31b705f6528f5d4e981cd2cc2564adeabada759dfdca9a7a118d1321eff2189b8d60f66f05ea387a18b99bb
@@ -0,0 +1,21 @@
1
+ .DS_Store
2
+ *~
3
+ *#*
4
+ *.gem
5
+ *.rbc
6
+ .bundle
7
+ .config
8
+ .yardoc
9
+ .ruby-version
10
+ Gemfile.lock
11
+ InstalledFiles
12
+ _yardoc
13
+ coverage
14
+ doc/
15
+ lib/bundler/man
16
+ pkg
17
+ rdoc
18
+ spec/reports
19
+ test/tmp
20
+ test/version_tmp
21
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in skype.gemspec
4
+ gemspec
@@ -0,0 +1,5 @@
1
+ === 0.0.1 2013-06-20
2
+
3
+ * implement wrapper for
4
+ * Mac OSX + AppleScript
5
+ * Linux + DBus
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Sho Hashimoto
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ Skype
2
+ =====
3
+ [Skype Desktop API](http://dev.skype.com/desktop-api-reference) wrapper for Ruby
4
+
5
+
6
+ Platform
7
+ --------
8
+ - AppleScript + Mac OSX
9
+ - DBus + Linux (testing on Ubuntu 12.04)
10
+
11
+
12
+ Installation
13
+ ------------
14
+
15
+ % gem install skype
16
+
17
+
18
+ Usage
19
+ -----
20
+ please read [API Reference](http://dev.skype.com/desktop-api-reference) before use.
21
+
22
+ ### load
23
+ ```ruby
24
+ require 'rubygems'
25
+ require 'skype'
26
+
27
+ Skype.config :app_name => "my_skype_app"
28
+ ```
29
+
30
+ ### send message
31
+ ```ruby
32
+ Skype.message "USER_NAME", "hello!!"
33
+ ```
34
+
35
+ ### call
36
+ ```ruby
37
+ Skype.call "USER_NAME"
38
+ ```
39
+
40
+ ### get recent chat list
41
+ ```ruby
42
+ puts Skype.search("recentchats")
43
+ ```
44
+
45
+ ### send message to group chat
46
+ ```ruby
47
+ Skype.chatmessage "#name1/name2;$a1b2cdef3456", "hello chat!!"
48
+ ```
49
+
50
+
51
+ Contributing
52
+ ------------
53
+ 1. Fork it
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,7 @@
1
+ require "rubygems"
2
+
3
+ require "skype/version"
4
+ require "skype/skype"
5
+
6
+ module Skype
7
+ end
@@ -0,0 +1,23 @@
1
+ require "dbus"
2
+
3
+ module Skype
4
+ class Connection
5
+
6
+ def initialize
7
+ @bus = DBus.session_bus
8
+ @service = @bus.service('com.Skype.API').object('/com/Skype')
9
+ @service.default_iface = 'com.Skype.API'
10
+ @service.introspect
11
+ invoke "NAME #{::Skype.config[:app_name]}"
12
+ invoke "PROTOCOL 99"
13
+ end
14
+
15
+ def invoke(cmd)
16
+ @service.Invoke(cmd)[0]
17
+ end
18
+ end
19
+
20
+ def self.exec(command)
21
+ (@@connection||=Connection.new).invoke command
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ require "appscript"
2
+
3
+ module Skype
4
+ def self.exec(command)
5
+ Appscript.app("skype").send_ :script_name => self.config[:app_name], :command => command
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ require case RUBY_PLATFORM
2
+ when /darwin/
3
+ "skype/platforms/mac"
4
+ when /linux/
5
+ "skype/platforms/linux"
6
+ end
7
+
8
+ module Skype
9
+ @@config = {:app_name => "ruby-skype"}
10
+ def self.config(conf=nil)
11
+ if conf.kind_of? Hash
12
+ conf.each do |k,v|
13
+ @@config[k.to_sym] = v
14
+ end
15
+ else
16
+ return @@config
17
+ end
18
+ end
19
+
20
+ def self.method_missing(name, *args)
21
+ self.exec "#{name.upcase} #{args.join(' ')}"
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module Skype
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
4
+ require 'skype'
5
+
6
+ puts "please put the username to call"
7
+ print "> "
8
+ to = STDIN.gets.strip
9
+ p Skype.call to
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
4
+ require 'skype'
5
+
6
+ chats = Skype.search "recentchats"
7
+ chats = chats.scan(/(#[^\s,]+)[\s,]/).map{|i| i[0] }
8
+
9
+ chats.each_with_index do |chat, index|
10
+ puts "[#{index}] #{chat}"
11
+ end
12
+
13
+ puts %Q{select chat number 0~#{chats.size-1} ?}
14
+ exit 1 unless (n = STDIN.gets.strip) =~ /^\d$/
15
+
16
+ chat = chats[n.to_i]
17
+ puts %Q{#{chat} was selected}
18
+
19
+ while line = STDIN.gets.strip
20
+ Skype.chatmessage chat, line
21
+ end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ $:.unshift File.expand_path '../lib', File.dirname(__FILE__)
4
+ require 'skype'
5
+
6
+ p Skype.message "shokaishokai", "hello"
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'skype/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "skype"
8
+ spec.version = Skype::VERSION
9
+ spec.authors = ["Sho Hashimoto"]
10
+ spec.email = ["hashimoto@shokai.org"]
11
+ spec.description = %q{Skype Desktop API wrapper for Ruby}
12
+ spec.summary = spec.description
13
+ spec.homepage = "https://github.com/shokai/skype-ruby"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ case RUBY_PLATFORM
22
+ when /linux/
23
+ spec.add_dependency "ruby-dbus"
24
+ when /darwin/
25
+ spec.add_dependency "rb-appscript"
26
+ end
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.3"
29
+ spec.add_development_dependency "rake"
30
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: skype
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sho Hashimoto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rb-appscript
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Skype Desktop API wrapper for Ruby
56
+ email:
57
+ - hashimoto@shokai.org
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - History.txt
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/skype.rb
69
+ - lib/skype/platforms/linux.rb
70
+ - lib/skype/platforms/mac.rb
71
+ - lib/skype/skype.rb
72
+ - lib/skype/version.rb
73
+ - samples/call.rb
74
+ - samples/send_groupchat.rb
75
+ - samples/send_message.rb
76
+ - skype.gemspec
77
+ homepage: https://github.com/shokai/skype-ruby
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.0.3
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: Skype Desktop API wrapper for Ruby
101
+ test_files: []
102
+ has_rdoc: