Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove episode hrefs #984

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions app/representers/api/episode_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ class Api::EpisodeRepresenter < Api::BaseRepresenter
decorator: Api::MediaResourceRepresenter,
class: MediaResource

# TODO: deprecate
collection :complete_media,
as: :ready_media,
decorator: Api::MediaResourceRepresenter,
class: MediaResource,
writeable: false,
if: ->(_o) { !media_ready? && complete_media? }

property :image, decorator: Api::ImageRepresenter, class: EpisodeImage

def self_url(episode)
Expand Down
7 changes: 1 addition & 6 deletions app/representers/api/media_resource_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ class Api::MediaResourceRepresenter < Roar::Decorator
include Roar::JSON
include HalApi::Representer::FormatKeys

# TODO: uncomment once the readable href is deprecated
# property :href, readable: false
property :href, readable: false
property :file_name
property :mime_type, as: :type
property :file_size, as: :size
property :duration
property :status, writeable: false

# TODO: deprecate
property :href
property :original_url, writeable: false
end
6 changes: 3 additions & 3 deletions test/jobs/publish_feed_job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@

describe "publishing to apple" do
it "does not schedule publishing to apple if there is no apple config" do
assert_equal nil, feed.apple_config
assert_equal nil, job.publish_apple(feed)
assert_nil feed.apple_config
assert_nil job.publish_apple(feed)
end

describe "when the apple config is present" do
Expand All @@ -92,7 +92,7 @@
it "does not schedule publishing to apple if the config is marked as not publishable" do
apple_config.update!(publish_enabled: false)
assert_equal apple_config, feed.apple_config.reload
assert_equal nil, job.publish_apple(feed)
assert_nil job.publish_apple(feed)
end

it "does run the apple publishing if the config is present and marked as publishable" do
Expand Down
8 changes: 3 additions & 5 deletions test/representers/api/episode_representer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@

it "has media with no href" do
assert_equal json["media"].size, 1
# TODO: deprecate
# assert_nil json["media"].first["href"]
# assert_nil json["media"].first["originalUrl"]
assert_nil json["media"].first["href"]
assert_nil json["media"].first["originalUrl"]
assert_equal json["media"].first["fileName"], episode.contents.first.file_name

# TODO: deprecate
# public endpoint never has readyMedia
# assert_nil json["readyMedia"]
assert_nil json["readyMedia"]
end

it "has an audio version" do
Expand Down
3 changes: 1 addition & 2 deletions test/representers/api/media_resource_representer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

it "does not include the href" do
media_resource.stub(:href, "url") do
# TODO: deprecate
# assert_nil representer.as_json["href"]
assert_nil representer.as_json["href"]
end
end

Expand Down
Loading