class NotionOrbit::Interactions::Note

Public Class Methods

new(note:, orbit_api_key:, orbit_workspace:, notion_api_key:) click to toggle source
# File lib/notion_orbit/interactions/note.rb, line 8
def initialize(note:, orbit_api_key:, orbit_workspace:, notion_api_key:)
    @note = note
    @orbit_workspace = orbit_workspace
    @orbit_api_key = orbit_api_key
    @notion_api_key = notion_api_key

    after_initialize!
end

Public Instance Methods

after_initialize!() click to toggle source
# File lib/notion_orbit/interactions/note.rb, line 17
def after_initialize!
    orbit_service = NotionOrbit::Services::Orbit.new(orbit_workspace: @orbit_workspace, orbit_api_key: @orbit_api_key)
    notion_service = NotionOrbit::Services::Notion.new(notion_api_key: @notion_api_key)

    orbit_service.send_note(
        member_slug: @note[:member_slug],
        api_key: @orbit_api_key,
        content: @note[:content]
    )

    notion_service.mark_note_as_synced(@note[:page_id], orbit_note_url(@note[:member_slug]))
end

Private Instance Methods

orbit_note_url(member_slug) click to toggle source
# File lib/notion_orbit/interactions/note.rb, line 32
def orbit_note_url(member_slug)
    "https://app.orbit.love/#{@orbit_workspace}/members/#{member_slug}?type=notes"
end