lib/bandwidth-sdk/models/create_call.rb in bandwidth-sdk-11.0.0.pre.beta.2.0 vs lib/bandwidth-sdk/models/create_call.rb in bandwidth-sdk-11.0.0.pre.beta.3.0

- old
+ new

@@ -4,11 +4,11 @@ #Bandwidth's Communication APIs The version of the OpenAPI document: 1.0.0 Contact: letstalk@bandwidth.com Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.5.0 +OpenAPI Generator version: 7.0.0-SNAPSHOT =end require 'date' require 'time' @@ -180,26 +180,34 @@ h[k.to_sym] = v } if attributes.key?(:'to') self.to = attributes[:'to'] + else + self.to = nil end if attributes.key?(:'from') self.from = attributes[:'from'] + else + self.from = nil end if attributes.key?(:'uui') self.uui = attributes[:'uui'] end if attributes.key?(:'application_id') self.application_id = attributes[:'application_id'] + else + self.application_id = nil end if attributes.key?(:'answer_url') self.answer_url = attributes[:'answer_url'] + else + self.answer_url = nil end if attributes.key?(:'answer_method') self.answer_method = attributes[:'answer_method'] else @@ -270,10 +278,11 @@ 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 @to.nil? invalid_properties.push('invalid value for "to", to cannot be nil.') end @@ -349,10 +358,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 @to.nil? return false if @from.nil? return false if @application_id.nil? return false if @answer_url.nil? return false if @answer_url.to_s.length > 2048 @@ -538,40 +548,33 @@ # 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) 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) + 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)