Class: Samsara::Types::TimeRangeObjectRequestBody

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

Overview

following day.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(days_of_week:, end_time:, start_time:, timezone:, additional_properties: nil) ⇒ Samsara::Types::TimeRangeObjectRequestBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



42
43
44
45
46
47
48
49
# File 'lib/samsara_api/types/time_range_object_request_body.rb', line 42

def initialize(days_of_week:, end_time:, start_time:, timezone:, additional_properties: nil)
  @days_of_week = days_of_week
  @end_time = end_time
  @start_time = start_time
  @timezone = timezone
  @additional_properties = additional_properties
  @_field_set = { "daysOfWeek": days_of_week, "endTime": end_time, "startTime": start_time, "timezone": timezone }
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



25
26
27
# File 'lib/samsara_api/types/time_range_object_request_body.rb', line 25

def additional_properties
  @additional_properties
end

#days_of_weekArray<Samsara::Types::TimeRangeObjectRequestBodyDaysOfWeekItem> (readonly)

Returns Which days this timezone applies to.

Returns:



13
14
15
# File 'lib/samsara_api/types/time_range_object_request_body.rb', line 13

def days_of_week
  @days_of_week
end

#end_timeString (readonly)

Returns The time of day at which the time range starts. In 24 hour kitchen clock format.

Returns:

  • (String)

    The time of day at which the time range starts. In 24 hour kitchen clock format.



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

def end_time
  @end_time
end

#start_timeString (readonly)

Returns The time of day at which the time range starts. In 24 hour kitchen clock format.

Returns:

  • (String)

    The time of day at which the time range starts. In 24 hour kitchen clock format.



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

def start_time
  @start_time
end

#timezoneObject (readonly)



23
24
25
# File 'lib/samsara_api/types/time_range_object_request_body.rb', line 23

def timezone
  @timezone
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/samsara_api/types/time_range_object_request_body.rb', line 54

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  days_of_week = parsed_json["daysOfWeek"]
  end_time = parsed_json["endTime"]
  start_time = parsed_json["startTime"]
  timezone = parsed_json["timezone"]
  new(
    days_of_week: days_of_week,
    end_time: end_time,
    start_time: start_time,
    timezone: timezone,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


81
82
83
84
85
86
# File 'lib/samsara_api/types/time_range_object_request_body.rb', line 81

def self.validate_raw(obj:)
  obj.days_of_week.is_a?(Array) != false || raise("Passed value for field obj.days_of_week is not the expected type, validation failed.")
  obj.end_time.is_a?(String) != false || raise("Passed value for field obj.end_time is not the expected type, validation failed.")
  obj.start_time.is_a?(String) != false || raise("Passed value for field obj.start_time is not the expected type, validation failed.")
  obj.timezone.is_a?(String) != false || raise("Passed value for field obj.timezone is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


72
73
74
# File 'lib/samsara_api/types/time_range_object_request_body.rb', line 72

def to_json
  @_field_set&.to_json
end