Sha256: ae51ce01c840ec160a01f52f6b8f52f2ed7de4adda06cc188dd39cc3a509d1cd
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
# frozen_string_literal: true require "json" module PlanningcenterOrbit module Interactions class Checkin def initialize(event_title:, url:, checkin:, workspace_id:, api_key:) @event_title = event_title @url = url @id = checkin["id"] @created_at = checkin["attributes"]["created_at"] @guest = "#{checkin["attributes"]["first_name"]} #{checkin["attributes"]["last_name"]}" @workspace_id = workspace_id @api_key = api_key after_initialize! end def after_initialize! OrbitActivities::Request.new( api_key: @api_key, workspace_id: @workspace_id, user_agent: "community-ruby-planningcenter-orbit/#{PlanningcenterOrbit::VERSION}", action: "new_activity", body: construct_body.to_json ) end def construct_body { activity: { activity_type: "planning_center:check_in", tags: ["channel:planning_center"], key: @id, title: "New guest check-in for #{@event_title}", description: "#{@guest} checked in for #{@event_title} on Planning Center", occurred_at: @created_at, link: @url, link_text: "Link to Planning Center Event", member: { name: @guest } }, identity: { source: "planning_center", username: @guest.parameterize } } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
planningcenter_orbit-0.0.2 | lib/planningcenter_orbit/interactions/checkin.rb |
planningcenter_orbit-0.0.1 | lib/planningcenter_orbit/interactions/checkin.rb |