Class: Verizon::V2ChangeCampaignDatesRequest

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

Overview

New dates and time windows.

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(start_date:, end_date:, download_after_date: SKIP, download_time_window_list: SKIP, install_after_date: SKIP, install_time_window_list: SKIP, additional_properties: nil) ⇒ V2ChangeCampaignDatesRequest

Returns a new instance of V2ChangeCampaignDatesRequest.



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

def initialize(start_date:, end_date:, download_after_date: SKIP,
               download_time_window_list: SKIP, install_after_date: SKIP,
               install_time_window_list: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @start_date = start_date
  @end_date = end_date
  @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
  @additional_properties = additional_properties
end

Instance Attribute Details

#download_after_dateDate

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

Returns:

  • (Date)


23
24
25
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 23

def download_after_date
  @download_after_date
end

#download_time_window_listArray[V2TimeWindow]

List of allowed download time windows. Removing of existing windows is not allowed.

Returns:



28
29
30
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 28

def download_time_window_list
  @download_time_window_list
end

#end_dateDate

Campaign end date.

Returns:

  • (Date)


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

def end_date
  @end_date
end

#install_after_dateDate

Client will install package after date. If null, client will install as soon as possible.

Returns:

  • (Date)


33
34
35
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 33

def install_after_date
  @install_after_date
end

#install_time_window_listArray[V2TimeWindow]

List of allowed install time windows. Removing of existing windows is not allowed.

Returns:



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

def install_time_window_list
  @install_time_window_list
end

#start_dateDate

Campaign start date.

Returns:

  • (Date)


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

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  start_date = hash.key?('startDate') ? hash['startDate'] : nil
  end_date = hash.key?('endDate') ? hash['endDate'] : nil
  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 << (V2TimeWindow.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 << (V2TimeWindow.from_hash(structure) if structure)
    end
  end

  install_time_window_list = SKIP unless hash.key?('installTimeWindowList')

  # 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.
  V2ChangeCampaignDatesRequest.new(start_date: start_date,
                                   end_date: end_date,
                                   download_after_date: download_after_date,
                                   download_time_window_list: download_time_window_list,
                                   install_after_date: install_after_date,
                                   install_time_window_list: install_time_window_list,
                                   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
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_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
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 53

def self.optionals
  %w[
    download_after_date
    download_time_window_list
    install_after_date
    install_time_window_list
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



144
145
146
147
148
149
150
151
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 144

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect},"\
  " download_after_date: #{@download_after_date.inspect}, download_time_window_list:"\
  " #{@download_time_window_list.inspect}, install_after_date: #{@install_after_date.inspect},"\
  " install_time_window_list: #{@install_time_window_list.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



135
136
137
138
139
140
141
# File 'lib/verizon/models/v2_change_campaign_dates_request.rb', line 135

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} start_date: #{@start_date}, end_date: #{@end_date}, download_after_date:"\
  " #{@download_after_date}, download_time_window_list: #{@download_time_window_list},"\
  " install_after_date: #{@install_after_date}, install_time_window_list:"\
  " #{@install_time_window_list}, additional_properties: #{@additional_properties}>"
end