class Notifo::NotificationDto
Attributes
The optional body text.
The text for the confirm button.
The tracking url that needs to be invoked to mark the notifiation as confirmed.
The timestamp when the notification has been created.
Optional data, usually a json object.
The id of the notification.
The optional link to the large image.
The optional link to the small image.
True when the notification has been confirmed.
True when the notification has been seen.
The link text.
An optional link.
True when the notification is silent.
The subject of the notification in the language of the user.
The tracking url that needs to be invoked to mark the notifiation as seen.
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/notifo/models/notification_dto.rb, line 62 def self.attribute_map { :'id' => :'id', :'subject' => :'subject', :'silent' => :'silent', :'is_confirmed' => :'isConfirmed', :'is_seen' => :'isSeen', :'created' => :'created', :'body' => :'body', :'image_small' => :'imageSmall', :'image_large' => :'imageLarge', :'tracking_url' => :'trackingUrl', :'link_url' => :'linkUrl', :'link_text' => :'linkText', :'confirm_text' => :'confirmText', :'confirm_url' => :'confirmUrl', :'data' => :'data' } end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/notifo/models/notification_dto.rb, line 274 def self.build_from_hash(attributes) new.build_from_hash(attributes) end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/notifo/models/notification_dto.rb, line 120 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Notifo::NotificationDto` 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 `Notifo::NotificationDto`. 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?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'subject') self.subject = attributes[:'subject'] end if attributes.key?(:'silent') self.silent = attributes[:'silent'] end if attributes.key?(:'is_confirmed') self.is_confirmed = attributes[:'is_confirmed'] end if attributes.key?(:'is_seen') self.is_seen = attributes[:'is_seen'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'body') self.body = attributes[:'body'] end if attributes.key?(:'image_small') self.image_small = attributes[:'image_small'] end if attributes.key?(:'image_large') self.image_large = attributes[:'image_large'] end if attributes.key?(:'tracking_url') self.tracking_url = attributes[:'tracking_url'] end if attributes.key?(:'link_url') self.link_url = attributes[:'link_url'] end if attributes.key?(:'link_text') self.link_text = attributes[:'link_text'] end if attributes.key?(:'confirm_text') self.confirm_text = attributes[:'confirm_text'] end if attributes.key?(:'confirm_url') self.confirm_url = attributes[:'confirm_url'] end if attributes.key?(:'data') self.data = attributes[:'data'] end end
List of attributes with nullable: true
# File lib/notifo/models/notification_dto.rb, line 104 def self.openapi_nullable Set.new([ :'body', :'image_small', :'image_large', :'tracking_url', :'link_url', :'link_text', :'confirm_text', :'confirm_url', :'data' ]) end
Attribute type mapping.
# File lib/notifo/models/notification_dto.rb, line 83 def self.openapi_types { :'id' => :'Object', :'subject' => :'Object', :'silent' => :'Object', :'is_confirmed' => :'Object', :'is_seen' => :'Object', :'created' => :'Object', :'body' => :'Object', :'image_small' => :'Object', :'image_large' => :'Object', :'tracking_url' => :'Object', :'link_url' => :'Object', :'link_text' => :'Object', :'confirm_text' => :'Object', :'confirm_url' => :'Object', :'data' => :'Object' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/notifo/models/notification_dto.rb, line 239 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && subject == o.subject && silent == o.silent && is_confirmed == o.is_confirmed && is_seen == o.is_seen && created == o.created && body == o.body && image_small == o.image_small && image_large == o.image_large && tracking_url == o.tracking_url && link_url == o.link_url && link_text == o.link_text && confirm_text == o.confirm_text && confirm_url == o.confirm_url && data == o.data end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/notifo/models/notification_dto.rb, line 304 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.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 Notifo.const_get(type).build_from_hash(value) end end
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/notifo/models/notification_dto.rb, line 373 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
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/notifo/models/notification_dto.rb, line 281 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if 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]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end
@see the `==` method @param [Object] Object to be compared
# File lib/notifo/models/notification_dto.rb, line 261 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Integer] Hash code
# File lib/notifo/models/notification_dto.rb, line 267 def hash [id, subject, silent, is_confirmed, is_seen, created, body, image_small, image_large, tracking_url, link_url, link_text, confirm_text, confirm_url, data].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/notifo/models/notification_dto.rb, line 196 def list_invalid_properties invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @subject.nil? invalid_properties.push('invalid value for "subject", subject cannot be nil.') end if @silent.nil? invalid_properties.push('invalid value for "silent", silent cannot be nil.') end if @is_confirmed.nil? invalid_properties.push('invalid value for "is_confirmed", is_confirmed cannot be nil.') end if @is_seen.nil? invalid_properties.push('invalid value for "is_seen", is_seen cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/notifo/models/notification_dto.rb, line 355 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/notifo/models/notification_dto.rb, line 343 def to_s to_hash.to_s end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/notifo/models/notification_dto.rb, line 227 def valid? return false if @id.nil? return false if @subject.nil? return false if @silent.nil? return false if @is_confirmed.nil? return false if @is_seen.nil? return false if @created.nil? true end