Class: Podrb::Commands::Dearchive::Runner
- Inherits:
-
BaseRunner
- Object
- BaseRunner
- Podrb::Commands::Dearchive::Runner
- Defined in:
- lib/podrb/commands/dearchive/runner.rb
Instance Method Summary collapse
Methods inherited from BaseRunner
Instance Method Details
#call(episode_id) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/podrb/commands/dearchive/runner.rb', line 7 def call(episode_id) db = Infrastructure::Storage::SQL.new(db: podrb_db_dir) if db.query("select id from episodes where id = #{episode_id}").empty? return build_failure_response(details: :not_found) end sql_code = <<~SQL update episodes set archived_at = null where id = #{episode_id}; SQL db.execute(sql_code) build_success_response(details: :episode_dearchived) end |