Class: PlanningcenterOrbit::Interactions::Checkin
- Inherits:
-
Object
- Object
- PlanningcenterOrbit::Interactions::Checkin
- Defined in:
- lib/planningcenter_orbit/interactions/checkin.rb
Instance Method Summary collapse
- #after_initialize! ⇒ Object
- #construct_body ⇒ Object
-
#initialize(event_title:, url:, checkin:, workspace_id:, api_key:) ⇒ Checkin
constructor
A new instance of Checkin.
Constructor Details
#initialize(event_title:, url:, checkin:, workspace_id:, api_key:) ⇒ Checkin
Returns a new instance of Checkin.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/planningcenter_orbit/interactions/checkin.rb', line 8 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 |
Instance Method Details
#after_initialize! ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/planningcenter_orbit/interactions/checkin.rb', line 20 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 |
#construct_body ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/planningcenter_orbit/interactions/checkin.rb', line 30 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 |