sdp 0.2.5 → 0.2.6
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.
- data/ChangeLog.rdoc +7 -0
- data/lib/ext/hash_patch.rb +23 -0
- data/lib/sdp.rb +2 -1
- data/lib/sdp/version.rb +1 -1
- data/spec/sdp_spec.rb +26 -26
- metadata +18 -17
data/ChangeLog.rdoc
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
class Hash
|
2
|
+
# Converts keys to Strings. Useful for dealing with +SDP::Parser+ results
|
3
|
+
# (which subclasses +Parslet::Parser+), which returns +Parslet::Slice+ objects
|
4
|
+
# in place of +String+ objects, which isn't helpful in this case.
|
5
|
+
#
|
6
|
+
# @return [Hash] +self+, but with Strings instead of Parslet::Slices.
|
7
|
+
def keys_to_s
|
8
|
+
self.each do |k, v|
|
9
|
+
case v
|
10
|
+
when Hash
|
11
|
+
v.keys_to_s
|
12
|
+
when Array
|
13
|
+
v.each do |element|
|
14
|
+
element.keys_to_s if element.is_a? Hash
|
15
|
+
end
|
16
|
+
else
|
17
|
+
self[k] = v.to_s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
self
|
22
|
+
end
|
23
|
+
end
|
data/lib/sdp.rb
CHANGED
@@ -2,6 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/sdp/version')
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/sdp/description')
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + '/sdp/parser')
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + '/sdp/parse_error')
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + '/ext/hash_patch')
|
5
6
|
|
6
7
|
# The only use for this class is the +#parse+ method, which is in this
|
7
8
|
# base class solely for convenience. Other than this method, this
|
@@ -23,6 +24,6 @@ class SDP
|
|
23
24
|
raise SDP::ParseError, ex
|
24
25
|
end
|
25
26
|
|
26
|
-
SDP::Description.new(sdp_hash)
|
27
|
+
SDP::Description.new(sdp_hash.keys_to_s)
|
27
28
|
end
|
28
29
|
end
|
data/lib/sdp/version.rb
CHANGED
data/spec/sdp_spec.rb
CHANGED
@@ -23,8 +23,8 @@ a=rtpmap:99 h263-1998/90000
|
|
23
23
|
EOF
|
24
24
|
|
25
25
|
describe SDP do
|
26
|
-
it "VERSION is 0.2.
|
27
|
-
SDP.const_get('VERSION').should eql '0.2.
|
26
|
+
it "VERSION is 0.2.6" do
|
27
|
+
SDP.const_get('VERSION').should eql '0.2.6'
|
28
28
|
end
|
29
29
|
|
30
30
|
it "raises when parsing malformed SDP text" do
|
@@ -42,133 +42,133 @@ describe SDP do
|
|
42
42
|
|
43
43
|
it "has a version number of 0" do
|
44
44
|
@parsed_sdp.protocol_version.should == "0"
|
45
|
-
@parsed_sdp.protocol_version.should be_a
|
45
|
+
@parsed_sdp.protocol_version.should be_a String
|
46
46
|
end
|
47
47
|
|
48
48
|
context "origin" do
|
49
49
|
it "has a username of 'jdoe'" do
|
50
50
|
@parsed_sdp.username.should == 'jdoe'
|
51
|
-
@parsed_sdp.username.should be_a
|
51
|
+
@parsed_sdp.username.should be_a String
|
52
52
|
end
|
53
53
|
|
54
54
|
it "has a session_id of '2890844526'" do
|
55
55
|
@parsed_sdp.id.should == "2890844526"
|
56
|
-
@parsed_sdp.id.should be_a
|
56
|
+
@parsed_sdp.id.should be_a String
|
57
57
|
end
|
58
58
|
|
59
59
|
it "has a session_version of '2890842807'" do
|
60
60
|
@parsed_sdp.version.should == '2890842807'
|
61
|
-
@parsed_sdp.version.should be_a
|
61
|
+
@parsed_sdp.version.should be_a String
|
62
62
|
end
|
63
63
|
|
64
64
|
it "has a net_type of 'IN'" do
|
65
65
|
@parsed_sdp.network_type.should == "IN"
|
66
|
-
@parsed_sdp.network_type.should be_a
|
66
|
+
@parsed_sdp.network_type.should be_a String
|
67
67
|
end
|
68
68
|
|
69
69
|
it "has a address_type of 'IP4'" do
|
70
70
|
@parsed_sdp.address_type.should == "IP4"
|
71
|
-
@parsed_sdp.address_type.should be_a
|
71
|
+
@parsed_sdp.address_type.should be_a String
|
72
72
|
end
|
73
73
|
|
74
74
|
it "has a unicast_address of '10.47.16.5'" do
|
75
75
|
@parsed_sdp.unicast_address.should == "10.47.16.5"
|
76
|
-
@parsed_sdp.unicast_address.should be_a
|
76
|
+
@parsed_sdp.unicast_address.should be_a String
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
it "has a session name of 'SDP Seminar'" do
|
81
81
|
@parsed_sdp.name.should == "SDP Seminar"
|
82
|
-
@parsed_sdp.name.should be_a
|
82
|
+
@parsed_sdp.name.should be_a String
|
83
83
|
end
|
84
84
|
|
85
85
|
it "has a session information of 'A Seminar on the session description protocol'" do
|
86
86
|
@parsed_sdp.information.should == "A Seminar on the session description protocol"
|
87
|
-
@parsed_sdp.information.should be_a
|
87
|
+
@parsed_sdp.information.should be_a String
|
88
88
|
end
|
89
89
|
|
90
90
|
it "has a URI of 'http://www.example.com/seminars/sdp.pdf'" do
|
91
91
|
@parsed_sdp.uri.should == "http://www.example.com/seminars/sdp.pdf"
|
92
|
-
@parsed_sdp.uri.should be_a
|
92
|
+
@parsed_sdp.uri.should be_a String
|
93
93
|
end
|
94
94
|
|
95
95
|
it "has an email address of 'j.doe@example.com (Jane Doe)'" do
|
96
96
|
@parsed_sdp.email_address.should == "j.doe@example.com (Jane Doe)"
|
97
|
-
@parsed_sdp.email_address.should be_a
|
97
|
+
@parsed_sdp.email_address.should be_a String
|
98
98
|
end
|
99
99
|
|
100
100
|
it "has a phone number of '+1 617 555-6011'" do
|
101
101
|
@parsed_sdp.phone_number.should == "+1 617 555-6011"
|
102
|
-
@parsed_sdp.phone_number.should be_a
|
102
|
+
@parsed_sdp.phone_number.should be_a String
|
103
103
|
end
|
104
104
|
|
105
105
|
context "bandwidth" do
|
106
106
|
it "has a bandwidth type of 'CT'" do
|
107
107
|
@parsed_sdp.bandwidth_type.should == "CT"
|
108
|
-
@parsed_sdp.bandwidth_type.should be_a
|
108
|
+
@parsed_sdp.bandwidth_type.should be_a String
|
109
109
|
end
|
110
110
|
|
111
111
|
it "has a bandwidth of '1000'" do
|
112
112
|
@parsed_sdp.bandwidth.should == "1000"
|
113
|
-
@parsed_sdp.bandwidth.should be_a
|
113
|
+
@parsed_sdp.bandwidth.should be_a String
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
117
|
context "timing" do
|
118
118
|
it "has a start time of '2873397496'" do
|
119
119
|
@parsed_sdp.start_time.should == '2873397496'
|
120
|
-
@parsed_sdp.start_time.should be_a
|
120
|
+
@parsed_sdp.start_time.should be_a String
|
121
121
|
end
|
122
122
|
|
123
123
|
it "has a stop time of '2873404696'" do
|
124
124
|
@parsed_sdp.stop_time.should == '2873404696'
|
125
|
-
@parsed_sdp.stop_time.should be_a
|
125
|
+
@parsed_sdp.stop_time.should be_a String
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
129
|
context "repeat times" do
|
130
130
|
it "has a repeat interval of '604800'" do
|
131
131
|
@parsed_sdp.repeat_interval.should == '604800'
|
132
|
-
@parsed_sdp.repeat_interval.should be_a
|
132
|
+
@parsed_sdp.repeat_interval.should be_a String
|
133
133
|
end
|
134
134
|
|
135
135
|
it "has an active duration of '3600'" do
|
136
136
|
@parsed_sdp.active_duration.should == '3600'
|
137
|
-
@parsed_sdp.active_duration.should be_a
|
137
|
+
@parsed_sdp.active_duration.should be_a String
|
138
138
|
end
|
139
139
|
|
140
140
|
it "has a offsets from start time of '0 90000'" do
|
141
141
|
@parsed_sdp.offsets_from_start_time.should == '0 90000'
|
142
|
-
@parsed_sdp.offsets_from_start_time.should be_a
|
142
|
+
@parsed_sdp.offsets_from_start_time.should be_a String
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
146
|
context "time zones" do
|
147
147
|
it "has a time zone adjustment of '2882844526'" do
|
148
148
|
@parsed_sdp.time_zones[:adjustment_time].should == '2882844526'
|
149
|
-
@parsed_sdp.time_zones[:adjustment_time].should be_a
|
149
|
+
@parsed_sdp.time_zones[:adjustment_time].should be_a String
|
150
150
|
end
|
151
151
|
|
152
152
|
it "has a time zone offset of '-1h'" do
|
153
153
|
@parsed_sdp.time_zones[:offset].should == '-1h'
|
154
|
-
@parsed_sdp.time_zones[:offset].should be_a
|
154
|
+
@parsed_sdp.time_zones[:offset].should be_a String
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
158
|
context "connection data" do
|
159
159
|
it "has a connection network type of 'IN'" do
|
160
160
|
@parsed_sdp.connection_network_type.should == "IN"
|
161
|
-
@parsed_sdp.connection_network_type.should be_a
|
161
|
+
@parsed_sdp.connection_network_type.should be_a String
|
162
162
|
end
|
163
163
|
|
164
164
|
it "has a addrtype of :IP4" do
|
165
165
|
@parsed_sdp.connection_address_type.should == "IP4"
|
166
|
-
@parsed_sdp.connection_address_type.should be_a
|
166
|
+
@parsed_sdp.connection_address_type.should be_a String
|
167
167
|
end
|
168
168
|
|
169
169
|
it "has a connection address of '224.2.17.12/127'" do
|
170
170
|
@parsed_sdp.connection_address.should == '224.2.17.12/127'
|
171
|
-
@parsed_sdp.connection_address.should be_a
|
171
|
+
@parsed_sdp.connection_address.should be_a String
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parslet
|
16
|
-
requirement: &
|
16
|
+
requirement: &70098175145760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70098175145760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &70098175145200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>'
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70098175145200
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: code_statistics
|
38
|
-
requirement: &
|
38
|
+
requirement: &70098175144700 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.2.13
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70098175144700
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cucumber
|
49
|
-
requirement: &
|
49
|
+
requirement: &70098175144180 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70098175144180
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &70098175143660 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70098175143660
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &70098175143140 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 2.6.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70098175143140
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: simplecov
|
82
|
-
requirement: &
|
82
|
+
requirement: &70098175142640 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.5.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70098175142640
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: yard
|
93
|
-
requirement: &
|
93
|
+
requirement: &70098175142120 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: 0.6.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70098175142120
|
102
102
|
description: ! "This gem allows for parsing SDP (Session Description\n Protocol)
|
103
103
|
information in to a Ruby object, making it easy to read \n and work with that
|
104
104
|
data. It also allows for easily creating SDP objects \n that can be converted
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- features/step_definitions/sdp_get_steps.rb
|
120
120
|
- features/support/env.rb
|
121
121
|
- features/support/sdp_file.txt
|
122
|
+
- lib/ext/hash_patch.rb
|
122
123
|
- lib/sdp/description.rb
|
123
124
|
- lib/sdp/parse_error.rb
|
124
125
|
- lib/sdp/parser.rb
|