Class: TypedForm::Webhook
- Inherits:
-
Object
- Object
- TypedForm::Webhook
- Extended by:
- Forwardable
- Defined in:
- lib/typed_form/webhook.rb
Overview
Methods used for handling incoming webhook events with data using the Typeform Webhook JSON schema.
Instance Attribute Summary collapse
-
#raw_json ⇒ String
readonly
Unformatted JSON data from an incoming Typeform Webhook.
Instance Method Summary collapse
-
#form_id ⇒ Integer
Retrieves the Form ID from the Webhook JSON data.
-
#form_response ⇒ Arendelle
An immutable representation of the Webhook JSON form_response field.
-
#form_token ⇒ String
Retrieves the Token from the Webhook JSON data.
-
#initialize(json:) ⇒ Webhook
constructor
Creates a new webhook object from an incoming Typeform Data stream.
- #json ⇒ Object
Constructor Details
#initialize(json:) ⇒ Webhook
Creates a new webhook object from an incoming Typeform Data stream.
25 26 27 |
# File 'lib/typed_form/webhook.rb', line 25 def initialize(json:) @raw_json = json end |
Instance Attribute Details
#raw_json ⇒ String (readonly)
Unformatted JSON data from an incoming Typeform Webhook.
9 10 11 |
# File 'lib/typed_form/webhook.rb', line 9 def raw_json @raw_json end |
Instance Method Details
#form_id ⇒ Integer
Retrieves the Form ID from the Webhook JSON data.
19 |
# File 'lib/typed_form/webhook.rb', line 19 def_delegators :form_response, :form_id |
#form_response ⇒ Arendelle
Returns An immutable representation of the Webhook JSON form_response field.
15 |
# File 'lib/typed_form/webhook.rb', line 15 def_delegators :parsed_json, :form_response |
#form_token ⇒ String
Retrieves the Token from the Webhook JSON data.
36 37 38 |
# File 'lib/typed_form/webhook.rb', line 36 def form_token form_response.token end |
#json ⇒ Object
29 30 31 |
# File 'lib/typed_form/webhook.rb', line 29 def json @_json ||= Util.normalize_spaces(@raw_json).freeze end |