Class: Form::V3

Inherits:
Integration
  • Object
show all
Defined in:
app/models/pager_tree/integrations/form/v3.rb

Constant Summary collapse

OPTIONS =
[
  {key: :form_title, type: :string, default: ""},
  {key: :form_header, type: :string, default: ""},
  {key: :form_instructions, type: :string, default: ""},
  {key: :form_footer_text, type: :string, default: ""},
  {key: :form_footer_link, type: :string, default: ""},
  {key: :form_email_required, type: :boolean, default: false},
  {key: :form_phone_required, type: :boolean, default: false},
  {key: :form_description_required, type: :boolean, default: false},
  {key: :form_urgency_required, type: :boolean, default: false}
]

Instance Method Summary collapse

Instance Method Details

#adapter_actionObject



68
69
70
# File 'app/models/pager_tree/integrations/form/v3.rb', line 68

def adapter_action
  :create
end

#adapter_incoming_can_defer?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/models/pager_tree/integrations/form/v3.rb', line 44

def adapter_incoming_can_defer?
  true
end

#adapter_process_createObject



72
73
74
75
76
77
78
79
80
81
# File 'app/models/pager_tree/integrations/form/v3.rb', line 72

def adapter_process_create
  Alert.new(
    title: _title,
    description: _description,
    urgency: _urgency,
    thirdparty_id: adapter_thirdparty_id,
    dedup_keys: [],
    additional_data: _additional_datums
  )
end

#adapter_response_inactive_subscriptionObject



52
53
54
# File 'app/models/pager_tree/integrations/form/v3.rb', line 52

def adapter_response_inactive_subscription
  adapter_controller&.render(status: :payment_required, json: {code: Rack::Utils.status_code(:payment_required), errors: ["Customer must subscribe service plan to use this integration"]})
end

#adapter_response_maintenance_modeObject



60
61
62
# File 'app/models/pager_tree/integrations/form/v3.rb', line 60

def adapter_response_maintenance_mode
  adapter_controller&.render(status: :service_unavailable, json: {code: Rack::Utils.status_code(:service_unavailable), errors: ["Integration currently in maintenance mode"]})
end

#adapter_response_upgradeObject



56
57
58
# File 'app/models/pager_tree/integrations/form/v3.rb', line 56

def adapter_response_upgrade
  adapter_controller&.render(status: :payment_required, json: {code: Rack::Utils.status_code(:payment_required), errors: ["Customer must upgrade service plan to use this integration"]})
end

#adapter_supports_cnames?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'app/models/pager_tree/integrations/form/v3.rb', line 48

def adapter_supports_cnames?
  true
end

#adapter_supports_incoming?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/pager_tree/integrations/form/v3.rb', line 36

def adapter_supports_incoming?
  true
end

#adapter_supports_outgoing?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/pager_tree/integrations/form/v3.rb', line 40

def adapter_supports_outgoing?
  false
end

#adapter_thirdparty_idObject



64
65
66
# File 'app/models/pager_tree/integrations/form/v3.rb', line 64

def adapter_thirdparty_id
  @adapter_thirdparty_id ||= SecureRandom.uuid
end