Skip to content

Commit

Permalink
Merge pull request #17 from gustavothecoder/move-feed-parser-to-infra…
Browse files Browse the repository at this point in the history
…structure

Move `FeedParser` to the infrastructure folder
  • Loading branch information
gustavothecoder committed Nov 6, 2023
2 parents 9a10bfb + 2d8c1f1 commit 47354b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
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

0 comments on commit 47354b5

Please sign in to comment.