Class: OneSignal::StartLiveActivityRequest
- Inherits:
-
Object
- Object
- OneSignal::StartLiveActivityRequest
- Defined in:
- lib/onesignal/models/start_live_activity_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#activity_id ⇒ Object
Set a unique activity_id to track and manage the Live Activity.
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#event ⇒ Object
Returns the value of attribute event.
-
#event_attributes ⇒ Object
Default/static data to initialize the Live Activity upon start.
-
#event_updates ⇒ Object
Dynamic content used to update the running Live Activity at start.
-
#excluded_segments ⇒ Object
Segment names to exclude.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#headings ⇒ Object
Returns the value of attribute headings.
-
#idempotency_key ⇒ Object
Correlation and idempotency key.
-
#include_aliases ⇒ Object
Target specific users by aliases assigned via API.
-
#include_subscription_ids ⇒ Object
Specific subscription ids to target.
-
#included_segments ⇒ Object
Segment names to include.
-
#ios_relevance_score ⇒ Object
iOS 15+.
-
#name ⇒ Object
An internal name to assist with your campaign organization.
-
#priority ⇒ Object
Delivery priority through the push provider (APNs).
-
#stale_date ⇒ Object
Accepts Unix timestamp in seconds.
Class Method Summary collapse
-
.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.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ StartLiveActivityRequest
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ StartLiveActivityRequest
Initializes the object
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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 148 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::StartLiveActivityRequest` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::StartLiveActivityRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'event') self.event = attributes[:'event'] else self.event = 'start' end if attributes.key?(:'activity_id') self.activity_id = attributes[:'activity_id'] end if attributes.key?(:'event_attributes') self.event_attributes = attributes[:'event_attributes'] end if attributes.key?(:'event_updates') self.event_updates = attributes[:'event_updates'] end if attributes.key?(:'contents') self.contents = attributes[:'contents'] end if attributes.key?(:'headings') self.headings = attributes[:'headings'] end if attributes.key?(:'stale_date') self.stale_date = attributes[:'stale_date'] end if attributes.key?(:'priority') self.priority = attributes[:'priority'] end if attributes.key?(:'ios_relevance_score') self.ios_relevance_score = attributes[:'ios_relevance_score'] end if attributes.key?(:'idempotency_key') self.idempotency_key = attributes[:'idempotency_key'] end if attributes.key?(:'include_aliases') if (value = attributes[:'include_aliases']).is_a?(Hash) self.include_aliases = value end end if attributes.key?(:'include_subscription_ids') if (value = attributes[:'include_subscription_ids']).is_a?(Array) self.include_subscription_ids = value end end if attributes.key?(:'included_segments') if (value = attributes[:'included_segments']).is_a?(Array) self.included_segments = value end end if attributes.key?(:'excluded_segments') if (value = attributes[:'excluded_segments']).is_a?(Array) self.excluded_segments = value end end if attributes.key?(:'filters') if (value = attributes[:'filters']).is_a?(Array) self.filters = value end end end |
Instance Attribute Details
#activity_id ⇒ Object
Set a unique activity_id to track and manage the Live Activity.
24 25 26 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 24 def activity_id @activity_id end |
#contents ⇒ Object
Returns the value of attribute contents.
32 33 34 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 32 def contents @contents end |
#event ⇒ Object
Returns the value of attribute event.
21 22 23 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 21 def event @event end |
#event_attributes ⇒ Object
Default/static data to initialize the Live Activity upon start.
27 28 29 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 27 def event_attributes @event_attributes end |
#event_updates ⇒ Object
Dynamic content used to update the running Live Activity at start. Must match the ContentState interface defined in your app.
30 31 32 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 30 def event_updates @event_updates end |
#excluded_segments ⇒ Object
Segment names to exclude. Only compatible with included_segments.
58 59 60 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 58 def excluded_segments @excluded_segments end |
#filters ⇒ Object
Returns the value of attribute filters.
60 61 62 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 60 def filters @filters end |
#headings ⇒ Object
Returns the value of attribute headings.
34 35 36 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 34 def headings @headings end |
#idempotency_key ⇒ Object
Correlation and idempotency key. A request received with this parameter will first look for another notification with the same idempotency key. If one exists, a notification will not be sent, and result of the previous operation will instead be returned. Therefore, if you plan on using this feature, it’s important to use a good source of randomness to generate the UUID passed here. This key is only idempotent for 30 days. After 30 days, the notification could be removed from our system and a notification with the same idempotency key will be sent again. See Idempotent Notification Requests for more details writeOnly: true
46 47 48 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 46 def idempotency_key @idempotency_key end |
#include_aliases ⇒ Object
Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \“external_id\”: [\“exId1\”, \“extId2\”], \“internal_label\”: [\“id1\”, \“id2\”] } Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms.
49 50 51 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 49 def include_aliases @include_aliases end |
#include_subscription_ids ⇒ Object
Specific subscription ids to target. Not compatible with other targeting parameters.
52 53 54 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 52 def include_subscription_ids @include_subscription_ids end |
#included_segments ⇒ Object
Segment names to include. Only compatible with excluded_segments.
55 56 57 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 55 def included_segments @included_segments end |
#ios_relevance_score ⇒ Object
iOS 15+. A score to indicate how a notification should be displayed when grouped. Use a float between 0-1.
43 44 45 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 43 def ios_relevance_score @ios_relevance_score end |
#name ⇒ Object
An internal name to assist with your campaign organization. This does not get displayed in the message itself.
19 20 21 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 19 def name @name end |
#priority ⇒ Object
Delivery priority through the push provider (APNs). Pass 10 for higher priority notifications, or 5 for lower priority notifications. Lower priority notifications are sent based on the power considerations of the end user’s device. If not set, defaults to 10.
40 41 42 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 40 def priority @priority end |
#stale_date ⇒ Object
Accepts Unix timestamp in seconds. When time reaches the configured stale date, the system considers the Live Activity out of date, and the ActivityState of the Live Activity changes to ActivityState.stale.
37 38 39 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 37 def stale_date @stale_date end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
107 108 109 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 107 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 85 def self.attribute_map { :'name' => :'name', :'event' => :'event', :'activity_id' => :'activity_id', :'event_attributes' => :'event_attributes', :'event_updates' => :'event_updates', :'contents' => :'contents', :'headings' => :'headings', :'stale_date' => :'stale_date', :'priority' => :'priority', :'ios_relevance_score' => :'ios_relevance_score', :'idempotency_key' => :'idempotency_key', :'include_aliases' => :'include_aliases', :'include_subscription_ids' => :'include_subscription_ids', :'included_segments' => :'included_segments', :'excluded_segments' => :'excluded_segments', :'filters' => :'filters' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
336 337 338 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 336 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 134 def self.openapi_nullable Set.new([ :'ios_relevance_score', :'idempotency_key', :'include_aliases', :'include_subscription_ids', :'included_segments', :'excluded_segments', :'filters' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 112 def self.openapi_types { :'name' => :'String', :'event' => :'String', :'activity_id' => :'String', :'event_attributes' => :'Object', :'event_updates' => :'Object', :'contents' => :'LanguageStringMap', :'headings' => :'LanguageStringMap', :'stale_date' => :'Integer', :'priority' => :'Integer', :'ios_relevance_score' => :'Float', :'idempotency_key' => :'String', :'include_aliases' => :'Hash<String, Array<String>>', :'include_subscription_ids' => :'Array<String>', :'included_segments' => :'Array<String>', :'excluded_segments' => :'Array<String>', :'filters' => :'Array<FilterExpression>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 300 def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && event == o.event && activity_id == o.activity_id && event_attributes == o.event_attributes && event_updates == o.event_updates && contents == o.contents && headings == o.headings && stale_date == o.stale_date && priority == o.priority && ios_relevance_score == o.ios_relevance_score && idempotency_key == o.idempotency_key && include_aliases == o.include_aliases && include_subscription_ids == o.include_subscription_ids && included_segments == o.included_segments && excluded_segments == o.excluded_segments && filters == o.filters end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 367 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = OneSignal.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 438 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 343 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{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[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
323 324 325 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 323 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
329 330 331 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 329 def hash [name, event, activity_id, event_attributes, event_updates, contents, headings, stale_date, priority, ios_relevance_score, idempotency_key, include_aliases, include_subscription_ids, included_segments, excluded_segments, filters].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 240 def list_invalid_properties invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @event.nil? invalid_properties.push('invalid value for "event", event cannot be nil.') end if @activity_id.nil? invalid_properties.push('invalid value for "activity_id", activity_id cannot be nil.') end if @event_attributes.nil? invalid_properties.push('invalid value for "event_attributes", event_attributes cannot be nil.') end if @event_updates.nil? invalid_properties.push('invalid value for "event_updates", event_updates cannot be nil.') end if @contents.nil? invalid_properties.push('invalid value for "contents", contents cannot be nil.') end if @headings.nil? invalid_properties.push('invalid value for "headings", headings cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
414 415 416 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 414 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 420 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 |
#to_s ⇒ String
Returns the string representation of the object
408 409 410 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 408 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/onesignal/models/start_live_activity_request.rb', line 275 def valid? return false if @name.nil? return false if @event.nil? event_validator = EnumAttributeValidator.new('String', ["start"]) return false unless event_validator.valid?(@event) return false if @activity_id.nil? return false if @event_attributes.nil? return false if @event_updates.nil? return false if @contents.nil? return false if @headings.nil? true end |