yt 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/lib/yt/associations/has_reports.rb +69 -10
- data/lib/yt/associations/has_viewer_percentages.rb +2 -2
- data/lib/yt/collections/resumable_sessions.rb +1 -1
- data/lib/yt/models/advertising_options_set.rb +0 -5
- data/lib/yt/models/content_detail.rb +4 -18
- data/lib/yt/models/file_detail.rb +0 -6
- data/lib/yt/models/live_streaming_detail.rb +0 -19
- data/lib/yt/models/player.rb +0 -2
- data/lib/yt/models/resource.rb +6 -3
- data/lib/yt/models/snippet.rb +6 -35
- data/lib/yt/models/status.rb +3 -270
- data/lib/yt/models/video.rb +467 -172
- data/lib/yt/request.rb +2 -4
- data/lib/yt/version.rb +1 -1
- data/spec/models/content_detail_spec.rb +0 -48
- data/spec/models/file_detail_spec.rb +0 -21
- data/spec/models/live_streaming_detail_spec.rb +0 -80
- data/spec/models/player_spec.rb +0 -8
- data/spec/models/statistics_set_spec.rb +1 -0
- data/spec/models/status_spec.rb +0 -302
- data/spec/models/video_spec.rb +494 -0
- data/spec/requests/as_account/account_spec.rb +1 -1
- metadata +2 -2
data/lib/yt/request.rb
CHANGED
@@ -33,12 +33,10 @@ module Yt
|
|
33
33
|
# @option options [String] :host The host component of the request URI.
|
34
34
|
# @option options [String] :path The path component of the request URI.
|
35
35
|
# @option options [Hash] :params ({}) The params to use as the query
|
36
|
-
# component of the request URI, for instance the Hash {a: 1, b: 2}
|
36
|
+
# component of the request URI, for instance the Hash +{a: 1, b: 2}+
|
37
37
|
# corresponds to the query parameters "a=1&b=2".
|
38
38
|
# @option options [Hash] :camelize_params (true) whether to transform
|
39
|
-
# each key of params into a camel-case symbol before sending the
|
40
|
-
# request. For instance, if set to true, the params {aBc: 1, d_e: 2,
|
41
|
-
# 'f' => 3} would be sent as {aBc: 1, dE: 2, f: 3}.
|
39
|
+
# each key of params into a camel-case symbol before sending the request.
|
42
40
|
# @option options [Hash] :request_format (:json) The format of the
|
43
41
|
# requesty body. If a request body is passed, it will be parsed
|
44
42
|
# according to this format before sending it in the request.
|
data/lib/yt/version.rb
CHANGED
@@ -42,52 +42,4 @@ describe Yt::ContentDetail do
|
|
42
42
|
it { expect(content_detail.duration).to eq 51 }
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
46
|
-
describe '#stereoscopic?' do
|
47
|
-
context 'given a 3D video' do
|
48
|
-
let(:data) { {"dimension"=>"3d"} }
|
49
|
-
it { expect(content_detail).to be_stereoscopic }
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'given a 2D video' do
|
53
|
-
let(:data) { {"dimension"=>"2d"} }
|
54
|
-
it { expect(content_detail).not_to be_stereoscopic }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '#hd?' do
|
59
|
-
context 'given a high-definition video' do
|
60
|
-
let(:data) { {"definition"=>"hd"} }
|
61
|
-
it { expect(content_detail).to be_hd }
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'given a standard-definition video' do
|
65
|
-
let(:data) { {"definition"=>"sd"} }
|
66
|
-
it { expect(content_detail).not_to be_hd }
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#captioned?' do
|
71
|
-
context 'given a video with captions' do
|
72
|
-
let(:data) { {"caption"=>"true"} }
|
73
|
-
it { expect(content_detail).to be_captioned }
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'given a video without captions' do
|
77
|
-
let(:data) { {"caption"=>"false"} }
|
78
|
-
it { expect(content_detail).not_to be_captioned }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe '#captioned?' do
|
83
|
-
context 'given a video with licensed content' do
|
84
|
-
let(:data) { {"licensedContent"=>true} }
|
85
|
-
it { expect(content_detail).to be_licensed }
|
86
|
-
end
|
87
|
-
|
88
|
-
context 'given a video without licensed content' do
|
89
|
-
let(:data) { {"licensedContent"=>false} }
|
90
|
-
it { expect(content_detail).not_to be_licensed }
|
91
|
-
end
|
92
|
-
end
|
93
45
|
end
|
@@ -10,25 +10,4 @@ describe Yt::FileDetail do
|
|
10
10
|
expect(file_detail.data).to eq data
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
14
|
-
describe '#file_size' do
|
15
|
-
context 'given a video with fileSize' do
|
16
|
-
let(:data) { {"fileSize"=>"8000000"} }
|
17
|
-
it { expect(file_detail.file_size).to be 8_000_000 }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#file_type' do
|
22
|
-
context 'given a video with fileType' do
|
23
|
-
let(:data) { {"fileType"=>"video"} }
|
24
|
-
it { expect(file_detail.file_type).to eq 'video' }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#container' do
|
29
|
-
context 'given a video with container' do
|
30
|
-
let(:data) { {"container"=>"mov"} }
|
31
|
-
it { expect(file_detail.container).to eq 'mov' }
|
32
|
-
end
|
33
|
-
end
|
34
13
|
end
|
@@ -3,84 +3,4 @@ require 'yt/models/live_streaming_detail'
|
|
3
3
|
|
4
4
|
describe Yt::LiveStreamingDetail do
|
5
5
|
subject(:live_streaming_detail) { Yt::LiveStreamingDetail.new data: data }
|
6
|
-
|
7
|
-
describe '#actual_start_time' do
|
8
|
-
context 'given a non-live streaming video' do
|
9
|
-
let(:data) { {} }
|
10
|
-
it { expect(live_streaming_detail.actual_start_time).to be_nil }
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'given a live streaming video that has not started yet' do
|
14
|
-
let(:data) { {"scheduledStartTime"=>"2017-07-10T00:00:00.000Z"} }
|
15
|
-
it { expect(live_streaming_detail.actual_start_time).to be_nil }
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'given a live streaming video that has started' do
|
19
|
-
let(:data) { {"actualStartTime"=>"2014-08-01T17:48:40.678Z"} }
|
20
|
-
it { expect(live_streaming_detail.actual_start_time.year).to be 2014 }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#actual_end_time' do
|
25
|
-
context 'given a non-live streaming video' do
|
26
|
-
let(:data) { {} }
|
27
|
-
it { expect(live_streaming_detail.actual_end_time).to be_nil }
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'given a live streaming video that has not ended yet' do
|
31
|
-
let(:data) { {"scheduledStartTime"=>"2017-07-10T00:00:00.000Z"} }
|
32
|
-
it { expect(live_streaming_detail.actual_end_time).to be_nil }
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'given a live streaming video that has ended' do
|
36
|
-
let(:data) { {"actualEndTime"=>"2014-08-01T17:48:40.678Z"} }
|
37
|
-
it { expect(live_streaming_detail.actual_end_time.year).to be 2014 }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#scheduled_start_time' do
|
42
|
-
context 'given a non-live streaming video' do
|
43
|
-
let(:data) { {} }
|
44
|
-
it { expect(live_streaming_detail.scheduled_start_time).to be_nil }
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'given a live streaming video' do
|
48
|
-
let(:data) { {"scheduledStartTime"=>"2017-07-10T00:00:00.000Z"} }
|
49
|
-
it { expect(live_streaming_detail.scheduled_start_time.year).to be 2017 }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#scheduled_end_time' do
|
54
|
-
context 'given a non-live streaming video' do
|
55
|
-
let(:data) { {} }
|
56
|
-
it { expect(live_streaming_detail.scheduled_end_time).to be_nil }
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'given a live streaming video that broadcasts indefinitely' do
|
60
|
-
let(:data) { {"scheduledStartTime"=>"2017-07-10T00:00:00.000Z"} }
|
61
|
-
it { expect(live_streaming_detail.scheduled_end_time).to be_nil }
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'given a live streaming video with a scheduled ednd' do
|
65
|
-
let(:data) { {"scheduledEndTime"=>"2014-08-01T17:48:40.678Z"} }
|
66
|
-
it { expect(live_streaming_detail.scheduled_end_time.year).to be 2014 }
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#concurrent_viewers' do
|
71
|
-
context 'given a non-live streaming video' do
|
72
|
-
let(:data) { {} }
|
73
|
-
it { expect(live_streaming_detail.concurrent_viewers).to be_nil }
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'given a current live streaming video with viewers' do
|
77
|
-
let(:data) { {"concurrentViewers"=>"1"} }
|
78
|
-
it { expect(live_streaming_detail.concurrent_viewers).to be 1 }
|
79
|
-
end
|
80
|
-
|
81
|
-
context 'given a past live streaming video' do
|
82
|
-
let(:data) { {"actualEndTime"=>"2013-08-01T17:48:40.678Z"} }
|
83
|
-
it { expect(live_streaming_detail.concurrent_viewers).to be_nil }
|
84
|
-
end
|
85
|
-
end
|
86
6
|
end
|
data/spec/models/player_spec.rb
CHANGED
@@ -3,7 +3,6 @@ require 'yt/models/player'
|
|
3
3
|
|
4
4
|
describe Yt::Player do
|
5
5
|
subject(:player) { Yt::Player.new data: data }
|
6
|
-
let(:value) { "<iframe type='text/html' src='http://www.youtube.com/embed/BPNYv0vd78A' width='640' height='360' frameborder='0' allowfullscreen='true'/>" }
|
7
6
|
|
8
7
|
describe '#data' do
|
9
8
|
let(:data) { {"key"=>"value"} }
|
@@ -11,11 +10,4 @@ describe Yt::Player do
|
|
11
10
|
expect(player.data).to eq data
|
12
11
|
end
|
13
12
|
end
|
14
|
-
|
15
|
-
describe '#embed_html' do
|
16
|
-
context 'given a video with embedHtml' do
|
17
|
-
let(:data) { {"embedHtml"=>value} }
|
18
|
-
it { expect(player.embed_html).to be value }
|
19
|
-
end
|
20
|
-
end
|
21
13
|
end
|
data/spec/models/status_spec.rb
CHANGED
@@ -46,306 +46,4 @@ describe Yt::Status do
|
|
46
46
|
it { expect(status).not_to be_unlisted }
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
50
|
-
describe '#deleted?' do
|
51
|
-
context 'given fetching a status returns uploadStatus "deleted"' do
|
52
|
-
let(:data) { {"uploadStatus"=>"deleted"} }
|
53
|
-
it { expect(status).to be_deleted }
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'given fetching a status does not return uploadStatus "deleted"' do
|
57
|
-
let(:data) { {"uploadStatus"=>"uploaded"} }
|
58
|
-
it { expect(status).not_to be_deleted }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe '#failed?' do
|
63
|
-
context 'given fetching a status returns uploadStatus "failed"' do
|
64
|
-
let(:data) { {"uploadStatus"=>"failed"} }
|
65
|
-
it { expect(status).to be_failed }
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'given fetching a status does not return uploadStatus "failed"' do
|
69
|
-
let(:data) { {"uploadStatus"=>"uploaded"} }
|
70
|
-
it { expect(status).not_to be_failed }
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe '#processed?' do
|
75
|
-
context 'given fetching a status returns uploadStatus "processed"' do
|
76
|
-
let(:data) { {"uploadStatus"=>"processed"} }
|
77
|
-
it { expect(status).to be_processed }
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'given fetching a status does not return uploadStatus "processed"' do
|
81
|
-
let(:data) { {"uploadStatus"=>"uploaded"} }
|
82
|
-
it { expect(status).not_to be_processed }
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe '#rejected?' do
|
87
|
-
context 'given fetching a status returns uploadStatus "rejected"' do
|
88
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
89
|
-
it { expect(status).to be_rejected }
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'given fetching a status does not return uploadStatus "rejected"' do
|
93
|
-
let(:data) { {"uploadStatus"=>"uploaded"} }
|
94
|
-
it { expect(status).not_to be_rejected }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe '#uploaded?' do
|
99
|
-
context 'given fetching a status returns uploadStatus "uploaded"' do
|
100
|
-
let(:data) { {"uploadStatus"=>"uploaded"} }
|
101
|
-
it { expect(status).to be_uploading }
|
102
|
-
end
|
103
|
-
|
104
|
-
context 'given fetching a status does not return uploadStatus "uploaded"' do
|
105
|
-
let(:data) { {"uploadStatus"=>"failed"} }
|
106
|
-
it { expect(status).not_to be_uploading }
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
describe '#uses_unsupported_codec?' do
|
111
|
-
context 'given fetching a status returns failureReason "codec"' do
|
112
|
-
let(:data) { {"uploadStatus"=>"failed", "failureReason"=>"codec"} }
|
113
|
-
it { expect(status.uses_unsupported_codec?).to be true }
|
114
|
-
end
|
115
|
-
|
116
|
-
context 'given fetching a status does not return failureReason "codec"' do
|
117
|
-
let(:data) { {"uploadStatus"=>"failed"} }
|
118
|
-
it { expect(status.uses_unsupported_codec?).to be false }
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe '#conversion_failed?' do
|
123
|
-
context 'given fetching a status returns failureReason "conversion"' do
|
124
|
-
let(:data) { {"uploadStatus"=>"failed", "failureReason"=>"conversion"} }
|
125
|
-
it { expect(status).to have_failed_conversion }
|
126
|
-
end
|
127
|
-
|
128
|
-
context 'given fetching a status does not return failureReason "conversion"' do
|
129
|
-
let(:data) { {"uploadStatus"=>"failed"} }
|
130
|
-
it { expect(status).not_to have_failed_conversion }
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe '#empty_file?' do
|
135
|
-
context 'given fetching a status returns failureReason "emptyFile"' do
|
136
|
-
let(:data) { {"uploadStatus"=>"failed", "failureReason"=>"emptyFile"} }
|
137
|
-
it { expect(status).to be_empty }
|
138
|
-
end
|
139
|
-
|
140
|
-
context 'given fetching a status does not return failureReason "emptyFile"' do
|
141
|
-
let(:data) { {"uploadStatus"=>"failed"} }
|
142
|
-
it { expect(status).not_to be_empty }
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
describe '#invalid_file?' do
|
147
|
-
context 'given fetching a status returns failureReason "invalidFile"' do
|
148
|
-
let(:data) { {"uploadStatus"=>"failed", "failureReason"=>"invalidFile"} }
|
149
|
-
it { expect(status).to be_invalid }
|
150
|
-
end
|
151
|
-
|
152
|
-
context 'given fetching a status does not return failureReason "invalidFile"' do
|
153
|
-
let(:data) { {"uploadStatus"=>"failed"} }
|
154
|
-
it { expect(status).not_to be_invalid }
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
describe '#too_small?' do
|
159
|
-
context 'given fetching a status returns failureReason "tooSmall"' do
|
160
|
-
let(:data) { {"uploadStatus"=>"failed", "failureReason"=>"tooSmall"} }
|
161
|
-
it { expect(status).to be_too_small }
|
162
|
-
end
|
163
|
-
|
164
|
-
context 'given fetching a status does not return failureReason "tooSmall"' do
|
165
|
-
let(:data) { {"uploadStatus"=>"failed"} }
|
166
|
-
it { expect(status).not_to be_too_small }
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
describe '#upload_aborted?' do
|
171
|
-
context 'given fetching a status returns failureReason "uploadAborted"' do
|
172
|
-
let(:data) { {"uploadStatus"=>"failed", "failureReason"=>"uploadAborted"} }
|
173
|
-
it { expect(status).to be_aborted }
|
174
|
-
end
|
175
|
-
|
176
|
-
context 'given fetching a status does not return failureReason "uploadAborted"' do
|
177
|
-
let(:data) { {"uploadStatus"=>"failed"} }
|
178
|
-
it { expect(status).not_to be_aborted }
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
describe '#claimed?' do
|
183
|
-
context 'given fetching a status returns rejectionReason "claim"' do
|
184
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"claim"} }
|
185
|
-
it { expect(status).to be_claimed }
|
186
|
-
end
|
187
|
-
|
188
|
-
context 'given fetching a status does not return rejectionReason "claim"' do
|
189
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
190
|
-
it { expect(status).not_to be_claimed }
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
describe '#infringes_copyright?' do
|
195
|
-
context 'given fetching a status returns rejectionReason "copyright"' do
|
196
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"copyright"} }
|
197
|
-
it { expect(status.infringes_copyright?).to be true }
|
198
|
-
end
|
199
|
-
|
200
|
-
context 'given fetching a status does not return rejectionReason "copyright"' do
|
201
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
202
|
-
it { expect(status.infringes_copyright?).to be false }
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
describe '#duplicate?' do
|
207
|
-
context 'given fetching a status returns rejectionReason "duplicate"' do
|
208
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"duplicate"} }
|
209
|
-
it { expect(status).to be_duplicate }
|
210
|
-
end
|
211
|
-
|
212
|
-
context 'given fetching a status does not return rejectionReason "duplicate"' do
|
213
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
214
|
-
it { expect(status).not_to be_duplicate }
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
describe '#inappropriate?' do
|
219
|
-
context 'given fetching a status returns rejectionReason "inappropriate"' do
|
220
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"inappropriate"} }
|
221
|
-
it { expect(status).to be_inappropriate }
|
222
|
-
end
|
223
|
-
|
224
|
-
context 'given fetching a status does not return rejectionReason "inappropriate"' do
|
225
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
226
|
-
it { expect(status).not_to be_inappropriate }
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
describe '#too_long?' do
|
231
|
-
context 'given fetching a status returns rejectionReason "length"' do
|
232
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"length"} }
|
233
|
-
it { expect(status).to be_too_long }
|
234
|
-
end
|
235
|
-
|
236
|
-
context 'given fetching a status does not return rejectionReason "length"' do
|
237
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
238
|
-
it { expect(status).not_to be_too_long }
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
describe '#violates_terms_of_use?' do
|
243
|
-
context 'given fetching a status returns rejectionReason "termsOfUse"' do
|
244
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"termsOfUse"} }
|
245
|
-
it { expect(status.violates_terms_of_use?).to be true }
|
246
|
-
end
|
247
|
-
|
248
|
-
context 'given fetching a status does not return rejectionReason "termsOfUse"' do
|
249
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
250
|
-
it { expect(status.violates_terms_of_use?).to be false }
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
describe '#infringes_trademark?' do
|
255
|
-
context 'given fetching a status returns rejectionReason "trademark"' do
|
256
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"trademark"} }
|
257
|
-
it { expect(status.infringes_trademark?).to be true }
|
258
|
-
end
|
259
|
-
|
260
|
-
context 'given fetching a status does not return rejectionReason "trademark"' do
|
261
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
262
|
-
it { expect(status.infringes_trademark?).to be false }
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
describe '#belongs_to_closed_account?' do
|
267
|
-
context 'given fetching a status returns rejectionReason "uploaderAccountClosed"' do
|
268
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"uploaderAccountClosed"} }
|
269
|
-
it { expect(status.belongs_to_closed_account?).to be true }
|
270
|
-
end
|
271
|
-
|
272
|
-
context 'given fetching a status does not return rejectionReason "uploaderAccountClosed"' do
|
273
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
274
|
-
it { expect(status.belongs_to_closed_account?).to be false }
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
describe '#belongs_to_suspended_account?' do
|
279
|
-
context 'given fetching a status returns rejectionReason "uploaderAccountSuspended"' do
|
280
|
-
let(:data) { {"uploadStatus"=>"rejected", "rejectionReason"=>"uploaderAccountSuspended"} }
|
281
|
-
it { expect(status.belongs_to_suspended_account?).to be true }
|
282
|
-
end
|
283
|
-
|
284
|
-
context 'given fetching a status does not return rejectionReason "uploaderAccountSuspended"' do
|
285
|
-
let(:data) { {"uploadStatus"=>"rejected"} }
|
286
|
-
it { expect(status.belongs_to_suspended_account?).to be false }
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
describe '#scheduled_at and #scheduled' do
|
291
|
-
context 'given fetching a status returns "publishAt"' do
|
292
|
-
let(:data) { {"uploadStatus"=>"uploaded", "privacyStatus"=>"private", "publishAt"=>"2014-04-22T19:14:49.000Z"} }
|
293
|
-
it { expect(status).to be_scheduled }
|
294
|
-
it { expect(status.scheduled_at.year).to be 2014 }
|
295
|
-
end
|
296
|
-
|
297
|
-
context 'given fetching a status does not returns "publishAt"' do
|
298
|
-
let(:data) { {"uploadStatus"=>"uploaded", "privacyStatus"=>"private"} }
|
299
|
-
it { expect(status).not_to be_scheduled }
|
300
|
-
it { expect(status.scheduled_at).not_to be }
|
301
|
-
end
|
302
|
-
end
|
303
|
-
|
304
|
-
describe '#licensed_as_creative_commons?' do
|
305
|
-
context 'given fetching a status returns license "creativeCommon"' do
|
306
|
-
let(:data) { {"uploadStatus"=>"uploaded", "license"=>"creativeCommon"} }
|
307
|
-
it { expect(status).to be_licensed_as_creative_commons }
|
308
|
-
end
|
309
|
-
|
310
|
-
context 'given fetching a status does not return license "creativeCommon"' do
|
311
|
-
let(:data) { {"uploadStatus"=>"uploaded"} }
|
312
|
-
it { expect(status).not_to be_licensed_as_creative_commons }
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
describe '#licensed_as_standard_youtube?' do
|
317
|
-
context 'given fetching a status returns license "youtube"' do
|
318
|
-
let(:data) { {"uploadStatus"=>"uploaded", "license"=>"youtube"} }
|
319
|
-
it { expect(status).to be_licensed_as_standard_youtube }
|
320
|
-
end
|
321
|
-
|
322
|
-
context 'given fetching a status does not return license "youtube"' do
|
323
|
-
let(:data) { {"uploadStatus"=>"uploaded"} }
|
324
|
-
it { expect(status).not_to be_licensed_as_standard_youtube }
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
describe '#embeddable?' do
|
329
|
-
context 'given fetching a status returns "embeddable" true' do
|
330
|
-
let(:data) { {"uploadStatus"=>"uploaded", "embeddable"=>true} }
|
331
|
-
it { expect(status).to be_embeddable }
|
332
|
-
end
|
333
|
-
|
334
|
-
context 'given fetching a status returns "embeddable" false' do
|
335
|
-
let(:data) { {"uploadStatus"=>"uploaded", "embeddable"=>false} }
|
336
|
-
it { expect(status).not_to be_embeddable }
|
337
|
-
end
|
338
|
-
end
|
339
|
-
|
340
|
-
describe '#has_public_stats_viewable?' do
|
341
|
-
context 'given fetching a status returns "publicStatsViewable" true' do
|
342
|
-
let(:data) { {"publicStatsViewable"=>true} }
|
343
|
-
it { expect(status).to have_public_stats_viewable }
|
344
|
-
end
|
345
|
-
|
346
|
-
context 'given fetching a status returns "publicStatsViewable" false' do
|
347
|
-
let(:data) { {"publicStatsViewable"=>false} }
|
348
|
-
it { expect(status).not_to have_public_stats_viewable }
|
349
|
-
end
|
350
|
-
end
|
351
49
|
end
|