Skip to content

Commit c084d81

Browse files
committed
Removing duplicated factory
1 parent 1215b78 commit c084d81

File tree

3 files changed

+8
-44
lines changed

3 files changed

+8
-44
lines changed

app/services/cms/providers/strapi/factories/component_factory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def self.process_component(strapi_data)
2323
when "content-blocks"
2424
ContentBlockFactory.generate_component(name, strapi_data)
2525
when "email-content"
26-
EmailContentFactory.generate_component(name, strapi_data)
26+
EmailComponentFactory.generate_component(name, strapi_data)
2727
end
2828
end
2929
end

app/services/cms/providers/strapi/factories/email_component_factory.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ module Providers
33
module Strapi
44
module Factories
55
module EmailComponentFactory
6-
def self.process_component(strapi_data)
7-
component_name = strapi_data[:__component]
6+
include BaseFactory
7+
def self.generate_component(component_name, strapi_data)
88
case component_name
9-
when "email-content.text"
9+
when "text"
1010
EmailComponents::Text.new(
1111
blocks: strapi_data[:textContent]
1212
)
13-
when "email-content.cta"
13+
when "cta"
1414
EmailComponents::Cta.new(
1515
text: strapi_data[:text],
1616
link: strapi_data[:link]
1717
)
18-
when "email-content.course-list"
18+
when "course-list"
1919
EmailComponents::CourseList.new(
2020
section_title: strapi_data[:sectionTitle],
2121
remove_on_match: strapi_data[:removeOnMatch],
2222
courses: strapi_data[:courses].map do |course|
2323
EmailComponents::Course.new(
2424
activity_code: course[:activityCode],
25-
substitute: strapi_data[:substitute],
26-
display_name: strapi_data[:displayName]
25+
substitute: course[:substitute],
26+
display_name: course[:displayName]
2727
)
2828
end
2929
)

app/services/cms/providers/strapi/factories/email_content_factory.rb

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)