Class: Inquirex::DSL::SendEmailBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/inquirex/dsl/send_email_builder.rb

Overview

Collects the fields of a send_email block. Every setter is an explicit builder method — the block form mirrors the step builders (type, question, ...) rather than a keyword-argument hash:

send_email if: not_empty(:email) do
to      "{{email}}"
from    "forms@agentica.group"
subject "Thanks {{name}}"
markdown_text <<~TEXT
  Hi {{name}}, we got your answers:

  {{answers_summary}}
TEXT
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSendEmailBuilder

Returns a new instance of SendEmailBuilder.



23
24
25
# File 'lib/inquirex/dsl/send_email_builder.rb', line 23

def initialize
  @params = {}
end

Instance Attribute Details

#paramsHash{Symbol => Object} (readonly)

Returns collected SendEmail constructor params.

Returns:

  • (Hash{Symbol => Object})

    collected SendEmail constructor params



21
22
23
# File 'lib/inquirex/dsl/send_email_builder.rb', line 21

def params
  @params
end

Instance Method Details

#bcc(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String)

    blind-carbon-copy template



47
48
49
# File 'lib/inquirex/dsl/send_email_builder.rb', line 47

def bcc(value)
  @params[:bcc] = value
end

#cc(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String)

    carbon-copy template



41
42
43
# File 'lib/inquirex/dsl/send_email_builder.rb', line 41

def cc(value)
  @params[:cc] = value
end

#from(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String)

    sender template



35
36
37
# File 'lib/inquirex/dsl/send_email_builder.rb', line 35

def from(value)
  @params[:from] = value
end

#headers(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (Hash)

    extra headers (values support {field})



65
66
67
# File 'lib/inquirex/dsl/send_email_builder.rb', line 65

def headers(value)
  @params[:headers] = value
end

#html(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String, Hash)

    HTML body template or { file: "path" }



83
84
85
# File 'lib/inquirex/dsl/send_email_builder.rb', line 83

def html(value)
  @params[:html] = value
end

#markdown_text(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String, Hash)

    Markdown body template or { file: "path" }



77
78
79
# File 'lib/inquirex/dsl/send_email_builder.rb', line 77

def markdown_text(value)
  @params[:markdown_text] = value
end

#reply_to(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String)

    reply-to template



53
54
55
# File 'lib/inquirex/dsl/send_email_builder.rb', line 53

def reply_to(value)
  @params[:reply_to] = value
end

#subject(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String)

    subject template



59
60
61
# File 'lib/inquirex/dsl/send_email_builder.rb', line 59

def subject(value)
  @params[:subject] = value
end

#text(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String, Hash)

    plain-text body template or { file: "path" }



71
72
73
# File 'lib/inquirex/dsl/send_email_builder.rb', line 71

def text(value)
  @params[:text] = value
end

#to(value) ⇒ void

This method returns an undefined value.

Parameters:

  • value (String)

    recipient template ({field} placeholders allowed)



29
30
31
# File 'lib/inquirex/dsl/send_email_builder.rb', line 29

def to(value)
  @params[:to] = value
end