Return video_source_url in API V0 Videos index (#11040)
This commit is contained in:
parent
af69812298
commit
d6956180ad
4 changed files with 10 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ module Api
|
|||
before_action :set_cache_control_headers, only: %i[index]
|
||||
|
||||
INDEX_ATTRIBUTES_FOR_SERIALIZATION = %i[
|
||||
id video path title video_thumbnail_url user_id video_duration_in_seconds
|
||||
id video path title video_thumbnail_url user_id video_duration_in_seconds video_source_url
|
||||
].freeze
|
||||
private_constant :INDEX_ATTRIBUTES_FOR_SERIALIZATION
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ json.array! @video_articles do |video_article|
|
|||
:title,
|
||||
:user_id,
|
||||
:video_duration_in_minutes,
|
||||
:video_source_url,
|
||||
)
|
||||
|
||||
json.user do
|
||||
|
|
|
|||
|
|
@ -579,6 +579,7 @@ components:
|
|||
- title
|
||||
- user_id
|
||||
- video_duration_in_minutes
|
||||
- video_source_url
|
||||
- user
|
||||
properties:
|
||||
type_of:
|
||||
|
|
@ -604,6 +605,9 @@ components:
|
|||
If the video duration is below 1 hour, the format will be `mm:ss`,
|
||||
if it's 1 hour or above the format will be `h:mm:ss`.
|
||||
type: string
|
||||
video_source_url:
|
||||
format: url
|
||||
type: string
|
||||
user:
|
||||
type: object
|
||||
properties:
|
||||
|
|
@ -1316,6 +1320,7 @@ components:
|
|||
title: 'BaseCS: Depth First Search Implementing'
|
||||
user_id: 2882
|
||||
video_duration_in_minutes: '11:47'
|
||||
video_source_url: 'https://dw71fyauz7yz9.cloudfront.net/123/123.m3u8'
|
||||
user:
|
||||
name: Vaidehi Joshi
|
||||
|
||||
|
|
|
|||
|
|
@ -51,10 +51,11 @@ RSpec.describe "Api::V0::Videos", type: :request do
|
|||
get api_videos_path
|
||||
|
||||
response_video = response.parsed_body.first
|
||||
expected_keys = %w[type_of id path cloudinary_video_url title user_id video_duration_in_minutes user]
|
||||
expected_keys = %w[type_of id path cloudinary_video_url title user_id video_duration_in_minutes video_source_url
|
||||
user]
|
||||
expect(response_video.keys).to match_array(expected_keys)
|
||||
|
||||
%w[id path cloudinary_video_url title user_id video_duration_in_minutes].each do |attr|
|
||||
%w[id path cloudinary_video_url title user_id video_duration_in_minutes video_source_url].each do |attr|
|
||||
expect(response_video[attr]).to eq(video_article.public_send(attr))
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue