Class: Samsara::Types::OrganizationInfoObject

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

Overview

Information about your organization.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(carrier_settings: OMIT, id: OMIT, name: OMIT, additional_properties: nil) ⇒ Samsara::Types::OrganizationInfoObject

Parameters:

  • carrier_settings (Samsara::Types::OrganizationInfoCarrierSettings) (defaults to: OMIT)
  • id (String) (defaults to: OMIT) —

    ID of the organization.

  • name (String) (defaults to: OMIT) —

    Name of organization.

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

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
36
37
# File 'lib/samsara_api/types/organization_info_object.rb', line 29

def initialize(carrier_settings: OMIT, id: OMIT, name: OMIT, additional_properties: nil)
  @carrier_settings = carrier_settings if carrier_settings != OMIT
  @id = id if id != OMIT
  @name = name if name != OMIT
  @additional_properties = additional_properties
  @_field_set = { "carrierSettings": carrier_settings, "id": id, "name": name }.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



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

def additional_properties
  @additional_properties
end

#carrier_settings ⇒ Samsara::Types::OrganizationInfoCarrierSettings (readonly)



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

def carrier_settings
  @carrier_settings
end

#id ⇒ String (readonly)

Returns ID of the organization.

Returns:

  • (String) —

    ID of the organization.



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

def id
  @id
end

#name ⇒ String (readonly)

Returns Name of organization.

Returns:

  • (String) —

    Name of organization.



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

def name
  @name
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/samsara_api/types/organization_info_object.rb', line 42

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["carrierSettings"].nil?
    carrier_settings = parsed_json["carrierSettings"].to_json
    carrier_settings = Samsara::Types::OrganizationInfoCarrierSettings.from_json(json_object: carrier_settings)
  else
    carrier_settings = nil
  end
  id = parsed_json["id"]
  name = parsed_json["name"]
  new(
    carrier_settings: carrier_settings,
    id: id,
    name: name,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


72
73
74
75
76
# File 'lib/samsara_api/types/organization_info_object.rb', line 72

def self.validate_raw(obj:)
  obj.carrier_settings.nil? || Samsara::Types::OrganizationInfoCarrierSettings.validate_raw(obj: obj.carrier_settings)
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


63
64
65
# File 'lib/samsara_api/types/organization_info_object.rb', line 63

def to_json
  @_field_set&.to_json
end