7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/podrb/commands/update/runner.rb', line 7
def call(podcast_id, options = {})
parsed_options = parse_options(options)
return build_failure_response(details: :invalid_options) if parsed_options.empty?
db = Infrastructure::Storage::SQL.new(db: podrb_db_dir)
if db.query("select id from podcasts where id = #{podcast_id}").empty?
return build_failure_response(details: :not_found)
end
sql_code = <<~SQL
update podcasts
set feed = '#{options["feed"]}'
where id = #{podcast_id};
SQL
db.execute(sql_code)
build_success_response(details: :podcast_updated)
end
|