lib/svix/models/redshift_config.rb in svix-1.38.0 vs lib/svix/models/redshift_config.rb in svix-1.39.0

- old
+ new

@@ -4,11 +4,11 @@ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 1.1.1 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 5.2.0 +Generator version: 7.9.0 =end require 'date' require 'time' @@ -90,44 +90,55 @@ h[k.to_sym] = v } if attributes.key?(:'access_key_id') self.access_key_id = attributes[:'access_key_id'] + else + self.access_key_id = nil end if attributes.key?(:'cluster_identifier') self.cluster_identifier = attributes[:'cluster_identifier'] + else + self.cluster_identifier = nil end if attributes.key?(:'db_name') self.db_name = attributes[:'db_name'] end if attributes.key?(:'db_user') self.db_user = attributes[:'db_user'] + else + self.db_user = nil end if attributes.key?(:'region') self.region = attributes[:'region'] + else + self.region = nil end if attributes.key?(:'schema_name') self.schema_name = attributes[:'schema_name'] end if attributes.key?(:'secret_access_key') self.secret_access_key = attributes[:'secret_access_key'] + else + self.secret_access_key = nil end if attributes.key?(:'table_name') self.table_name = attributes[:'table_name'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @access_key_id.nil? invalid_properties.push('invalid value for "access_key_id", access_key_id cannot be nil.') end @@ -151,10 +162,11 @@ end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' return false if @access_key_id.nil? return false if @cluster_identifier.nil? return false if @db_user.nil? return false if @region.nil? return false if @secret_access_key.nil? @@ -190,40 +202,34 @@ # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - 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) + 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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[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[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) @@ -254,10 +260,10 @@ end end else # model # models (e.g. Pet) or oneOf klass = Svix.const_get(type) - klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object