Class: TeslaFleetManagementApi::AddPreconditionScheduleRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb

Overview

AddPreconditionScheduleRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(lat:, lon:, id:, enabled:, days_of_week: SKIP, precondition_time: SKIP, one_time: SKIP, additional_properties: nil) ⇒ AddPreconditionScheduleRequest

Returns a new instance of AddPreconditionScheduleRequest.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 67

def initialize(lat:, lon:, id:, enabled:, days_of_week: SKIP,
               precondition_time: SKIP, one_time: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance

  additional_properties = {} if additional_properties.nil?

  @lat = lat
  @lon = lon
  @id = id
  @days_of_week = days_of_week unless days_of_week == SKIP
  @precondition_time = precondition_time unless precondition_time == SKIP
  @one_time = one_time unless one_time == SKIP
  @enabled = enabled
  @additional_properties = additional_properties
end

Instance Attribute Details

#days_of_weekString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 26

def days_of_week
  @days_of_week
end

#enabledTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


38
39
40
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 38

def enabled
  @enabled
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


22
23
24
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 22

def id
  @id
end

#latFloat

TODO: Write general description for this method

Returns:

  • (Float)


14
15
16
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 14

def lat
  @lat
end

#lonFloat

TODO: Write general description for this method

Returns:

  • (Float)


18
19
20
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 18

def lon
  @lon
end

#one_timeTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 34

def one_time
  @one_time
end

#precondition_timeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


30
31
32
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 30

def precondition_time
  @precondition_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  lat = hash.key?('lat') ? hash['lat'] : nil
  lon = hash.key?('lon') ? hash['lon'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  enabled = hash.key?('enabled') ? hash['enabled'] : nil
  days_of_week = hash.key?('days_of_week') ? hash['days_of_week'] : SKIP
  precondition_time =
    hash.key?('precondition_time') ? hash['precondition_time'] : SKIP
  one_time = hash.key?('one_time') ? hash['one_time'] : SKIP

  # Create a new hash for additional properties, removing known properties.

  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.

  AddPreconditionScheduleRequest.new(lat: lat,
                                     lon: lon,
                                     id: id,
                                     enabled: enabled,
                                     days_of_week: days_of_week,
                                     precondition_time: precondition_time,
                                     one_time: one_time,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['lat'] = 'lat'
  @_hash['lon'] = 'lon'
  @_hash['id'] = 'id'
  @_hash['days_of_week'] = 'days_of_week'
  @_hash['precondition_time'] = 'precondition_time'
  @_hash['one_time'] = 'one_time'
  @_hash['enabled'] = 'enabled'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 54

def self.optionals
  %w[
    days_of_week
    precondition_time
    one_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



124
125
126
127
128
129
130
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 124

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} lat: #{@lat.inspect}, lon: #{@lon.inspect}, id: #{@id.inspect},"\
  " days_of_week: #{@days_of_week.inspect}, precondition_time: #{@precondition_time.inspect},"\
  " one_time: #{@one_time.inspect}, enabled: #{@enabled.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
121
# File 'lib/tesla_fleet_management_api/models/add_precondition_schedule_request.rb', line 116

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} lat: #{@lat}, lon: #{@lon}, id: #{@id}, days_of_week: #{@days_of_week},"\
  " precondition_time: #{@precondition_time}, one_time: #{@one_time}, enabled: #{@enabled},"\
  " additional_properties: #{@additional_properties}>"
end