=begin #Domains #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.2.3 =end require 'date' module Hubspot module Cms module Domains class DomainCdnConfig attr_accessor :portal_id attr_accessor :created attr_accessor :updated attr_accessor :domain_id attr_accessor :cert_id attr_accessor :cert_expiration_date attr_accessor :cdn_id attr_accessor :cdn_group_id attr_accessor :ssl_status attr_accessor :validation_method attr_accessor :http_body attr_accessor :http_url_path attr_accessor :cname attr_accessor :cname_target attr_accessor :minimum_tls_version attr_accessor :alternate_origin_hostname attr_accessor :id class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values def initialize(datatype, allowable_values) @allowable_values = allowable_values.map do |value| case datatype.to_s when /Integer/i value.to_i when /Float/i value.to_f else value end end end def valid?(value) !value || allowable_values.include?(value) end end # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'portal_id' => :'portalId', :'created' => :'created', :'updated' => :'updated', :'domain_id' => :'domainId', :'cert_id' => :'certId', :'cert_expiration_date' => :'certExpirationDate', :'cdn_id' => :'cdnId', :'cdn_group_id' => :'cdnGroupId', :'ssl_status' => :'sslStatus', :'validation_method' => :'validationMethod', :'http_body' => :'httpBody', :'http_url_path' => :'httpUrlPath', :'cname' => :'cname', :'cname_target' => :'cnameTarget', :'minimum_tls_version' => :'minimumTlsVersion', :'alternate_origin_hostname' => :'alternateOriginHostname', :'id' => :'id' } end # Attribute type mapping. def self.openapi_types { :'portal_id' => :'Integer', :'created' => :'Integer', :'updated' => :'Integer', :'domain_id' => :'Integer', :'cert_id' => :'Integer', :'cert_expiration_date' => :'Integer', :'cdn_id' => :'String', :'cdn_group_id' => :'String', :'ssl_status' => :'String', :'validation_method' => :'String', :'http_body' => :'String', :'http_url_path' => :'String', :'cname' => :'String', :'cname_target' => :'String', :'minimum_tls_version' => :'String', :'alternate_origin_hostname' => :'String', :'id' => :'Integer' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Cms::Domains::DomainCdnConfig` 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 `Hubspot::Cms::Domains::DomainCdnConfig`. 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?(:'portal_id') self.portal_id = attributes[:'portal_id'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'updated') self.updated = attributes[:'updated'] end if attributes.key?(:'domain_id') self.domain_id = attributes[:'domain_id'] end if attributes.key?(:'cert_id') self.cert_id = attributes[:'cert_id'] end if attributes.key?(:'cert_expiration_date') self.cert_expiration_date = attributes[:'cert_expiration_date'] end if attributes.key?(:'cdn_id') self.cdn_id = attributes[:'cdn_id'] end if attributes.key?(:'cdn_group_id') self.cdn_group_id = attributes[:'cdn_group_id'] end if attributes.key?(:'ssl_status') self.ssl_status = attributes[:'ssl_status'] end if attributes.key?(:'validation_method') self.validation_method = attributes[:'validation_method'] end if attributes.key?(:'http_body') self.http_body = attributes[:'http_body'] end if attributes.key?(:'http_url_path') self.http_url_path = attributes[:'http_url_path'] end if attributes.key?(:'cname') self.cname = attributes[:'cname'] end if attributes.key?(:'cname_target') self.cname_target = attributes[:'cname_target'] end if attributes.key?(:'minimum_tls_version') self.minimum_tls_version = attributes[:'minimum_tls_version'] end if attributes.key?(:'alternate_origin_hostname') self.alternate_origin_hostname = attributes[:'alternate_origin_hostname'] end if attributes.key?(:'id') self.id = attributes[:'id'] 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 @portal_id.nil? invalid_properties.push('invalid value for "portal_id", portal_id cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @updated.nil? invalid_properties.push('invalid value for "updated", updated cannot be nil.') end if @domain_id.nil? invalid_properties.push('invalid value for "domain_id", domain_id cannot be nil.') end if @cert_id.nil? invalid_properties.push('invalid value for "cert_id", cert_id cannot be nil.') end if @cert_expiration_date.nil? invalid_properties.push('invalid value for "cert_expiration_date", cert_expiration_date cannot be nil.') end if @cdn_id.nil? invalid_properties.push('invalid value for "cdn_id", cdn_id cannot be nil.') end if @cdn_group_id.nil? invalid_properties.push('invalid value for "cdn_group_id", cdn_group_id cannot be nil.') end if @ssl_status.nil? invalid_properties.push('invalid value for "ssl_status", ssl_status cannot be nil.') end if @validation_method.nil? invalid_properties.push('invalid value for "validation_method", validation_method cannot be nil.') end if @http_body.nil? invalid_properties.push('invalid value for "http_body", http_body cannot be nil.') end if @http_url_path.nil? invalid_properties.push('invalid value for "http_url_path", http_url_path cannot be nil.') end if @cname.nil? invalid_properties.push('invalid value for "cname", cname cannot be nil.') end if @cname_target.nil? invalid_properties.push('invalid value for "cname_target", cname_target cannot be nil.') end if @minimum_tls_version.nil? invalid_properties.push('invalid value for "minimum_tls_version", minimum_tls_version cannot be nil.') end if @alternate_origin_hostname.nil? invalid_properties.push('invalid value for "alternate_origin_hostname", alternate_origin_hostname cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end 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? return false if @portal_id.nil? return false if @created.nil? return false if @updated.nil? return false if @domain_id.nil? return false if @cert_id.nil? return false if @cert_expiration_date.nil? return false if @cdn_id.nil? return false if @cdn_group_id.nil? return false if @ssl_status.nil? ssl_status_validator = EnumAttributeValidator.new('String', ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]) return false unless ssl_status_validator.valid?(@ssl_status) return false if @validation_method.nil? validation_method_validator = EnumAttributeValidator.new('String', ["0", "1", "2"]) return false unless validation_method_validator.valid?(@validation_method) return false if @http_body.nil? return false if @http_url_path.nil? return false if @cname.nil? return false if @cname_target.nil? return false if @minimum_tls_version.nil? minimum_tls_version_validator = EnumAttributeValidator.new('String', ["1.0", "1.1", "1.2", "1.3", "none", "null"]) return false unless minimum_tls_version_validator.valid?(@minimum_tls_version) return false if @alternate_origin_hostname.nil? return false if @id.nil? true end # Custom attribute writer method checking allowed values (enum). # @param [Object] ssl_status Object to be assigned def ssl_status=(ssl_status) validator = EnumAttributeValidator.new('String', ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]) unless validator.valid?(ssl_status) fail ArgumentError, "invalid value for \"ssl_status\", must be one of #{validator.allowable_values}." end @ssl_status = ssl_status end # Custom attribute writer method checking allowed values (enum). # @param [Object] validation_method Object to be assigned def validation_method=(validation_method) validator = EnumAttributeValidator.new('String', ["0", "1", "2"]) unless validator.valid?(validation_method) fail ArgumentError, "invalid value for \"validation_method\", must be one of #{validator.allowable_values}." end @validation_method = validation_method end # Custom attribute writer method checking allowed values (enum). # @param [Object] minimum_tls_version Object to be assigned def minimum_tls_version=(minimum_tls_version) validator = EnumAttributeValidator.new('String', ["1.0", "1.1", "1.2", "1.3", "none", "null"]) unless validator.valid?(minimum_tls_version) fail ArgumentError, "invalid value for \"minimum_tls_version\", must be one of #{validator.allowable_values}." end @minimum_tls_version = minimum_tls_version end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && portal_id == o.portal_id && created == o.created && updated == o.updated && domain_id == o.domain_id && cert_id == o.cert_id && cert_expiration_date == o.cert_expiration_date && cdn_id == o.cdn_id && cdn_group_id == o.cdn_group_id && ssl_status == o.ssl_status && validation_method == o.validation_method && http_body == o.http_body && http_url_path == o.http_url_path && cname == o.cname && cname_target == o.cname_target && minimum_tls_version == o.minimum_tls_version && alternate_origin_hostname == o.alternate_origin_hostname && id == o.id end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [portal_id, created, updated, domain_id, cert_id, cert_expiration_date, cdn_id, cdn_group_id, ssl_status, validation_method, http_body, http_url_path, cname, cname_target, minimum_tls_version, alternate_origin_hostname, id].hash end # 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 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]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self 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) 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<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+?), (?.+)>\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 Hubspot::Cms::Domains.const_get(type).build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash 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 # 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 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 end end end end