Class: MediumToWebflow::SyncService
- Inherits:
-
Object
- Object
- MediumToWebflow::SyncService
- Defined in:
- lib/medium_to_webflow/sync_service.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(medium_username:, webflow_api_token:, webflow_collection_id:, field_mappings:) ⇒ SyncService
constructor
A new instance of SyncService.
Constructor Details
#initialize(medium_username:, webflow_api_token:, webflow_collection_id:, field_mappings:) ⇒ SyncService
Returns a new instance of SyncService.
9 10 11 12 13 14 15 |
# File 'lib/medium_to_webflow/sync_service.rb', line 9 def initialize(medium_username:, webflow_api_token:, webflow_collection_id:, field_mappings:) @medium_username = medium_username @webflow_api_token = webflow_api_token @webflow_collection_id = webflow_collection_id @field_mappings = field_mappings @logger = MediumToWebflow.configuration.logger end |
Class Method Details
.call(**args) ⇒ Object
5 6 7 |
# File 'lib/medium_to_webflow/sync_service.rb', line 5 def self.call(**args) new(**args).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/medium_to_webflow/sync_service.rb', line 17 def call @logger.info "Starting Medium to Webflow sync..." @logger.debug "Fetching posts from Medium..." medium_posts = fetch_medium_posts @logger.info "Found #{medium_posts.count} posts to sync" sync_to_webflow(medium_posts) @logger.info "Sync completed successfully!" rescue StandardError => e @logger.error "Sync failed: #{e.message}" @logger.debug e.backtrace.join("\n") if MediumToWebflow.configuration.verbose raise end |