airplay 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +12 -0
- data/airplay.gemspec +15 -0
- data/lib/airplay/protocol.rb +8 -8
- data/lib/airplay/protocol/image.rb +1 -1
- data/lib/airplay/version.rb +1 -1
- data/test/discovery.rb +28 -0
- data/test/fixtures/image.gif +0 -0
- data/test/helper.rb +4 -0
- data/test/images.rb +24 -0
- data/test/video.rb +11 -0
- metadata +56 -54
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/pkg
|
data/Rakefile
ADDED
data/airplay.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "airplay"
|
3
|
+
s.version = "0.1.1"
|
4
|
+
s.summary = "Airplay client"
|
5
|
+
s.description = "Send image/video to an airplay enabled device"
|
6
|
+
s.authors = ["elcuervo"]
|
7
|
+
s.email = ["yo@brunoaguirre.com"]
|
8
|
+
s.homepage = "http://github.com/elcuervo/airplay"
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
s.test_files = `git ls-files spec`.split("\n")
|
11
|
+
|
12
|
+
s.add_dependency("dnssd")
|
13
|
+
s.add_development_dependency("cutest")
|
14
|
+
s.add_development_dependency("capybara")
|
15
|
+
end
|
data/lib/airplay/protocol.rb
CHANGED
@@ -12,21 +12,21 @@ class Airplay::Protocol
|
|
12
12
|
|
13
13
|
def make_request(request)
|
14
14
|
response = @http.request(@request)
|
15
|
-
raise Airplay::Protocol::InvalidRequestError if response.code == 404
|
15
|
+
raise Airplay::Protocol::InvalidRequestError if response.code == "404"
|
16
16
|
true
|
17
17
|
end
|
18
18
|
|
19
19
|
def put(resource, body = nil, headers = {})
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
make_request(
|
20
|
+
request = Net::HTTP::Put.new resource
|
21
|
+
request.body = body
|
22
|
+
request.initialize_http_header DEFAULT_HEADERS.merge(headers)
|
23
|
+
make_request(request)
|
24
24
|
end
|
25
25
|
|
26
26
|
def get(resource, headers = {})
|
27
|
-
|
28
|
-
|
29
|
-
make_request(
|
27
|
+
request = Net::HTTP::Get.new resource
|
28
|
+
request.initialize_http_header DEFAULT_HEADERS.merge(headers)
|
29
|
+
make_request(request)
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
data/lib/airplay/version.rb
CHANGED
data/test/discovery.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path("helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
scope do
|
4
|
+
|
5
|
+
setup do
|
6
|
+
@airplay = Airplay::Client.new
|
7
|
+
end
|
8
|
+
|
9
|
+
test "browse for available airplay servers" do
|
10
|
+
assert_equal 1, @airplay.servers.size
|
11
|
+
end
|
12
|
+
|
13
|
+
test "find servers by name" do
|
14
|
+
airplay = Airplay::Client.new
|
15
|
+
assert @airplay.find_by_name("elCuervo").is_a?(Airplay::Node)
|
16
|
+
end
|
17
|
+
|
18
|
+
test "raise on not found" do
|
19
|
+
assert_raise Airplay::Client::ServerNotFoundError do
|
20
|
+
@airplay.find_by_name("NotARealAirplayServer")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
test "autoselect if only one server available" do
|
25
|
+
assert_equal "elCuervo", @airplay.active_server.name
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
Binary file
|
data/test/helper.rb
ADDED
data/test/images.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path("helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
scope do
|
4
|
+
test "check image protocol class" do
|
5
|
+
image_protocol = Airplay::Protocol::Image.new("127.0.0.1")
|
6
|
+
assert_equal "/photos", image_protocol.resource
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
scope do
|
11
|
+
setup do
|
12
|
+
@airplay = Airplay::Client.new
|
13
|
+
end
|
14
|
+
|
15
|
+
test "send an image to the server" do
|
16
|
+
@airplay.use("elCuervo")
|
17
|
+
assert_equal true, @airplay.send_image("./test/fixtures/image.gif")
|
18
|
+
end
|
19
|
+
|
20
|
+
test "send an image to the server doing a dissolve" do
|
21
|
+
@airplay.use("elCuervo")
|
22
|
+
assert_equal true, @airplay.send_image("../test/fixtures/image.gif", :dissolve)
|
23
|
+
end
|
24
|
+
end
|
data/test/video.rb
ADDED
metadata
CHANGED
@@ -1,93 +1,95 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: airplay
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
4
5
|
prerelease:
|
5
|
-
version: "0.1"
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- elcuervo
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-17 00:00:00.000000000 -03:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
16
|
name: dnssd
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70188897539300 !ruby/object:Gem::Requirement
|
19
18
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
24
23
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: cutest
|
28
24
|
prerelease: false
|
29
|
-
|
25
|
+
version_requirements: *70188897539300
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: cutest
|
28
|
+
requirement: &70188897538840 !ruby/object:Gem::Requirement
|
30
29
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
35
34
|
type: :development
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: capybara
|
39
35
|
prerelease: false
|
40
|
-
|
36
|
+
version_requirements: *70188897538840
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: capybara
|
39
|
+
requirement: &70188897538340 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
46
45
|
type: :development
|
47
|
-
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *70188897538340
|
48
48
|
description: Send image/video to an airplay enabled device
|
49
|
-
email:
|
49
|
+
email:
|
50
50
|
- yo@brunoaguirre.com
|
51
51
|
executables: []
|
52
|
-
|
53
52
|
extensions: []
|
54
|
-
|
55
53
|
extra_rdoc_files: []
|
56
|
-
|
57
|
-
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- Rakefile
|
57
|
+
- airplay.gemspec
|
58
|
+
- lib/airplay.rb
|
58
59
|
- lib/airplay/client.rb
|
59
60
|
- lib/airplay/node.rb
|
61
|
+
- lib/airplay/protocol.rb
|
60
62
|
- lib/airplay/protocol/image.rb
|
61
63
|
- lib/airplay/protocol/video.rb
|
62
|
-
- lib/airplay/protocol.rb
|
63
64
|
- lib/airplay/version.rb
|
64
|
-
-
|
65
|
+
- test/discovery.rb
|
66
|
+
- test/fixtures/image.gif
|
67
|
+
- test/helper.rb
|
68
|
+
- test/images.rb
|
69
|
+
- test/video.rb
|
70
|
+
has_rdoc: true
|
65
71
|
homepage: http://github.com/elcuervo/airplay
|
66
72
|
licenses: []
|
67
|
-
|
68
73
|
post_install_message:
|
69
74
|
rdoc_options: []
|
70
|
-
|
71
|
-
require_paths:
|
75
|
+
require_paths:
|
72
76
|
- lib
|
73
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
78
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version:
|
79
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
84
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version:
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
85
89
|
requirements: []
|
86
|
-
|
87
90
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.6.2
|
89
92
|
signing_key:
|
90
93
|
specification_version: 3
|
91
94
|
summary: Airplay client
|
92
95
|
test_files: []
|
93
|
-
|