rivendell-api 0.0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/rivendell/api/cart.rb +0 -4
- data/lib/rivendell/api/version.rb +1 -1
- data/lib/rivendell/api/xport.rb +14 -10
- data/spec/fixtures/rdxport_list_carts-single-cart.xml +78 -0
- data/spec/rivendell/api/cart_spec.rb +0 -24
- data/spec/rivendell/api/xport_spec.rb +12 -0
- metadata +156 -148
- data/lib/rivendell-api/version.rb +0 -5
data/.gitignore
CHANGED
data/lib/rivendell/api/cart.rb
CHANGED
data/lib/rivendell/api/xport.rb
CHANGED
@@ -102,26 +102,30 @@ module Rivendell::API
|
|
102
102
|
options[:group_name] ||= options.delete(:group)
|
103
103
|
|
104
104
|
response = post COMMAND_LISTCARTS, options
|
105
|
-
response["cartList"]["cart"].collect do |cart_xml|
|
105
|
+
elements(response["cartList"]["cart"]).collect do |cart_xml|
|
106
106
|
Rivendell::API::Cart.new(cart_xml)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
+
def elements(response)
|
111
|
+
case response
|
112
|
+
when Array
|
113
|
+
response
|
114
|
+
when nil
|
115
|
+
[]
|
116
|
+
else
|
117
|
+
[ response ]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
110
121
|
def remove_cart(cart_number)
|
111
122
|
post COMMAND_REMOVECART, :cart_number => cart_number
|
112
123
|
end
|
113
124
|
|
114
125
|
def list_cuts(cart_number)
|
115
126
|
response = post COMMAND_LISTCUTS, :cart_number => cart_number
|
116
|
-
|
117
|
-
|
118
|
-
cuts_xml.collect do |cut_xml|
|
119
|
-
Rivendell::API::Cut.new(cut_xml)
|
120
|
-
end
|
121
|
-
when nil
|
122
|
-
[]
|
123
|
-
else
|
124
|
-
[ Rivendell::API::Cut.new(cuts_xml) ]
|
127
|
+
elements(response["cutList"]["cut"]).collect do |cut_xml|
|
128
|
+
Rivendell::API::Cut.new cut_xml
|
125
129
|
end
|
126
130
|
end
|
127
131
|
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<cartList>
|
3
|
+
<cart>
|
4
|
+
<number>10037</number>
|
5
|
+
<type>audio</type>
|
6
|
+
<groupName>MUSIC</groupName>
|
7
|
+
<title>Rivendell 1</title>
|
8
|
+
<artist>Trust</artist>
|
9
|
+
<album>AntiBest of</album>
|
10
|
+
<year></year>
|
11
|
+
<label></label>
|
12
|
+
<client></client>
|
13
|
+
<agency></agency>
|
14
|
+
<publisher></publisher>
|
15
|
+
<composer></composer>
|
16
|
+
<userDefined></userDefined>
|
17
|
+
<usageCode>0</usageCode>
|
18
|
+
<forcedLength>0:05:05.8</forcedLength>
|
19
|
+
<averageLength>0:05:05.8</averageLength>
|
20
|
+
<lengthDeviation>0:00:00.0</lengthDeviation>
|
21
|
+
<averageSegueLenth>0:05:05.8</averageSegueLenth>
|
22
|
+
<averageHookLength>0:00:00.0</averageHookLength>
|
23
|
+
<cutQuantity>1</cutQuantity>
|
24
|
+
<lastCutPlayed>0</lastCutPlayed>
|
25
|
+
<validity>2</validity>
|
26
|
+
<enforceLength>false</enforceLength>
|
27
|
+
<asyncronous>false</asyncronous>
|
28
|
+
<owner></owner>
|
29
|
+
<metadataDatetime>Mon, 29 Aug 2011 15:15:56 GMT</metadataDatetime>
|
30
|
+
<cutList>
|
31
|
+
<cut>
|
32
|
+
<cutName>010037_001</cutName>
|
33
|
+
<cartNumber>10037</cartNumber>
|
34
|
+
<cutNumber>1</cutNumber>
|
35
|
+
<evergreen>false</evergreen>
|
36
|
+
<description>Antisocial</description>
|
37
|
+
<outcue></outcue>
|
38
|
+
<isrc></isrc>
|
39
|
+
<isci></isci>
|
40
|
+
<length>305842</length>
|
41
|
+
<originDatetime>Sat, 14 May 2011 09:51:00 GMT</originDatetime>
|
42
|
+
<startDatetime></startDatetime>
|
43
|
+
<endDatetime></endDatetime>
|
44
|
+
<sun>true</sun>
|
45
|
+
<mon>true</mon>
|
46
|
+
<tue>true</tue>
|
47
|
+
<wed>true</wed>
|
48
|
+
<thu>true</thu>
|
49
|
+
<fri>true</fri>
|
50
|
+
<sat>true</sat>
|
51
|
+
<startDaypart></startDaypart>
|
52
|
+
<endDaypart></endDaypart>
|
53
|
+
<originName>hyppo</originName>
|
54
|
+
<weight>1</weight>
|
55
|
+
<lastPlayDatetime>Mon, 29 Aug 2011 19:45:08 GMT</lastPlayDatetime>
|
56
|
+
<playCounter>1</playCounter>
|
57
|
+
<localCounter>1</localCounter>
|
58
|
+
<validity>2</validity>
|
59
|
+
<codingFormat>0</codingFormat>
|
60
|
+
<sampleRate>44100</sampleRate>
|
61
|
+
<bitRate>0</bitRate>
|
62
|
+
<channels>2</channels>
|
63
|
+
<playGain>0</playGain>
|
64
|
+
<startPoint>117</startPoint>
|
65
|
+
<endPoint>305959</endPoint>
|
66
|
+
<fadeupPoint>-1</fadeupPoint>
|
67
|
+
<fadedownPoint>-1</fadedownPoint>
|
68
|
+
<segueStartPoint>-1</segueStartPoint>
|
69
|
+
<segueEndPoint>-1</segueEndPoint>
|
70
|
+
<segueGain>-3000</segueGain>
|
71
|
+
<hookStartPoint>-1</hookStartPoint>
|
72
|
+
<hookEndPoint>-1</hookEndPoint>
|
73
|
+
<talkStartPoint>-1</talkStartPoint>
|
74
|
+
<talkEndPoint>0</talkEndPoint>
|
75
|
+
</cut>
|
76
|
+
</cutList>
|
77
|
+
</cart>
|
78
|
+
</cartList>
|
@@ -2,28 +2,4 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Rivendell::API::Cart do
|
4
4
|
|
5
|
-
describe "has_title?" do
|
6
|
-
|
7
|
-
it "should return false if title is nil" do
|
8
|
-
subject.title = nil
|
9
|
-
subject.should_not have_title
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should return false if title is empty" do
|
13
|
-
subject.title = ""
|
14
|
-
subject.should_not have_title
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should return false if title is '[new cart]'" do
|
18
|
-
subject.title = "[new cart]"
|
19
|
-
subject.should_not have_title
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should return true if title is something else" do
|
23
|
-
subject.title = "dummy"
|
24
|
-
subject.should have_title
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
5
|
end
|
@@ -222,6 +222,18 @@ describe Rivendell::API::Xport do
|
|
222
222
|
FakeWeb.last_request["GROUP_NAME"] == "TEST"
|
223
223
|
end
|
224
224
|
|
225
|
+
context "when a single cart is found" do
|
226
|
+
|
227
|
+
before(:each) do
|
228
|
+
FakeWeb.register_uri(:post, "http://localhost/rd-bin/rdxport.cgi", :body => fixture_content("rdxport_list_carts-single-cart.xml"))
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should return Cast" do
|
232
|
+
subject.list_carts.map(&:title).should == ["Rivendell 1"]
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
225
237
|
end
|
226
238
|
|
227
239
|
describe "#list_cuts" do
|
metadata
CHANGED
@@ -1,158 +1,168 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rivendell-api
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.6'
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Alban Peignier
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
prerelease: false
|
22
|
-
type: :runtime
|
23
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
32
|
-
requirement: *id001
|
12
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
33
15
|
name: httmultiparty
|
34
|
-
|
35
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
36
22
|
type: :runtime
|
37
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 3
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
version: "0"
|
46
|
-
requirement: *id002
|
47
|
-
name: activesupport
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
23
|
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: activesupport
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
50
38
|
type: :runtime
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
version: "0"
|
60
|
-
requirement: *id003
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
61
47
|
name: null_logger
|
62
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
63
55
|
prerelease: false
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
segments:
|
72
|
-
- 0
|
73
|
-
version: "0"
|
74
|
-
requirement: *id004
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
75
63
|
name: simplecov
|
76
|
-
|
77
|
-
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
78
70
|
type: :development
|
79
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
|
-
requirements:
|
82
|
-
- - ">="
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
hash: 3
|
85
|
-
segments:
|
86
|
-
- 0
|
87
|
-
version: "0"
|
88
|
-
requirement: *id005
|
89
|
-
name: rspec
|
90
|
-
- !ruby/object:Gem::Dependency
|
91
71
|
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
92
86
|
type: :development
|
93
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
|
-
requirements:
|
96
|
-
- - ">="
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
hash: 3
|
99
|
-
segments:
|
100
|
-
- 0
|
101
|
-
version: "0"
|
102
|
-
requirement: *id006
|
103
|
-
name: guard
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
87
|
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: guard
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
106
102
|
type: :development
|
107
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
|
-
requirements:
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
hash: 3
|
113
|
-
segments:
|
114
|
-
- 0
|
115
|
-
version: "0"
|
116
|
-
requirement: *id007
|
117
|
-
name: guard-rspec
|
118
|
-
- !ruby/object:Gem::Dependency
|
119
103
|
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: guard-rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
120
118
|
type: :development
|
121
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
|
-
requirements:
|
124
|
-
- - ">="
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
hash: 3
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
version: "0"
|
130
|
-
requirement: *id008
|
131
|
-
name: rake
|
132
|
-
- !ruby/object:Gem::Dependency
|
133
119
|
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rake
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
134
|
type: :development
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
version: "0"
|
144
|
-
requirement: *id009
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
145
143
|
name: fakeweb
|
146
|
-
|
147
|
-
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
description: Use the rdxport interface to retrieve Groups, create/edit/retrieve Carts
|
159
|
+
and Cuts, import Cut sound.
|
160
|
+
email:
|
148
161
|
- alban@tryphon.eu
|
149
162
|
executables: []
|
150
|
-
|
151
163
|
extensions: []
|
152
|
-
|
153
164
|
extra_rdoc_files: []
|
154
|
-
|
155
|
-
files:
|
165
|
+
files:
|
156
166
|
- .gitignore
|
157
167
|
- COPYING
|
158
168
|
- COPYRIGHT
|
@@ -161,7 +171,6 @@ files:
|
|
161
171
|
- README.md
|
162
172
|
- Rakefile
|
163
173
|
- lib/rivendell-api.rb
|
164
|
-
- lib/rivendell-api/version.rb
|
165
174
|
- lib/rivendell/api.rb
|
166
175
|
- lib/rivendell/api/cart.rb
|
167
176
|
- lib/rivendell/api/cut.rb
|
@@ -173,6 +182,7 @@ files:
|
|
173
182
|
- spec/fixtures/rdxport_add_cut.xml
|
174
183
|
- spec/fixtures/rdxport_edit_cart.xml
|
175
184
|
- spec/fixtures/rdxport_import.xml
|
185
|
+
- spec/fixtures/rdxport_list_carts-single-cart.xml
|
176
186
|
- spec/fixtures/rdxport_list_carts.xml
|
177
187
|
- spec/fixtures/rdxport_list_cuts.xml
|
178
188
|
- spec/fixtures/rdxport_list_groups.xml
|
@@ -184,43 +194,41 @@ files:
|
|
184
194
|
- tasks/rspec.rake
|
185
195
|
homepage: http://projects.tryphon.eu/rivendell-api
|
186
196
|
licenses: []
|
187
|
-
|
188
197
|
post_install_message:
|
189
198
|
rdoc_options: []
|
190
|
-
|
191
|
-
require_paths:
|
199
|
+
require_paths:
|
192
200
|
- lib
|
193
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
201
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
194
202
|
none: false
|
195
|
-
requirements:
|
196
|
-
- -
|
197
|
-
- !ruby/object:Gem::Version
|
198
|
-
|
199
|
-
segments:
|
203
|
+
requirements:
|
204
|
+
- - ! '>='
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '0'
|
207
|
+
segments:
|
200
208
|
- 0
|
201
|
-
|
202
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
|
+
hash: 4594079732758632000
|
210
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
211
|
none: false
|
204
|
-
requirements:
|
205
|
-
- -
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
|
208
|
-
segments:
|
212
|
+
requirements:
|
213
|
+
- - ! '>='
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
segments:
|
209
217
|
- 0
|
210
|
-
|
218
|
+
hash: 4594079732758632000
|
211
219
|
requirements: []
|
212
|
-
|
213
220
|
rubyforge_project:
|
214
|
-
rubygems_version: 1.8.
|
221
|
+
rubygems_version: 1.8.23
|
215
222
|
signing_key:
|
216
223
|
specification_version: 3
|
217
224
|
summary: Pilots Rivendell via http/xml API
|
218
|
-
test_files:
|
225
|
+
test_files:
|
219
226
|
- spec/fixtures/empty.wav
|
220
227
|
- spec/fixtures/rdxport_add_cart.xml
|
221
228
|
- spec/fixtures/rdxport_add_cut.xml
|
222
229
|
- spec/fixtures/rdxport_edit_cart.xml
|
223
230
|
- spec/fixtures/rdxport_import.xml
|
231
|
+
- spec/fixtures/rdxport_list_carts-single-cart.xml
|
224
232
|
- spec/fixtures/rdxport_list_carts.xml
|
225
233
|
- spec/fixtures/rdxport_list_cuts.xml
|
226
234
|
- spec/fixtures/rdxport_list_groups.xml
|