Class: Samsara::Types::ActionParamsObjectResponseBody

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

Overview

Other action types don’t need to set a param.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver_app_notification: OMIT, recipients: OMIT, webhooks: OMIT, additional_properties: nil) ⇒ Samsara::Types::ActionParamsObjectResponseBody

Parameters:



33
34
35
36
37
38
39
40
41
# File 'lib/samsara_api/types/action_params_object_response_body.rb', line 33

def initialize(driver_app_notification: OMIT, recipients: OMIT, webhooks: OMIT, additional_properties: nil)
  @driver_app_notification = driver_app_notification if driver_app_notification != OMIT
  @recipients = recipients if recipients != OMIT
  @webhooks = webhooks if webhooks != OMIT
  @additional_properties = additional_properties
  @_field_set = { "driverAppNotification": driver_app_notification, "recipients": recipients, "webhooks": webhooks }.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



21
22
23
# File 'lib/samsara_api/types/action_params_object_response_body.rb', line 21

def additional_properties
  @additional_properties
end

#driver_app_notificationSamsara::Types::DriverAppNotificationObjectResponseBody (readonly)



15
16
17
# File 'lib/samsara_api/types/action_params_object_response_body.rb', line 15

def driver_app_notification
  @driver_app_notification
end

#recipientsArray<Samsara::Types::RecipientObjectResponseBody> (readonly)

Returns Recipient of the action.

Returns:



17
18
19
# File 'lib/samsara_api/types/action_params_object_response_body.rb', line 17

def recipients
  @recipients
end

#webhooksSamsara::Types::WebhookParamsObjectResponseBody (readonly)



19
20
21
# File 'lib/samsara_api/types/action_params_object_response_body.rb', line 19

def webhooks
  @webhooks
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/samsara_api/types/action_params_object_response_body.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["driverAppNotification"].nil?
    driver_app_notification = parsed_json["driverAppNotification"].to_json
    driver_app_notification = Samsara::Types::DriverAppNotificationObjectResponseBody.from_json(json_object: driver_app_notification)
  else
    driver_app_notification = nil
  end
  recipients = parsed_json["recipients"]&.map do | item |
  item = item.to_json
  Samsara::Types::RecipientObjectResponseBody.from_json(json_object: item)
end
  unless parsed_json["webhooks"].nil?
    webhooks = parsed_json["webhooks"].to_json
    webhooks = Samsara::Types::WebhookParamsObjectResponseBody.from_json(json_object: webhooks)
  else
    webhooks = nil
  end
  new(
    driver_app_notification: driver_app_notification,
    recipients: recipients,
    webhooks: webhooks,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


84
85
86
87
88
# File 'lib/samsara_api/types/action_params_object_response_body.rb', line 84

def self.validate_raw(obj:)
  obj.driver_app_notification.nil? || Samsara::Types::DriverAppNotificationObjectResponseBody.validate_raw(obj: obj.driver_app_notification)
  obj.recipients&.is_a?(Array) != false || raise("Passed value for field obj.recipients is not the expected type, validation failed.")
  obj.webhooks.nil? || Samsara::Types::WebhookParamsObjectResponseBody.validate_raw(obj: obj.webhooks)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


75
76
77
# File 'lib/samsara_api/types/action_params_object_response_body.rb', line 75

def to_json
  @_field_set&.to_json
end