Class: Pinnable::CapturePin

Inherits:
Object
  • Object
show all
Defined in:
app/services/pinnable/capture_pin.rb

Overview

Turns a capture payload into a persisted Pin, stamping the author’s display label (resolved through the host’s ‘user_label`) so the inbox never needs the host’s User.

Instance Method Summary collapse

Constructor Details

#initialize(author:, tenant:, params:) ⇒ CapturePin

Returns a new instance of CapturePin.



5
6
7
8
9
# File 'app/services/pinnable/capture_pin.rb', line 5

def initialize(author:, tenant:, params:)
  @author = author
  @tenant = tenant
  @params = params
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
# File 'app/services/pinnable/capture_pin.rb', line 11

def call
  Pin.create!(
    author:,
    tenant:,
    author_label: Pinnable.config.user_label.call(author),
    url: params[:url],
    body: params[:body],
    anchor:
  )
end