Class: MistApi::SiteSettingAutoUpgrade

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/site_setting_auto_upgrade.rb

Overview

Auto Upgrade Settings

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(custom_versions = SKIP, day_of_week = SKIP, enabled = false, time_of_day = SKIP, version = SiteAutoUpgradeVersionEnum::STABLE) ⇒ SiteSettingAutoUpgrade

Returns a new instance of SiteSettingAutoUpgrade.



62
63
64
65
66
67
68
69
70
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 62

def initialize(custom_versions = SKIP, day_of_week = SKIP, enabled = false,
               time_of_day = SKIP,
               version = SiteAutoUpgradeVersionEnum::STABLE)
  @custom_versions = custom_versions unless custom_versions == SKIP
  @day_of_week = day_of_week unless day_of_week == SKIP
  @enabled = enabled unless enabled == SKIP
  @time_of_day = time_of_day unless time_of_day == SKIP
  @version = version unless version == SKIP
end

Instance Attribute Details

#custom_versionsHash[String, String]

Custom versions for different models. Property key is the model name (e.g. “AP41”)

Returns:

  • (Hash[String, String])


15
16
17
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 15

def custom_versions
  @custom_versions
end

#day_of_weekDayOfWeekEnum

enum: ‘any`, `fri`, `mon`, `sat`, `sun`, `thu`, `tue`, `wed`

Returns:



19
20
21
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 19

def day_of_week
  @day_of_week
end

#enabledTrueClass | FalseClass

Whether auto upgrade should happen (Note that Mist may auto-upgrade if the version is not supported)

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 24

def enabled
  @enabled
end

#time_of_dayString

‘any` / HH:MM (24-hour format), upgrade will happen within up to 1-hour from this time

Returns:

  • (String)


29
30
31
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 29

def time_of_day
  @time_of_day
end

#versionSiteAutoUpgradeVersionEnum

desired version. enum: ‘beta`, `custom`, `stable`



33
34
35
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 33

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  custom_versions =
    hash.key?('custom_versions') ? hash['custom_versions'] : SKIP
  day_of_week = hash.key?('day_of_week') ? hash['day_of_week'] : SKIP
  enabled = hash['enabled'] ||= false
  time_of_day = hash.key?('time_of_day') ? hash['time_of_day'] : SKIP
  version = hash['version'] ||= SiteAutoUpgradeVersionEnum::STABLE

  # Create object from extracted values.
  SiteSettingAutoUpgrade.new(custom_versions,
                             day_of_week,
                             enabled,
                             time_of_day,
                             version)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
44
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['custom_versions'] = 'custom_versions'
  @_hash['day_of_week'] = 'day_of_week'
  @_hash['enabled'] = 'enabled'
  @_hash['time_of_day'] = 'time_of_day'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
53
54
55
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 47

def self.optionals
  %w[
    custom_versions
    day_of_week
    enabled
    time_of_day
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
105
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} custom_versions: #{@custom_versions.inspect}, day_of_week:"\
  " #{@day_of_week.inspect}, enabled: #{@enabled.inspect}, time_of_day:"\
  " #{@time_of_day.inspect}, version: #{@version.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
# File 'lib/mist_api/models/site_setting_auto_upgrade.rb', line 93

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} custom_versions: #{@custom_versions}, day_of_week: #{@day_of_week},"\
  " enabled: #{@enabled}, time_of_day: #{@time_of_day}, version: #{@version}>"
end