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

Move FeedParser to the infrastructure folder #17

Merged
merged 1 commit into from
Nov 6, 2023
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
4 changes: 2 additions & 2 deletions lib/pod/commands/add.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# frozen_string_literal: true

require_relative "../feed_parser"
require_relative "../infrastructure/feed_parser"

module Pod
module Commands
class Add < Base
def call(feed, options = {})
parsed_feed = Pod::FeedParser.call(feed)
parsed_feed = Infrastructure::FeedParser.call(feed)
parsed_options = parse_options(options)

if missing_data?(parsed_feed)
Expand Down
4 changes: 2 additions & 2 deletions lib/pod/commands/sync.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative "../feed_parser"
require_relative "../infrastructure/feed_parser"

module Pod
module Commands
Expand All @@ -10,7 +10,7 @@ def call(podcast_id)
podcast = db.query("select feed from podcasts where id = #{podcast_id}").first
return build_failure_response(details: :not_found) if podcast.nil?

parsed_feed = Pod::FeedParser.call(podcast.feed)
parsed_feed = Infrastructure::FeedParser.call(podcast.feed)
parsed_feed.episodes.each do |e|
db.execute <<-SQL
insert or ignore into episodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
require "net/http"
require "feedjira"

require_relative "infrastructure/dto"
require_relative "dto"

module Pod
module Infrastructure
module FeedParser
def self.call(feed)
content = if File.exist?(feed)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require_relative "../support/test_helpers"
require_relative "../../support/test_helpers"

RSpec.describe Pod::FeedParser do
RSpec.describe Infrastructure::FeedParser do
describe "#call" do
context "when the feed is successfully parsed" do
it "returns a feed entity with the expected data" do
Expand Down