Class: Samsara::Types::RecipientObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::RecipientObjectResponseBody
- Defined in:
- lib/samsara_api/types/recipient_object_response_body.rb
Overview
Recipient of an Action. One of userId contactId or roleId needs to be set.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#contact_id ⇒ String
readonly
The ID of the contact.
-
#notification_types ⇒ Array<Samsara::Types::RecipientObjectResponseBodyNotificationTypesItem>
readonly
How the user/contact/role should be notified.
-
#role_id ⇒ String
readonly
The ID of the role.
-
#type ⇒ Samsara::Types::RecipientObjectResponseBodyType
readonly
The type of recipients Valid values: ‘user`, `contact`, `role`.
-
#user_id ⇒ String
readonly
The ID of the user.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(contact_id: OMIT, notification_types: OMIT, role_id: OMIT, type:, user_id: OMIT, additional_properties: nil) ⇒ Samsara::Types::RecipientObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(contact_id: OMIT, notification_types: OMIT, role_id: OMIT, type:, user_id: OMIT, additional_properties: nil) ⇒ Samsara::Types::RecipientObjectResponseBody
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 36 def initialize(contact_id: OMIT, notification_types: OMIT, role_id: OMIT, type:, user_id: OMIT, additional_properties: nil) @contact_id = contact_id if contact_id != OMIT @notification_types = notification_types if notification_types != OMIT @role_id = role_id if role_id != OMIT @type = type @user_id = user_id if user_id != OMIT @additional_properties = additional_properties @_field_set = { "contactId": contact_id, "notificationTypes": notification_types, "roleId": role_id, "type": type, "userId": user_id }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 22 def additional_properties @additional_properties end |
#contact_id ⇒ String (readonly)
Returns The ID of the contact.
12 13 14 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 12 def contact_id @contact_id end |
#notification_types ⇒ Array<Samsara::Types::RecipientObjectResponseBodyNotificationTypesItem> (readonly)
Returns How the user/contact/role should be notified.
14 15 16 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 14 def notification_types @notification_types end |
#role_id ⇒ String (readonly)
Returns The ID of the role.
16 17 18 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 16 def role_id @role_id end |
#type ⇒ Samsara::Types::RecipientObjectResponseBodyType (readonly)
Returns The type of recipients Valid values: ‘user`, `contact`, `role`.
18 19 20 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 18 def type @type end |
#user_id ⇒ String (readonly)
Returns The ID of the user.
20 21 22 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 20 def user_id @user_id end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::RecipientObjectResponseBody
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 51 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) contact_id = parsed_json["contactId"] notification_types = parsed_json["notificationTypes"] role_id = parsed_json["roleId"] type = parsed_json["type"] user_id = parsed_json["userId"] new( contact_id: contact_id, notification_types: notification_types, role_id: role_id, type: type, user_id: user_id, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
80 81 82 83 84 85 86 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 80 def self.validate_raw(obj:) obj.contact_id&.is_a?(String) != false || raise("Passed value for field obj.contact_id is not the expected type, validation failed.") obj.notification_types&.is_a?(Array) != false || raise("Passed value for field obj.notification_types is not the expected type, validation failed.") obj.role_id&.is_a?(String) != false || raise("Passed value for field obj.role_id is not the expected type, validation failed.") obj.type.is_a?(Samsara::Types::RecipientObjectResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
71 72 73 |
# File 'lib/samsara_api/types/recipient_object_response_body.rb', line 71 def to_json @_field_set&.to_json end |