Class: Verizon::SchedulesSoftwareUpgradeRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/schedules_software_upgrade_request.rb

Overview

SchedulesSoftwareUpgradeRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(campaign_name = SKIP, software_name = SKIP, software_from = SKIP, software_to = SKIP, distribution_type = SKIP, start_date = SKIP, end_date = SKIP, download_after_date = SKIP, download_time_window_list = SKIP, install_after_date = SKIP, install_time_window_list = SKIP, device_list = SKIP) ⇒ SchedulesSoftwareUpgradeRequest

Returns a new instance of SchedulesSoftwareUpgradeRequest.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 103

def initialize(campaign_name = SKIP, software_name = SKIP,
               software_from = SKIP, software_to = SKIP,
               distribution_type = SKIP, start_date = SKIP, end_date = SKIP,
               download_after_date = SKIP, download_time_window_list = SKIP,
               install_after_date = SKIP, install_time_window_list = SKIP,
               device_list = SKIP)
  @campaign_name = campaign_name unless campaign_name == SKIP
  @software_name = software_name unless software_name == SKIP
  @software_from = software_from unless software_from == SKIP
  @software_to = software_to unless software_to == SKIP
  @distribution_type = distribution_type unless distribution_type == SKIP
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @download_after_date = download_after_date unless download_after_date == SKIP
  unless download_time_window_list == SKIP
    @download_time_window_list =
      download_time_window_list
  end
  @install_after_date = install_after_date unless install_after_date == SKIP
  @install_time_window_list = install_time_window_list unless install_time_window_list == SKIP
  @device_list = device_list unless device_list == SKIP
end

Instance Attribute Details

#campaign_nameString

The campaign name.

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 14

def campaign_name
  @campaign_name
end

#device_listArray[String]

Device IMEI list.

Returns:

  • (Array[String])


60
61
62
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 60

def device_list
  @device_list
end

#distribution_typeString

Valid values

Returns:

  • (String)


30
31
32
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 30

def distribution_type
  @distribution_type
end

#download_after_dateString

Specifies the starting date the client should download the package. If null, client downloads as soon as possible.

Returns:

  • (String)


43
44
45
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 43

def download_after_date
  @download_after_date
end

#download_time_window_listArray[DownloadTimeWindow]

List of allowed download time windows.

Returns:



47
48
49
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 47

def download_time_window_list
  @download_time_window_list
end

#end_dateString

Campaign end date.

Returns:

  • (String)


38
39
40
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 38

def end_date
  @end_date
end

#install_after_dateString

The date after which you install the package. If null, install as soon as possible.

Returns:

  • (String)


52
53
54
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 52

def install_after_date
  @install_after_date
end

#install_time_window_listArray[DownloadTimeWindow]

List of allowed install time windows.

Returns:



56
57
58
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 56

def install_time_window_list
  @install_time_window_list
end

#software_fromString

Old software name.

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 22

def software_from
  @software_from
end

#software_nameString

Software name.

Returns:

  • (String)


18
19
20
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 18

def software_name
  @software_name
end

#software_toString

New software name.

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 26

def software_to
  @software_to
end

#start_dateString

Campaign start date.

Returns:

  • (String)


34
35
36
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 34

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 127

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  campaign_name = hash.key?('campaignName') ? hash['campaignName'] : SKIP
  software_name = hash.key?('softwareName') ? hash['softwareName'] : SKIP
  software_from = hash.key?('softwareFrom') ? hash['softwareFrom'] : SKIP
  software_to = hash.key?('softwareTo') ? hash['softwareTo'] : SKIP
  distribution_type =
    hash.key?('distributionType') ? hash['distributionType'] : SKIP
  start_date = hash.key?('startDate') ? hash['startDate'] : SKIP
  end_date = hash.key?('endDate') ? hash['endDate'] : SKIP
  download_after_date =
    hash.key?('downloadAfterDate') ? hash['downloadAfterDate'] : SKIP
  # Parameter is an array, so we need to iterate through it
  download_time_window_list = nil
  unless hash['downloadTimeWindowList'].nil?
    download_time_window_list = []
    hash['downloadTimeWindowList'].each do |structure|
      download_time_window_list << (DownloadTimeWindow.from_hash(structure) if structure)
    end
  end

  download_time_window_list = SKIP unless hash.key?('downloadTimeWindowList')
  install_after_date =
    hash.key?('installAfterDate') ? hash['installAfterDate'] : SKIP
  # Parameter is an array, so we need to iterate through it
  install_time_window_list = nil
  unless hash['installTimeWindowList'].nil?
    install_time_window_list = []
    hash['installTimeWindowList'].each do |structure|
      install_time_window_list << (DownloadTimeWindow.from_hash(structure) if structure)
    end
  end

  install_time_window_list = SKIP unless hash.key?('installTimeWindowList')
  device_list = hash.key?('deviceList') ? hash['deviceList'] : SKIP

  # Create object from extracted values.
  SchedulesSoftwareUpgradeRequest.new(campaign_name,
                                      software_name,
                                      software_from,
                                      software_to,
                                      distribution_type,
                                      start_date,
                                      end_date,
                                      download_after_date,
                                      download_time_window_list,
                                      install_after_date,
                                      install_time_window_list,
                                      device_list)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['campaign_name'] = 'campaignName'
  @_hash['software_name'] = 'softwareName'
  @_hash['software_from'] = 'softwareFrom'
  @_hash['software_to'] = 'softwareTo'
  @_hash['distribution_type'] = 'distributionType'
  @_hash['start_date'] = 'startDate'
  @_hash['end_date'] = 'endDate'
  @_hash['download_after_date'] = 'downloadAfterDate'
  @_hash['download_time_window_list'] = 'downloadTimeWindowList'
  @_hash['install_after_date'] = 'installAfterDate'
  @_hash['install_time_window_list'] = 'installTimeWindowList'
  @_hash['device_list'] = 'deviceList'
  @_hash
end

.nullablesObject

An array for nullable fields



99
100
101
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 99

def self.nullables
  []
end

.optionalsObject

An array for optional fields



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/verizon/models/schedules_software_upgrade_request.rb', line 81

def self.optionals
  %w[
    campaign_name
    software_name
    software_from
    software_to
    distribution_type
    start_date
    end_date
    download_after_date
    download_time_window_list
    install_after_date
    install_time_window_list
    device_list
  ]
end