Sha256: 9d69e1a90bb301c054a8fea342f5178608fba182f99a62b0c6755bdd420ae51b
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
# frozen_string_literal: true module NotionOrbit class Notion def initialize(params = {}) @orbit_api_key = params.fetch(:orbit_api_key) @orbit_workspace = params.fetch(:orbit_workspace) @notion_api_key = params.fetch(:notion_api_key) @notion_database_id = params.fetch(:notion_database_id) @notion_workspace_slug = params.fetch(:notion_workspace_slug) end def process_notes notion_service = NotionOrbit::Services::Notion.new(notion_api_key: @notion_api_key) orbit_service = NotionOrbit::Services::Orbit.new(orbit_workspace: @orbit_workspace, orbit_api_key: @orbit_api_key) notes = notion_service.notes(database_id: @notion_database_id) notes.each do |note| next if note[:properties][:email].nil? || note[:properties][:email] == "" member_slug = orbit_service.member_slug(email: note[:properties][:email]) next if member_slug == "" || member_slug.nil? NotionOrbit::Orbit.call( type: "note", data: { note: { email: note[:properties][:email], member_slug: member_slug, page_id: note[:properties][:page_id], content: note[:content] } }, orbit_workspace: @orbit_workspace, orbit_api_key: @orbit_api_key, notion_api_key: @notion_api_key ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
notion_orbit-0.0.7 | lib/notion_orbit/notion.rb |