Sha256: 47ad31f4e6d3c17e90516ee0305e537857e1aeef7dcbb2d5a73f6521afb27640

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

require 'roko/report_event'
require 'time'

module Roko
  module Source
    module Confluence
      # convert from Confluence event to [Roko::ReportEvent]
      module EventAdapter
        class << self
          # @param event [Hash]
          # @return [Roko::ReportEvent] or nil
          def to_report_event(event)
            created_at = Time.parse(event.metadata.currentuser.lastmodified.version.when)
            url = "#{ENV['CONFLUENCE_URL']}#{event._links.webui}"

            Roko::ReportEvent.new(
              'confluence',
              'document',
              created_at,
              url,
              event.title,
              ''
            )
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roko-0.2.1 lib/roko/source/confluence/event_adapter.rb
roko-0.2.0 lib/roko/source/confluence/event_adapter.rb