Class: Samsara::Types::DataUsageResponseObjectResponseBody

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

Overview

30 days.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cellular_data_usage_bytes: OMIT, hotspot_usage_bytes: OMIT, additional_properties: nil) ⇒ Samsara::Types::DataUsageResponseObjectResponseBody

Parameters:

  • cellular_data_usage_bytes (Long) (defaults to: OMIT) —

    Celluar data usage in bytes.

  • hotspot_usage_bytes (Long) (defaults to: OMIT) —

    Wifi hotspot data usage in bytes.

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



26
27
28
29
30
31
32
33
# File 'lib/samsara_api/types/data_usage_response_object_response_body.rb', line 26

def initialize(cellular_data_usage_bytes: OMIT, hotspot_usage_bytes: OMIT, additional_properties: nil)
  @cellular_data_usage_bytes = cellular_data_usage_bytes if cellular_data_usage_bytes != OMIT
  @hotspot_usage_bytes = hotspot_usage_bytes if hotspot_usage_bytes != OMIT
  @additional_properties = additional_properties
  @_field_set = { "cellularDataUsageBytes": cellular_data_usage_bytes, "hotspotUsageBytes": hotspot_usage_bytes }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#cellular_data_usage_bytes ⇒ Long (readonly)

Returns Celluar data usage in bytes.

Returns:

  • (Long) —

    Celluar data usage in bytes.



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

def cellular_data_usage_bytes
  @cellular_data_usage_bytes
end

#hotspot_usage_bytes ⇒ Long (readonly)

Returns Wifi hotspot data usage in bytes.

Returns:

  • (Long) —

    Wifi hotspot data usage in bytes.



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

def hotspot_usage_bytes
  @hotspot_usage_bytes
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/samsara_api/types/data_usage_response_object_response_body.rb', line 38

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  cellular_data_usage_bytes = parsed_json["cellularDataUsageBytes"]
  hotspot_usage_bytes = parsed_json["hotspotUsageBytes"]
  new(
    cellular_data_usage_bytes: cellular_data_usage_bytes,
    hotspot_usage_bytes: hotspot_usage_bytes,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


61
62
63
64
# File 'lib/samsara_api/types/data_usage_response_object_response_body.rb', line 61

def self.validate_raw(obj:)
  obj.cellular_data_usage_bytes&.is_a?(Long) != false || raise("Passed value for field obj.cellular_data_usage_bytes is not the expected type, validation failed.")
  obj.hotspot_usage_bytes&.is_a?(Long) != false || raise("Passed value for field obj.hotspot_usage_bytes is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


52
53
54
# File 'lib/samsara_api/types/data_usage_response_object_response_body.rb', line 52

def to_json
  @_field_set&.to_json
end