Class: Samsara::Types::InAppNotificationOptionsObjectRequestBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/in_app_notification_options_object_request_body.rb

Overview

Options for in-app notifications

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(can_dictate_alert_title: OMIT, can_play_alert_sound: OMIT, custom_text: OMIT, is_enabled:, additional_properties: nil) ⇒ Samsara::Types::InAppNotificationOptionsObjectRequestBody

Parameters:

  • custom_text (String) (defaults to: OMIT)

    Custom text to display in the notification (320 character max).

  • is_enabled (Boolean)

    Whether in-app notifications are enabled.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



35
36
37
38
39
40
41
42
43
44
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 35

def initialize(can_dictate_alert_title: OMIT, can_play_alert_sound: OMIT, custom_text: OMIT, is_enabled:, additional_properties: nil)
  @can_dictate_alert_title = can_dictate_alert_title if can_dictate_alert_title != OMIT
  @can_play_alert_sound = can_play_alert_sound if can_play_alert_sound != OMIT
  @custom_text = custom_text if custom_text != OMIT
  @is_enabled = is_enabled
  @additional_properties = additional_properties
  @_field_set = { "canDictateAlertTitle": can_dictate_alert_title, "canPlayAlertSound": can_play_alert_sound, "customText": custom_text, "isEnabled": is_enabled }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



20
21
22
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 20

def additional_properties
  @additional_properties
end

#can_dictate_alert_titleObject (readonly)

and canPlayAlertSound should be enabled or disabled together.



11
12
13
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 11

def can_dictate_alert_title
  @can_dictate_alert_title
end

#can_play_alert_soundObject (readonly)

canPlayAlertSound should be enabled or disabled together.



14
15
16
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 14

def can_play_alert_sound
  @can_play_alert_sound
end

#custom_textString (readonly)

Returns Custom text to display in the notification (320 character max).

Returns:

  • (String)

    Custom text to display in the notification (320 character max).



16
17
18
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 16

def custom_text
  @custom_text
end

#is_enabledBoolean (readonly)

Returns Whether in-app notifications are enabled.

Returns:

  • (Boolean)

    Whether in-app notifications are enabled.



18
19
20
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 18

def is_enabled
  @is_enabled
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::InAppNotificationOptionsObjectRequestBody

Parameters:

  • json_object (String)

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 50

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  can_dictate_alert_title = parsed_json["canDictateAlertTitle"]
  can_play_alert_sound = parsed_json["canPlayAlertSound"]
  custom_text = parsed_json["customText"]
  is_enabled = parsed_json["isEnabled"]
  new(
    can_dictate_alert_title: can_dictate_alert_title,
    can_play_alert_sound: can_play_alert_sound,
    custom_text: custom_text,
    is_enabled: is_enabled,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


78
79
80
81
82
83
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 78

def self.validate_raw(obj:)
  obj.can_dictate_alert_title&.is_a?(Boolean) != false || raise("Passed value for field obj.can_dictate_alert_title is not the expected type, validation failed.")
  obj.can_play_alert_sound&.is_a?(Boolean) != false || raise("Passed value for field obj.can_play_alert_sound is not the expected type, validation failed.")
  obj.custom_text&.is_a?(String) != false || raise("Passed value for field obj.custom_text is not the expected type, validation failed.")
  obj.is_enabled.is_a?(Boolean) != false || raise("Passed value for field obj.is_enabled is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


69
70
71
# File 'lib/samsara_api/types/in_app_notification_options_object_request_body.rb', line 69

def to_json
  @_field_set&.to_json
end