Class: Samsara::Types::WebhookParamsObjectRequestBody
- Inherits:
-
Object
- Object
- Samsara::Types::WebhookParamsObjectRequestBody
- Defined in:
- lib/samsara_api/types/webhook_params_object_request_body.rb
Overview
The webhook configuration for an Action.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#payload_type ⇒ Object
readonly
‘enriched`.
-
#webhook_ids ⇒ Array<String>
readonly
The webhook IDs.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::WebhookParamsObjectRequestBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(payload_type: OMIT, webhook_ids:, additional_properties: nil) ⇒ Samsara::Types::WebhookParamsObjectRequestBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(payload_type: OMIT, webhook_ids:, additional_properties: nil) ⇒ Samsara::Types::WebhookParamsObjectRequestBody
30 31 32 33 34 35 36 37 |
# File 'lib/samsara_api/types/webhook_params_object_request_body.rb', line 30 def initialize(payload_type: OMIT, webhook_ids:, additional_properties: nil) @payload_type = payload_type if payload_type != OMIT @webhook_ids = webhook_ids @additional_properties = additional_properties @_field_set = { "payloadType": payload_type, "webhookIds": webhook_ids }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/samsara_api/types/webhook_params_object_request_body.rb', line 17 def additional_properties @additional_properties end |
#payload_type ⇒ Object (readonly)
‘enriched`
13 14 15 |
# File 'lib/samsara_api/types/webhook_params_object_request_body.rb', line 13 def payload_type @payload_type end |
#webhook_ids ⇒ Array<String> (readonly)
Returns The webhook IDs.
15 16 17 |
# File 'lib/samsara_api/types/webhook_params_object_request_body.rb', line 15 def webhook_ids @webhook_ids end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::WebhookParamsObjectRequestBody
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/samsara_api/types/webhook_params_object_request_body.rb', line 42 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) payload_type = parsed_json["payloadType"] webhook_ids = parsed_json["webhookIds"] new( payload_type: payload_type, webhook_ids: webhook_ids, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
65 66 67 68 |
# File 'lib/samsara_api/types/webhook_params_object_request_body.rb', line 65 def self.validate_raw(obj:) obj.payload_type&.is_a?(Samsara::Types::WebhookParamsObjectRequestBodyPayloadType) != false || raise("Passed value for field obj.payload_type is not the expected type, validation failed.") obj.webhook_ids.is_a?(Array) != false || raise("Passed value for field obj.webhook_ids is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
56 57 58 |
# File 'lib/samsara_api/types/webhook_params_object_request_body.rb', line 56 def to_json @_field_set&.to_json end |