Skip to content

Commit

Permalink
Merge pull request #984 from PRX/feat/remove_episode_hrefs
Browse files Browse the repository at this point in the history
Remove episode hrefs
  • Loading branch information
cavis committed Mar 27, 2024
2 parents 8b725ec + 0a8794e commit 90b4745
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 24 deletions.
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

0 comments on commit 90b4745

Please sign in to comment.