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

#to_hash, #to_json

Constructor Details

#initialize(start_date = nil, end_date = nil, campaign_time_window_list = SKIP) ⇒ V3ChangeCampaignDatesRequest

Returns a new instance of V3ChangeCampaignDatesRequest.



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

def initialize(start_date = nil, end_date = nil,
               campaign_time_window_list = SKIP)
  @start_date = start_date
  @end_date = end_date
  unless campaign_time_window_list == SKIP
    @campaign_time_window_list =
      campaign_time_window_list
  end
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.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/verizon/models/v3_change_campaign_dates_request.rb', line 56

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 object from extracted values.
  V3ChangeCampaignDatesRequest.new(start_date,
                                   end_date,
                                   campaign_time_window_list)
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