Class: Verizon::V3ChangeCampaignDatesRequest

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

Overview

Campaign 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:, campaign_time_window_list: SKIP, additional_properties: nil) ⇒ V3ChangeCampaignDatesRequest

Returns a new instance of V3ChangeCampaignDatesRequest.



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/verizon/models/v3_change_campaign_dates_request.rb', line 45

def initialize(start_date:, end_date:, campaign_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
  unless campaign_time_window_list == SKIP
    @campaign_time_window_list =
      campaign_time_window_list
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#campaign_time_window_listArray[V3TimeWindow]

List of allowed campaign time windows.

Returns:



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

def campaign_time_window_list
  @campaign_time_window_list
end

#end_dateDate

Campaign end date.

Returns:

  • (Date)


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

def end_date
  @end_date
end

#start_dateDate

Campaign start date.

Returns:

  • (Date)


14
15
16
# File 'lib/verizon/models/v3_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.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/verizon/models/v3_change_campaign_dates_request.rb', line 60

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
  # Parameter is an array, so we need to iterate through it
  campaign_time_window_list = nil
  unless hash['campaignTimeWindowList'].nil?
    campaign_time_window_list = []
    hash['campaignTimeWindowList'].each do |structure|
      campaign_time_window_list << (V3TimeWindow.from_hash(structure) if structure)
    end
  end

  campaign_time_window_list = SKIP unless hash.key?('campaignTimeWindowList')

  # 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.
  V3ChangeCampaignDatesRequest.new(start_date: start_date,
                                   end_date: end_date,
                                   campaign_time_window_list: campaign_time_window_list,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/verizon/models/v3_change_campaign_dates_request.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['start_date'] = 'startDate'
  @_hash['end_date'] = 'endDate'
  @_hash['campaign_time_window_list'] = 'campaignTimeWindowList'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/verizon/models/v3_change_campaign_dates_request.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
# File 'lib/verizon/models/v3_change_campaign_dates_request.rb', line 34

def self.optionals
  %w[
    campaign_time_window_list
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



92
93
94
95
96
97
# File 'lib/verizon/models/v3_change_campaign_dates_request.rb', line 92

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