lib/signrequest_client/models/user.rb in signrequest_client-1.0.0 vs lib/signrequest_client/models/user.rb in signrequest_client-1.1.0

- old
+ new

@@ -4,28 +4,26 @@ #API for SignRequest.com OpenAPI spec version: v1 Contact: tech-support@signrequest.com Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.1 +Swagger Codegen version: 2.4.8 =end require 'date' module SignRequestClient - class User attr_accessor :email attr_accessor :first_name attr_accessor :last_name attr_accessor :display_name - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'email' => :'email', :'first_name' => :'first_name', @@ -48,11 +46,11 @@ # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key - attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'email') self.email = attributes[:'email'] end @@ -65,42 +63,41 @@ end if attributes.has_key?(:'display_name') self.display_name = attributes[:'display_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 invalid_properties = Array.new if @email.nil? - invalid_properties.push("invalid value for 'email', email cannot be nil.") + invalid_properties.push('invalid value for "email", email cannot be nil.') end if @email.to_s.length > 254 - invalid_properties.push("invalid value for 'email', the character length must be smaller than or equal to 254.") + invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 254.') end if @email.to_s.length < 1 - invalid_properties.push("invalid value for 'email', the character length must be great than or equal to 1.") + invalid_properties.push('invalid value for "email", the character length must be great than or equal to 1.') end if !@first_name.nil? && @first_name.to_s.length > 255 - invalid_properties.push("invalid value for 'first_name', the character length must be smaller than or equal to 255.") + invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 255.') end if !@last_name.nil? && @last_name.to_s.length > 255 - invalid_properties.push("invalid value for 'last_name', the character length must be smaller than or equal to 255.") + invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 255.') end if !@display_name.nil? && @display_name.to_s.length < 1 - invalid_properties.push("invalid value for 'display_name', the character length must be great than or equal to 1.") + invalid_properties.push('invalid value for "display_name", the character length must be great than or equal to 1.') end - return invalid_properties + invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? @@ -108,59 +105,56 @@ return false if @email.to_s.length > 254 return false if @email.to_s.length < 1 return false if !@first_name.nil? && @first_name.to_s.length > 255 return false if !@last_name.nil? && @last_name.to_s.length > 255 return false if !@display_name.nil? && @display_name.to_s.length < 1 - return true + true end # Custom attribute writer method with validation # @param [Object] email Value to be assigned def email=(email) if email.nil? - fail ArgumentError, "email cannot be nil" + fail ArgumentError, 'email cannot be nil' end if email.to_s.length > 254 - fail ArgumentError, "invalid value for 'email', the character length must be smaller than or equal to 254." + fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 254.' end if email.to_s.length < 1 - fail ArgumentError, "invalid value for 'email', the character length must be great than or equal to 1." + fail ArgumentError, 'invalid value for "email", the character length must be great than or equal to 1.' end @email = email end # Custom attribute writer method with validation # @param [Object] first_name Value to be assigned def first_name=(first_name) - if !first_name.nil? && first_name.to_s.length > 255 - fail ArgumentError, "invalid value for 'first_name', the character length must be smaller than or equal to 255." + fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 255.' end @first_name = first_name end # Custom attribute writer method with validation # @param [Object] last_name Value to be assigned def last_name=(last_name) - if !last_name.nil? && last_name.to_s.length > 255 - fail ArgumentError, "invalid value for 'last_name', the character length must be smaller than or equal to 255." + fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 255.' end @last_name = last_name end # Custom attribute writer method with validation # @param [Object] display_name Value to be assigned def display_name=(display_name) - if !display_name.nil? && display_name.to_s.length < 1 - fail ArgumentError, "invalid value for 'display_name', the character length must be great than or equal to 1." + fail ArgumentError, 'invalid value for "display_name", the character length must be great than or equal to 1.' end @display_name = display_name end @@ -195,11 +189,11 @@ self.class.swagger_types.each_pair do |key, type| 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 attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + 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 # or else data not found in attributes(hash), not an issue as the data can be optional end @@ -277,20 +271,18 @@ # 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 def _to_hash(value) if value.is_a?(Array) - value.compact.map{ |v| _to_hash(v) } + 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 - end - end