class AsposeSlidesCloud::Placeholder
Represents placeholder
Attributes
Index.
Orientation.
Shape
link.
Size.
Placeholder
type.
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/aspose_slides_cloud/models/placeholder.rb, line 66 def self.attribute_map super.merge({ :'index' => :'Index', :'orientation' => :'Orientation', :'size' => :'Size', :'type' => :'Type', :'shape' => :'Shape', }) end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/aspose_slides_cloud/models/placeholder.rb, line 89 def initialize(attributes = {}) super if attributes.has_key?(:'Index') self.index = attributes[:'Index'] end if attributes.has_key?(:'Orientation') self.orientation = attributes[:'Orientation'] end if attributes.has_key?(:'Size') self.size = attributes[:'Size'] end if attributes.has_key?(:'Type') self.type = attributes[:'Type'] end if attributes.has_key?(:'Shape') self.shape = attributes[:'Shape'] end end
Attribute type mapping.
# File lib/aspose_slides_cloud/models/placeholder.rb, line 77 def self.swagger_types super.merge({ :'index' => :'Integer', :'orientation' => :'String', :'size' => :'String', :'type' => :'String', :'shape' => :'ResourceUri', }) end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/aspose_slides_cloud/models/placeholder.rb, line 185 def ==(o) return true if self.equal?(o) self.class == o.class && self_uri == o.self_uri && alternate_links == o.alternate_links && index == o.index && orientation == o.orientation && size == o.size && type == o.type && shape == o.shape 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/aspose_slides_cloud/models/placeholder.rb, line 245 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 temp_model = AsposeSlidesCloud.const_get(type).new temp_model.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/aspose_slides_cloud/models/placeholder.rb, line 311 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/aspose_slides_cloud/models/placeholder.rb, line 212 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| mapKey = self.class.attribute_map[key] if !mapKey.nil? val = attributes[mapKey] if val.nil? mapKeyString = mapKey.to_s mapKeyString[0] = mapKeyString[0].downcase mapKey = mapKeyString.to_sym val = attributes[mapKey] end if !val.nil? if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if val.is_a?(Array) self.send("#{key}=", val.map { |v| _deserialize($1, v) }) end else self.send("#{key}=", _deserialize(type, val)) end end end end self end
@see the `==` method @param [Object] Object to be compared
# File lib/aspose_slides_cloud/models/placeholder.rb, line 199 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/aspose_slides_cloud/models/placeholder.rb, line 205 def hash [self_uri, alternate_links, index, orientation, size, type, shape].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/aspose_slides_cloud/models/placeholder.rb, line 115 def list_invalid_properties invalid_properties = super if @index.nil? invalid_properties.push('invalid value for "index", index cannot be nil.') end if @orientation.nil? invalid_properties.push('invalid value for "orientation", orientation cannot be nil.') end if @size.nil? invalid_properties.push('invalid value for "size", size cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end invalid_properties end
Custom attribute writer method checking allowed values (enum). @param [Object] orientation Object to be assigned
# File lib/aspose_slides_cloud/models/placeholder.rb, line 155 def orientation=(orientation) validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical']) unless validator.valid?(orientation) fail ArgumentError, 'invalid value for "orientation", must be one of #{validator.allowable_values}.' end @orientation = orientation end
Custom attribute writer method checking allowed values (enum). @param [Object] size Object to be assigned
# File lib/aspose_slides_cloud/models/placeholder.rb, line 165 def size=(size) validator = EnumAttributeValidator.new('String', ['Full', 'Half', 'Quarter']) unless validator.valid?(size) fail ArgumentError, 'invalid value for "size", must be one of #{validator.allowable_values}.' end @size = size end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/aspose_slides_cloud/models/placeholder.rb, line 297 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/aspose_slides_cloud/models/placeholder.rb, line 285 def to_s to_hash.to_s end
Custom attribute writer method checking allowed values (enum). @param [Object] type Object to be assigned
# File lib/aspose_slides_cloud/models/placeholder.rb, line 175 def type=(type) validator = EnumAttributeValidator.new('String', ['Title', 'Body', 'CenteredTitle', 'Subtitle', 'DateAndTime', 'SlideNumber', 'Footer', 'Header', 'Object', 'Chart', 'Table', 'ClipArt', 'Diagram', 'Media', 'SlideImage', 'Picture']) unless validator.valid?(type) fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.' end @type = type end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/aspose_slides_cloud/models/placeholder.rb, line 138 def valid? return false if !super return false if @index.nil? return false if @orientation.nil? orientation_validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical']) return false unless orientation_validator.valid?(@orientation) return false if @size.nil? size_validator = EnumAttributeValidator.new('String', ['Full', 'Half', 'Quarter']) return false unless size_validator.valid?(@size) return false if @type.nil? type_validator = EnumAttributeValidator.new('String', ['Title', 'Body', 'CenteredTitle', 'Subtitle', 'DateAndTime', 'SlideNumber', 'Footer', 'Header', 'Object', 'Chart', 'Table', 'ClipArt', 'Diagram', 'Media', 'SlideImage', 'Picture']) return false unless type_validator.valid?(@type) true end