Created
October 2, 2020 03:23
-
-
Save renatodex/a4788e2a754dfb93680c35a70fde0b9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnpublishMovies | |
def call | |
movies_to_unpublish = Movies.where_not( | |
unpublish_at: nil, | |
) | |
series_to_unpublish = Series.where_not( | |
unpublish_at: nil, | |
) | |
shows_to_unpublish = Shows.where_not( | |
unpublish_at: nil, | |
) | |
unpublish_non_podcasts([ | |
movies_to_unpublish, | |
series_to_unpublish, | |
shows_to_unpublish, | |
]) | |
end | |
def unpublish_non_podcasts(non_podcasts) | |
non_podcasts.each do |non_podcast| | |
if non_podcast.unpublish_at <= Time.now | |
non_podcast.unpublish_from_catalog! | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment