Class: Zernio::AdScheduleWindow
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::AdScheduleWindow
- Defined in:
- lib/zernio-sdk/models/ad_schedule_window.rb
Overview
One ad schedule window as Google stores it. Half-open: it is exclusive of the end minute, so 09:00-12:00 and 12:00-17:00 are adjacent, not overlapping.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#bid_modifier ⇒ Object
Bid adjustment for this window, 0.1-10.0.
-
#criterion_id ⇒ Object
Google campaign criterion id.
-
#day_of_week ⇒ Object
Returns the value of attribute day_of_week.
-
#end_hour ⇒ Object
24 means midnight at the end of the day.
-
#end_minute ⇒ Object
Returns the value of attribute end_minute.
-
#resource_name ⇒ Object
Returns the value of attribute resource_name.
-
#start_hour ⇒ Object
Returns the value of attribute start_hour.
-
#start_minute ⇒ Object
Returns the value of attribute start_minute.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ AdScheduleWindow
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ AdScheduleWindow
Initializes the object
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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 107 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::AdScheduleWindow` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::AdScheduleWindow`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'criterion_id') self.criterion_id = attributes[:'criterion_id'] end if attributes.key?(:'resource_name') self.resource_name = attributes[:'resource_name'] end if attributes.key?(:'day_of_week') self.day_of_week = attributes[:'day_of_week'] end if attributes.key?(:'start_hour') self.start_hour = attributes[:'start_hour'] end if attributes.key?(:'start_minute') self.start_minute = attributes[:'start_minute'] end if attributes.key?(:'end_hour') self.end_hour = attributes[:'end_hour'] end if attributes.key?(:'end_minute') self.end_minute = attributes[:'end_minute'] end if attributes.key?(:'bid_modifier') self.bid_modifier = attributes[:'bid_modifier'] end end |
Instance Attribute Details
#bid_modifier ⇒ Object
Bid adjustment for this window, 0.1-10.0. Null when the window runs at the campaign bid.
36 37 38 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 36 def bid_modifier @bid_modifier end |
#criterion_id ⇒ Object
Google campaign criterion id. Changes whenever the window is rewritten, because Google cannot edit a schedule in place.
20 21 22 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 20 def criterion_id @criterion_id end |
#day_of_week ⇒ Object
Returns the value of attribute day_of_week.
24 25 26 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 24 def day_of_week @day_of_week end |
#end_hour ⇒ Object
24 means midnight at the end of the day.
31 32 33 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 31 def end_hour @end_hour end |
#end_minute ⇒ Object
Returns the value of attribute end_minute.
33 34 35 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 33 def end_minute @end_minute end |
#resource_name ⇒ Object
Returns the value of attribute resource_name.
22 23 24 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 22 def resource_name @resource_name end |
#start_hour ⇒ Object
Returns the value of attribute start_hour.
26 27 28 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 26 def start_hour @start_hour end |
#start_minute ⇒ Object
Returns the value of attribute start_minute.
28 29 30 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 28 def start_minute @start_minute end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
75 76 77 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 75 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
80 81 82 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 80 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 61 def self.attribute_map { :'criterion_id' => :'criterionId', :'resource_name' => :'resourceName', :'day_of_week' => :'dayOfWeek', :'start_hour' => :'startHour', :'start_minute' => :'startMinute', :'end_hour' => :'endHour', :'end_minute' => :'endMinute', :'bid_modifier' => :'bidModifier' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 291 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
99 100 101 102 103 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 99 def self.openapi_nullable Set.new([ :'bid_modifier' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 85 def self.openapi_types { :'criterion_id' => :'String', :'resource_name' => :'String', :'day_of_week' => :'String', :'start_hour' => :'Integer', :'start_minute' => :'Integer', :'end_hour' => :'Integer', :'end_minute' => :'Integer', :'bid_modifier' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 263 def ==(o) return true if self.equal?(o) self.class == o.class && criterion_id == o.criterion_id && resource_name == o.resource_name && day_of_week == o.day_of_week && start_hour == o.start_hour && start_minute == o.start_minute && end_hour == o.end_hour && end_minute == o.end_minute && bid_modifier == o.bid_modifier end |
#eql?(o) ⇒ Boolean
278 279 280 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 278 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
284 285 286 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 284 def hash [criterion_id, resource_name, day_of_week, start_hour, start_minute, end_hour, end_minute, bid_modifier].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 156 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@start_hour.nil? && @start_hour > 23 invalid_properties.push('invalid value for "start_hour", must be smaller than or equal to 23.') end if !@start_hour.nil? && @start_hour < 0 invalid_properties.push('invalid value for "start_hour", must be greater than or equal to 0.') end if !@end_hour.nil? && @end_hour > 24 invalid_properties.push('invalid value for "end_hour", must be smaller than or equal to 24.') end if !@end_hour.nil? && @end_hour < 0 invalid_properties.push('invalid value for "end_hour", must be greater than or equal to 0.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 313 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/zernio-sdk/models/ad_schedule_window.rb', line 180 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' day_of_week_validator = EnumAttributeValidator.new('String', ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"]) return false unless day_of_week_validator.valid?(@day_of_week) return false if !@start_hour.nil? && @start_hour > 23 return false if !@start_hour.nil? && @start_hour < 0 start_minute_validator = EnumAttributeValidator.new('Integer', [0, 15, 30, 45]) return false unless start_minute_validator.valid?(@start_minute) return false if !@end_hour.nil? && @end_hour > 24 return false if !@end_hour.nil? && @end_hour < 0 end_minute_validator = EnumAttributeValidator.new('Integer', [0, 15, 30, 45]) return false unless end_minute_validator.valid?(@end_minute) true end |