Sha256: fa4952db72e51733ab31589e7eca1657c34c67a88a727a1fa1ff163c88af3243

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

# frozen_string_literal: true

require_relative 'client'
require_relative 'event_adapter'
require 'roko/source/base/report_events'

module Roko
  module Source
    module GoogleCalendar
      # report events from google calendar
      class ReportEvents < Roko::Source::Base::ReportEvents
        def client
          Client.new_client
        end

        def fetch_service_event(client)
          client
            .list_events(
              'primary',
              time_min: DateTime.parse(@start.to_s).rfc3339,
              time_max: DateTime.parse(@end.to_s).rfc3339
            )
            .items
        end

        def to_report_event(event)
          EventAdapter.to_report_event(event)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roko-0.2.1 lib/roko/source/google_calendar/report_events.rb
roko-0.2.0 lib/roko/source/google_calendar/report_events.rb