repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/api_client.rb
lib/hubspot/codegen/cms/blogs/authors/api_client.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'json' require 'logger' require 'tempfile' require 'time' require 'typhoeus' module Hubspot module Cms module Blogs module Authors class ApiClient # The Configuration object holding settings to be used in the API client. attr_accessor :config # Defines the headers to be used in HTTP requests of all API calls by default. # # @return [Hash] attr_accessor :default_headers # Initializes the ApiClient # @option config [Configuration] Configuration for initializing the object, default to Configuration.default def initialize(config = Configuration.default) @config = config @user_agent = "hubspot-api-client-ruby; #{VERSION}" @default_headers = { 'Content-Type' => 'application/json', 'User-Agent' => @user_agent } end def self.default @@default ||= ApiClient.new end # Call an API with given options. # # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: # the data deserialized from response body (could be nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) response = request.run if @config.debugging @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" end if !response.success? && config.error_handler.any? config.error_handler.each do |statuses, opts| statuses = statuses.is_a?(Integer) ? [statuses] : statuses retries = opts[:max_retries] || 5 while retries > 0 && statuses.include?(response.code) sleep opts[:seconds_delay] if opts[:seconds_delay] response = request.run opts[:retry_block].call if opts[:retry_block] retries -= 1 end end end unless response.success? if response.timed_out? fail ApiError.new('Connection timed out') elsif response.code == 0 # Errors from libcurl will be made visible here fail ApiError.new(:code => 0, :message => response.return_message) else fail ApiError.new(:code => response.code, :response_headers => response.headers, :response_body => response.body), response.status_message end end if opts[:return_type] data = deserialize(response, opts[:return_type]) else data = nil end return data, response.code, response.headers end # Builds the HTTP request # # @param [String] http_method HTTP method/verb (e.g. POST) # @param [String] path URL path (e.g. /account/new) # @option opts [Hash] :header_params Header parameters # @option opts [Hash] :query_params Query parameters # @option opts [Hash] :form_params Query parameters # @option opts [Object] :body HTTP body (JSON/XML) # @return [Typhoeus::Request] A Typhoeus Request def build_request(http_method, path, opts = {}) url = build_request_url(path, opts) http_method = http_method.to_sym.downcase header_params = @default_headers.merge(opts[:header_params] || {}) query_params = opts[:query_params] || {} form_params = opts[:form_params] || {} follow_location = opts[:follow_location] || true update_params_for_auth! header_params, query_params, opts[:auth_names] # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 req_opts = { :method => http_method, :headers => header_params, :params => query_params, :params_encoding => @config.params_encoding, :timeout => @config.timeout, :ssl_verifypeer => @config.verify_ssl, :ssl_verifyhost => _verify_ssl_host, :sslcert => @config.cert_file, :sslkey => @config.key_file, :verbose => @config.debugging, :followlocation => follow_location } # set custom cert, if provided req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert if [:post, :patch, :put, :delete].include?(http_method) req_body = build_request_body(header_params, form_params, opts[:body]) req_opts.update :body => req_body if @config.debugging @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" end end request = Typhoeus::Request.new(url, req_opts) download_file(request) if opts[:return_type] == 'File' request end # Builds the HTTP request body # # @param [Hash] header_params Header parameters # @param [Hash] form_params Query parameters # @param [Object] body HTTP body (JSON/XML) # @return [String] HTTP body data in the form of string def build_request_body(header_params, form_params, body) # http form if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || header_params['Content-Type'] == 'multipart/form-data' data = {} form_params.each do |key, value| case value when ::File, ::Array, nil # let typhoeus handle File, Array and nil parameters data[key] = value else data[key] = value.to_s end end elsif body data = body.is_a?(String) ? body : body.to_json else data = nil end data end # Save response body into a file in (the defined) temporary folder, using the filename # from the "Content-Disposition" header if provided, otherwise a random filename. # The response body is written to the file in chunks in order to handle files which # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby # process can use. # # @see Configuration#temp_folder_path def download_file(request) tempfile = nil encoding = nil request.on_headers do |response| content_disposition = response.headers['Content-Disposition'] if content_disposition && content_disposition =~ /filename=/i filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] prefix = sanitize_filename(filename) else prefix = 'download-' end prefix = prefix + '-' unless prefix.end_with?('-') encoding = response.body.encoding tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) @tempfile = tempfile end request.on_body do |chunk| chunk.force_encoding(encoding) tempfile.write(chunk) end request.on_complete do |response| if tempfile tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" end end end # Check if the given MIME is a JSON MIME. # JSON MIME examples: # application/json # application/json; charset=UTF8 # APPLICATION/JSON # */* # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. # # @param [Response] response HTTP response # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>" def deserialize(response, return_type) body = response.body # handle file downloading - return the File instance processed in request callbacks # note that response body is empty when the file is written in chunks in request on_body callback return @tempfile if return_type == 'File' return nil if body.nil? || body.empty? # return response body directly for String return type return body if return_type == 'String' # ensuring a default content type content_type = response.headers['Content-Type'] || 'application/json' fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) begin data = JSON.parse("[#{body}]", :symbolize_names => true)[0] rescue JSON::ParserError => e if %w(String Date Time).include?(return_type) data = body else raise e end end convert_to_type data, return_type end # Convert data to the given return type. # @param [Object] data Data to be converted # @param [String] return_type Return type # @return [Mixed] Data in a particular type def convert_to_type(data, return_type) return nil if data.nil? case return_type when 'String' data.to_s when 'Integer' data.to_i when 'Float' data.to_f when 'Boolean' data == true when 'Time' # parse date time (expecting ISO 8601 format) Time.parse data when 'Date' # parse date time (expecting ISO 8601 format) Date.parse data when 'Object' # generic object (usually a Hash), return directly data when /\AArray<(.+)>\z/ # e.g. Array<Pet> sub_type = $1 data.map { |item| convert_to_type(item, sub_type) } when /\AHash\<String, (.+)\>\z/ # e.g. Hash<String, Integer> sub_type = $1 {}.tap do |hash| data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(return_type) klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) end end # Sanitize filename by removing path. # e.g. ../../sun.gif becomes sun.gif # # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) filename.gsub(/.*[\/\\]/, '') end def build_request_url(path, opts = {}) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') @config.base_url(opts[:operation]) + path end # Update header and query params based on authentication settings. # # @param [Hash] header_params Header parameters # @param [Hash] query_params Query parameters # @param [String] auth_names Authentication scheme name def update_params_for_auth!(header_params, query_params, auth_names) Array(auth_names).each do |auth_name| auth_setting = @config.auth_settings[auth_name] next unless auth_setting case auth_setting[:in] when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] else fail ArgumentError, 'Authentication token must be in `query` or `header`' end end end # Sets user agent in HTTP header # # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) def user_agent=(user_agent) @user_agent = user_agent @default_headers['User-Agent'] = @user_agent end # Return Accept header based on an array of accepts provided. # @param [Array] accepts array for Accept # @return [String] the Accept header (e.g. application/json) def select_header_accept(accepts) return nil if accepts.nil? || accepts.empty? # use JSON when present, otherwise use all of the provided json_accept = accepts.find { |s| json_mime?(s) } json_accept || accepts.join(',') end # Return Content-Type header based on an array of content types provided. # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # return nil by default return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first end # Convert object (array, hash, object, etc) to JSON string. # @param [Object] model object to be converted into JSON string # @return [String] JSON string representation of the object def object_to_http_body(model) return model if model.nil? || model.is_a?(String) local_body = nil if model.is_a?(Array) local_body = model.map { |m| object_to_hash(m) } else local_body = object_to_hash(model) end local_body.to_json end # Convert object(non-array) to hash. # @param [Object] obj object to be converted into JSON string # @return [String] JSON string representation of the object def object_to_hash(obj) if obj.respond_to?(:to_hash) obj.to_hash else obj end end # Build parameter value according to the given collection format. # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi def build_collection_param(param, collection_format) case collection_format when :csv param.join(',') when :ssv param.join(' ') when :tsv param.join("\t") when :pipes param.join('|') when :multi # return the array directly as typhoeus will handle it as expected param else fail "unknown collection format: #{collection_format.inspect}" end end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/batch_input_string.rb
lib/hubspot/codegen/cms/blogs/authors/models/batch_input_string.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Wrapper for providing an array of strings as inputs. class BatchInputString # Strings to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<String>' } 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::Blogs::Authors::BatchInputString` 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::Blogs::Authors::BatchInputString`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/standard_error.rb
lib/hubspot/codegen/cms/blogs/authors/models/standard_error.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Model definition for a standard error. class StandardError # Error subcategory. attr_accessor :sub_category # Error context. attr_accessor :context # Error links. attr_accessor :links # Error ID. attr_accessor :id # Error category. attr_accessor :category # Error message. attr_accessor :message # List of error details. attr_accessor :errors # Error status. attr_accessor :status # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'context' => :'context', :'links' => :'links', :'id' => :'id', :'category' => :'category', :'message' => :'message', :'errors' => :'errors', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'Object', :'context' => :'Hash<String, Array<String>>', :'links' => :'Hash<String, String>', :'id' => :'String', :'category' => :'String', :'message' => :'String', :'errors' => :'Array<ErrorDetail>', :'status' => :'String' } 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::Blogs::Authors::StandardError` 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::Blogs::Authors::StandardError`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @context.nil? invalid_properties.push('invalid value for "context", context cannot be nil.') end if @links.nil? invalid_properties.push('invalid value for "links", links cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category cannot be nil.') end if @message.nil? invalid_properties.push('invalid value for "message", message cannot be nil.') end if @errors.nil? invalid_properties.push('invalid value for "errors", errors cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @context.nil? return false if @links.nil? return false if @category.nil? return false if @message.nil? return false if @errors.nil? return false if @status.nil? true 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 && sub_category == o.sub_category && context == o.context && links == o.links && id == o.id && category == o.category && message == o.message && errors == o.errors && status == o.status 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 [sub_category, context, links, id, category, message, errors, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/collection_response_with_total_blog_author_forward_paging.rb
lib/hubspot/codegen/cms/blogs/authors/models/collection_response_with_total_blog_author_forward_paging.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Response object for collections of blog authors with pagination information. class CollectionResponseWithTotalBlogAuthorForwardPaging # Total number of blog authors. attr_accessor :total attr_accessor :paging # Collection of blog authors. attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'total' => :'total', :'paging' => :'paging', :'results' => :'results' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'total' => :'Integer', :'paging' => :'ForwardPaging', :'results' => :'Array<BlogAuthor>' } 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::Blogs::Authors::CollectionResponseWithTotalBlogAuthorForwardPaging` 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::Blogs::Authors::CollectionResponseWithTotalBlogAuthorForwardPaging`. 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?(:'total') self.total = attributes[:'total'] end if attributes.key?(:'paging') self.paging = attributes[:'paging'] end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end 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 @total.nil? invalid_properties.push('invalid value for "total", total cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results 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 @total.nil? return false if @results.nil? true 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 && total == o.total && paging == o.paging && results == o.results 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 [total, paging, results].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/attach_to_lang_primary_request_v_next.rb
lib/hubspot/codegen/cms/blogs/authors/models/attach_to_lang_primary_request_v_next.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Request body object for attaching objects to multi-language groups. class AttachToLangPrimaryRequestVNext # Designated language of the object to add to a multi-language group. attr_accessor :language # ID of the object to add to a multi-language group. attr_accessor :id # ID of primary language object in multi-language group. attr_accessor :primary_id # Primary language of the multi-language group. attr_accessor :primary_language # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'language' => :'language', :'id' => :'id', :'primary_id' => :'primaryId', :'primary_language' => :'primaryLanguage' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'language' => :'String', :'id' => :'String', :'primary_id' => :'String', :'primary_language' => :'String' } 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::Blogs::Authors::AttachToLangPrimaryRequestVNext` 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::Blogs::Authors::AttachToLangPrimaryRequestVNext`. 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?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'primary_id') self.primary_id = attributes[:'primary_id'] end if attributes.key?(:'primary_language') self.primary_language = attributes[:'primary_language'] 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 @language.nil? invalid_properties.push('invalid value for "language", language cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @primary_id.nil? invalid_properties.push('invalid value for "primary_id", primary_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 @language.nil? return false if @id.nil? return false if @primary_id.nil? true 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 && language == o.language && id == o.id && primary_id == o.primary_id && primary_language == o.primary_language 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 [language, id, primary_id, primary_language].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/batch_input_blog_author.rb
lib/hubspot/codegen/cms/blogs/authors/models/batch_input_blog_author.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Wrapper for providing an array of blog authors as inputs. class BatchInputBlogAuthor # Blog authors to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<BlogAuthor>' } 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::Blogs::Authors::BatchInputBlogAuthor` 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::Blogs::Authors::BatchInputBlogAuthor`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/next_page.rb
lib/hubspot/codegen/cms/blogs/authors/models/next_page.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Model definition for a next page. class NextPage # attr_accessor :link # attr_accessor :after # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'link' => :'link', :'after' => :'after' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'link' => :'String', :'after' => :'String' } 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::Blogs::Authors::NextPage` 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::Blogs::Authors::NextPage`. 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?(:'link') self.link = attributes[:'link'] end if attributes.key?(:'after') self.after = attributes[:'after'] 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 @after.nil? invalid_properties.push('invalid value for "after", after 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 @after.nil? true 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 && link == o.link && after == o.after 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 [link, after].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/detach_from_lang_group_request_v_next.rb
lib/hubspot/codegen/cms/blogs/authors/models/detach_from_lang_group_request_v_next.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Request body object for detaching objects from multi-language groups. class DetachFromLangGroupRequestVNext # ID of the object to remove from a multi-language group. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'id' => :'String' } 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::Blogs::Authors::DetachFromLangGroupRequestVNext` 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::Blogs::Authors::DetachFromLangGroupRequestVNext`. 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?(:'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 @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 @id.nil? true 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 && 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 [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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/batch_input_json_node.rb
lib/hubspot/codegen/cms/blogs/authors/models/batch_input_json_node.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Wrapper for providing an array of JSON nodes as inputs. class BatchInputJsonNode # JSON nodes to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<Object>' } 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::Blogs::Authors::BatchInputJsonNode` 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::Blogs::Authors::BatchInputJsonNode`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/error_detail.rb
lib/hubspot/codegen/cms/blogs/authors/models/error_detail.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors class ErrorDetail # A specific category that contains more specific detail about the error attr_accessor :sub_category # The status code associated with the error detail attr_accessor :code # The name of the field or parameter in which the error was found. attr_accessor :_in # Context about the error condition attr_accessor :context # A human readable message describing the error along with remediation steps where appropriate attr_accessor :message # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'code' => :'code', :'_in' => :'in', :'context' => :'context', :'message' => :'message' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'String', :'code' => :'String', :'_in' => :'String', :'context' => :'Hash<String, Array<String>>', :'message' => :'String' } 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::Blogs::Authors::ErrorDetail` 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::Blogs::Authors::ErrorDetail`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'code') self.code = attributes[:'code'] end if attributes.key?(:'_in') self._in = attributes[:'_in'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'message') self.message = attributes[:'message'] 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 @message.nil? invalid_properties.push('invalid value for "message", message 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 @message.nil? true 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 && sub_category == o.sub_category && code == o.code && _in == o._in && context == o.context && message == o.message 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 [sub_category, code, _in, context, message].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/batch_response_blog_author_with_errors.rb
lib/hubspot/codegen/cms/blogs/authors/models/batch_response_blog_author_with_errors.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Response object for batch operations on blog authors with errors. class BatchResponseBlogAuthorWithErrors # Time of batch operation completion. attr_accessor :completed_at # Number of errors. attr_accessor :num_errors # Time of batch operation request. attr_accessor :requested_at # Time of batch operation start. attr_accessor :started_at # Links associated with batch operation. attr_accessor :links # Results of batch operation. attr_accessor :results # Errors in batch operation. attr_accessor :errors # Status of batch operation. attr_accessor :status 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 { :'completed_at' => :'completedAt', :'num_errors' => :'numErrors', :'requested_at' => :'requestedAt', :'started_at' => :'startedAt', :'links' => :'links', :'results' => :'results', :'errors' => :'errors', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'completed_at' => :'Time', :'num_errors' => :'Integer', :'requested_at' => :'Time', :'started_at' => :'Time', :'links' => :'Hash<String, String>', :'results' => :'Array<BlogAuthor>', :'errors' => :'Array<StandardError>', :'status' => :'String' } 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::Blogs::Authors::BatchResponseBlogAuthorWithErrors` 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::Blogs::Authors::BatchResponseBlogAuthorWithErrors`. 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?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'num_errors') self.num_errors = attributes[:'num_errors'] end if attributes.key?(:'requested_at') self.requested_at = attributes[:'requested_at'] end if attributes.key?(:'started_at') self.started_at = attributes[:'started_at'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @completed_at.nil? invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.') end if @started_at.nil? invalid_properties.push('invalid value for "started_at", started_at cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @completed_at.nil? return false if @started_at.nil? return false if @results.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) return false unless status_validator.valid?(@status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) unless validator.valid?(status) fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." end @status = status 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 && completed_at == o.completed_at && num_errors == o.num_errors && requested_at == o.requested_at && started_at == o.started_at && links == o.links && results == o.results && errors == o.errors && status == o.status 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 [completed_at, num_errors, requested_at, started_at, links, results, errors, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/set_new_language_primary_request_v_next.rb
lib/hubspot/codegen/cms/blogs/authors/models/set_new_language_primary_request_v_next.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Request body object for setting a new primary language. class SetNewLanguagePrimaryRequestVNext # ID of object to set as primary in multi-language group. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'id' => :'String' } 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::Blogs::Authors::SetNewLanguagePrimaryRequestVNext` 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::Blogs::Authors::SetNewLanguagePrimaryRequestVNext`. 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?(:'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 @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 @id.nil? true 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 && 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 [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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/blog_author_clone_request_v_next.rb
lib/hubspot/codegen/cms/blogs/authors/models/blog_author_clone_request_v_next.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Request body object for cloning blog authors. class BlogAuthorCloneRequestVNext # Language of newly cloned object. attr_accessor :language # ID of the object to be cloned. attr_accessor :id # Primary language in multi-language group. attr_accessor :primary_language attr_accessor :blog_author # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'language' => :'language', :'id' => :'id', :'primary_language' => :'primaryLanguage', :'blog_author' => :'blogAuthor' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'language' => :'String', :'id' => :'String', :'primary_language' => :'String', :'blog_author' => :'BlogAuthor' } 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::Blogs::Authors::BlogAuthorCloneRequestVNext` 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::Blogs::Authors::BlogAuthorCloneRequestVNext`. 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?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'primary_language') self.primary_language = attributes[:'primary_language'] end if attributes.key?(:'blog_author') self.blog_author = attributes[:'blog_author'] 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 @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @blog_author.nil? invalid_properties.push('invalid value for "blog_author", blog_author 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 @id.nil? return false if @blog_author.nil? true 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 && language == o.language && id == o.id && primary_language == o.primary_language && blog_author == o.blog_author 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 [language, id, primary_language, blog_author].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/forward_paging.rb
lib/hubspot/codegen/cms/blogs/authors/models/forward_paging.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Model definition for forward paging. class ForwardPaging attr_accessor :_next # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'_next' => :'next' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'_next' => :'NextPage' } 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::Blogs::Authors::ForwardPaging` 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::Blogs::Authors::ForwardPaging`. 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?(:'_next') self._next = attributes[:'_next'] 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 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? true 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 && _next == o._next 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 [_next].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/batch_response_blog_author.rb
lib/hubspot/codegen/cms/blogs/authors/models/batch_response_blog_author.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Response object for batch operations on blog authors. class BatchResponseBlogAuthor # Time of batch operation completion. attr_accessor :completed_at # Time of batch operation request. attr_accessor :requested_at # Time of batch operation start. attr_accessor :started_at # Links associated with batch operation. attr_accessor :links # Results of batch operation. attr_accessor :results # Status of batch operation. attr_accessor :status 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 { :'completed_at' => :'completedAt', :'requested_at' => :'requestedAt', :'started_at' => :'startedAt', :'links' => :'links', :'results' => :'results', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'completed_at' => :'Time', :'requested_at' => :'Time', :'started_at' => :'Time', :'links' => :'Hash<String, String>', :'results' => :'Array<BlogAuthor>', :'status' => :'String' } 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::Blogs::Authors::BatchResponseBlogAuthor` 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::Blogs::Authors::BatchResponseBlogAuthor`. 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?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'requested_at') self.requested_at = attributes[:'requested_at'] end if attributes.key?(:'started_at') self.started_at = attributes[:'started_at'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @completed_at.nil? invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.') end if @started_at.nil? invalid_properties.push('invalid value for "started_at", started_at cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @completed_at.nil? return false if @started_at.nil? return false if @results.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) return false unless status_validator.valid?(@status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) unless validator.valid?(status) fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." end @status = status 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 && completed_at == o.completed_at && requested_at == o.requested_at && started_at == o.started_at && links == o.links && results == o.results && status == o.status 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 [completed_at, requested_at, started_at, links, results, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/blog_author.rb
lib/hubspot/codegen/cms/blogs/authors/models/blog_author.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Model definition for a Blog Author. class BlogAuthor # URL to the website of the Blog Author. attr_accessor :website # The full name of the Blog Author to be displayed. attr_accessor :display_name attr_accessor :created # URL to the Blog Author's Facebook page. attr_accessor :facebook attr_accessor :full_name # A short biography of the blog author. attr_accessor :bio # The explicitly defined ISO 639 language code of the blog author. attr_accessor :language # URL to the blog author's LinkedIn page. attr_accessor :linkedin # URL to the blog author's avatar, if supplying a custom one. attr_accessor :avatar # ID of the primary blog author this object was translated from. attr_accessor :translated_from_id # URL or username of the Twitter account associated with the Blog Author. This will be normalized into the Twitter url for said user. attr_accessor :twitter # The timestamp (ISO8601 format) when this Blog Author was deleted. attr_accessor :deleted_at attr_accessor :name # The unique ID of the Blog Author. attr_accessor :id attr_accessor :updated # Email address of the Blog Author. attr_accessor :email attr_accessor :slug 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 { :'website' => :'website', :'display_name' => :'displayName', :'created' => :'created', :'facebook' => :'facebook', :'full_name' => :'fullName', :'bio' => :'bio', :'language' => :'language', :'linkedin' => :'linkedin', :'avatar' => :'avatar', :'translated_from_id' => :'translatedFromId', :'twitter' => :'twitter', :'deleted_at' => :'deletedAt', :'name' => :'name', :'id' => :'id', :'updated' => :'updated', :'email' => :'email', :'slug' => :'slug' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'website' => :'String', :'display_name' => :'String', :'created' => :'Time', :'facebook' => :'String', :'full_name' => :'String', :'bio' => :'String', :'language' => :'String', :'linkedin' => :'String', :'avatar' => :'String', :'translated_from_id' => :'Integer', :'twitter' => :'String', :'deleted_at' => :'Time', :'name' => :'String', :'id' => :'String', :'updated' => :'Time', :'email' => :'String', :'slug' => :'String' } 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::Blogs::Authors::BlogAuthor` 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::Blogs::Authors::BlogAuthor`. 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?(:'website') self.website = attributes[:'website'] end if attributes.key?(:'display_name') self.display_name = attributes[:'display_name'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'facebook') self.facebook = attributes[:'facebook'] end if attributes.key?(:'full_name') self.full_name = attributes[:'full_name'] end if attributes.key?(:'bio') self.bio = attributes[:'bio'] end if attributes.key?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'linkedin') self.linkedin = attributes[:'linkedin'] end if attributes.key?(:'avatar') self.avatar = attributes[:'avatar'] end if attributes.key?(:'translated_from_id') self.translated_from_id = attributes[:'translated_from_id'] end if attributes.key?(:'twitter') self.twitter = attributes[:'twitter'] end if attributes.key?(:'deleted_at') self.deleted_at = attributes[:'deleted_at'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'updated') self.updated = attributes[:'updated'] end if attributes.key?(:'email') self.email = attributes[:'email'] end if attributes.key?(:'slug') self.slug = attributes[:'slug'] 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 @website.nil? invalid_properties.push('invalid value for "website", website cannot be nil.') end if @display_name.nil? invalid_properties.push('invalid value for "display_name", display_name cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @facebook.nil? invalid_properties.push('invalid value for "facebook", facebook cannot be nil.') end if @full_name.nil? invalid_properties.push('invalid value for "full_name", full_name cannot be nil.') end if @bio.nil? invalid_properties.push('invalid value for "bio", bio cannot be nil.') end if @language.nil? invalid_properties.push('invalid value for "language", language cannot be nil.') end if @linkedin.nil? invalid_properties.push('invalid value for "linkedin", linkedin cannot be nil.') end if @avatar.nil? invalid_properties.push('invalid value for "avatar", avatar cannot be nil.') end if @translated_from_id.nil? invalid_properties.push('invalid value for "translated_from_id", translated_from_id cannot be nil.') end if @twitter.nil? invalid_properties.push('invalid value for "twitter", twitter cannot be nil.') end if @deleted_at.nil? invalid_properties.push('invalid value for "deleted_at", deleted_at cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @updated.nil? invalid_properties.push('invalid value for "updated", updated cannot be nil.') end if @email.nil? invalid_properties.push('invalid value for "email", email cannot be nil.') end if @slug.nil? invalid_properties.push('invalid value for "slug", slug 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 @website.nil? return false if @display_name.nil? return false if @created.nil? return false if @facebook.nil? return false if @full_name.nil? return false if @bio.nil? return false if @language.nil? language_validator = EnumAttributeValidator.new('String', ["af", "af-na", "af-za", "agq", "agq-cm", "ak", "ak-gh", "am", "am-et", "ar", "ar-001", "ar-ae", "ar-bh", "ar-dj", "ar-dz", "ar-eg", "ar-eh", "ar-er", "ar-il", "ar-iq", "ar-jo", "ar-km", "ar-kw", "ar-lb", "ar-ly", "ar-ma", "ar-mr", "ar-om", "ar-ps", "ar-qa", "ar-sa", "ar-sd", "ar-so", "ar-ss", "ar-sy", "ar-td", "ar-tn", "ar-ye", "as", "as-in", "asa", "asa-tz", "ast", "ast-es", "az", "az-az", "bas", "bas-cm", "be", "be-by", "bem", "bem-zm", "bez", "bez-tz", "bg", "bg-bg", "bm", "bm-ml", "bn", "bn-bd", "bn-in", "bo", "bo-cn", "bo-in", "br", "br-fr", "brx", "brx-in", "bs", "bs-ba", "ca", "ca-ad", "ca-es", "ca-fr", "ca-it", "ccp", "ccp-bd", "ccp-in", "ce", "ce-ru", "ceb", "ceb-ph", "cgg", "cgg-ug", "chr", "chr-us", "ckb", "ckb-iq", "ckb-ir", "cs", "cs-cz", "cu", "cu-ru", "cy", "cy-gb", "da", "da-dk", "da-gl", "dav", "dav-ke", "de", "de-at", "de-be", "de-ch", "de-de", "de-gr", "de-it", "de-li", "de-lu", "dje", "dje-ne", "doi", "doi-in", "dsb", "dsb-de", "dua", "dua-cm", "dyo", "dyo-sn", "dz", "dz-bt", "ebu", "ebu-ke", "ee", "ee-gh", "ee-tg", "el", "el-cy", "el-gr", "en", "en-001", "en-150", "en-ae", "en-ag", "en-ai", "en-as", "en-at", "en-au", "en-bb", "en-be", "en-bi", "en-bm", "en-bs", "en-bw", "en-bz", "en-ca", "en-cc", "en-ch", "en-ck", "en-cm", "en-cn", "en-cx", "en-cy", "en-de", "en-dg", "en-dk", "en-dm", "en-er", "en-fi", "en-fj", "en-fk", "en-fm", "en-gb", "en-gd", "en-gg", "en-gh", "en-gi", "en-gm", "en-gu", "en-gy", "en-hk", "en-ie", "en-il", "en-im", "en-in", "en-io", "en-je", "en-jm", "en-ke", "en-ki", "en-kn", "en-ky", "en-lc", "en-lr", "en-ls", "en-lu", "en-mg", "en-mh", "en-mo", "en-mp", "en-ms", "en-mt", "en-mu", "en-mw", "en-mx", "en-my", "en-na", "en-nf", "en-ng", "en-nl", "en-nr", "en-nu", "en-nz", "en-pg", "en-ph", "en-pk", "en-pn", "en-pr", "en-pw", "en-rw", "en-sb", "en-sc", "en-sd", "en-se", "en-sg", "en-sh", "en-si", "en-sl", "en-ss", "en-sx", "en-sz", "en-tc", "en-tk", "en-to", "en-tt", "en-tv", "en-tz", "en-ug", "en-um", "en-us", "en-vc", "en-vg", "en-vi", "en-vu", "en-ws", "en-za", "en-zm", "en-zw", "eo", "eo-001", "es", "es-419", "es-ar", "es-bo", "es-br", "es-bz", "es-cl", "es-co", "es-cr", "es-cu", "es-do", "es-ea", "es-ec", "es-es", "es-gq", "es-gt", "es-hn", "es-ic", "es-mx", "es-ni", "es-pa", "es-pe", "es-ph", "es-pr", "es-py", "es-sv", "es-us", "es-uy", "es-ve", "et", "et-ee", "eu", "eu-es", "ewo", "ewo-cm", "fa", "fa-af", "fa-ir", "ff", "ff-bf", "ff-cm", "ff-gh", "ff-gm", "ff-gn", "ff-gw", "ff-lr", "ff-mr", "ff-ne", "ff-ng", "ff-sl", "ff-sn", "fi", "fi-fi", "fil", "fil-ph", "fo", "fo-dk", "fo-fo", "fr", "fr-be", "fr-bf", "fr-bi", "fr-bj", "fr-bl", "fr-ca", "fr-cd", "fr-cf", "fr-cg", "fr-ch", "fr-ci", "fr-cm", "fr-dj", "fr-dz", "fr-fr", "fr-ga", "fr-gf", "fr-gn", "fr-gp", "fr-gq", "fr-ht", "fr-km", "fr-lu", "fr-ma", "fr-mc", "fr-mf", "fr-mg", "fr-ml", "fr-mq", "fr-mr", "fr-mu", "fr-nc", "fr-ne", "fr-pf", "fr-pm", "fr-re", "fr-rw", "fr-sc", "fr-sn", "fr-sy", "fr-td", "fr-tg", "fr-tn", "fr-vu", "fr-wf", "fr-yt", "fur", "fur-it", "fy", "fy-nl", "ga", "ga-gb", "ga-ie", "gd", "gd-gb", "gl", "gl-es", "gsw", "gsw-ch", "gsw-fr", "gsw-li", "gu", "gu-in", "guz", "guz-ke", "gv", "gv-im", "ha", "ha-gh", "ha-ne", "ha-ng", "haw", "haw-us", "he", "hi", "hi-in", "hr", "hr-ba", "hr-hr", "hsb", "hsb-de", "hu", "hu-hu", "hy", "hy-am", "ia", "ia-001", "id", "ig", "ig-ng", "ii", "ii-cn", "id-id", "is", "is-is", "it", "it-ch", "it-it", "it-sm", "it-va", "he-il", "ja", "ja-jp", "jgo", "jgo-cm", "yi", "yi-001", "jmc", "jmc-tz", "jv", "jv-id", "ka", "ka-ge", "kab", "kab-dz", "kam", "kam-ke", "kde", "kde-tz", "kea", "kea-cv", "khq", "khq-ml", "ki", "ki-ke", "kk", "kk-kz", "kkj", "kkj-cm", "kl", "kl-gl", "kln", "kln-ke", "km", "km-kh", "kn", "kn-in", "ko", "ko-kp", "ko-kr", "kok", "kok-in", "ks", "ks-in", "ksb", "ksb-tz", "ksf", "ksf-cm", "ksh", "ksh-de", "kw", "kw-gb", "ku", "ku-tr", "ky", "ky-kg", "lag", "lag-tz", "lb", "lb-lu", "lg", "lg-ug", "lkt", "lkt-us", "ln", "ln-ao", "ln-cd", "ln-cf", "ln-cg", "lo", "lo-la", "lrc", "lrc-iq", "lrc-ir", "lt", "lt-lt", "lu", "lu-cd", "luo", "luo-ke", "luy", "luy-ke", "lv", "lv-lv", "mai", "mai-in", "mas", "mas-ke", "mas-tz", "mer", "mer-ke", "mfe", "mfe-mu", "mg", "mg-mg", "mgh", "mgh-mz", "mgo", "mgo-cm", "mi", "mi-nz", "mk", "mk-mk", "ml", "ml-in", "mn", "mn-mn", "mni", "mni-in", "mr", "mr-in", "ms", "ms-bn", "ms-id", "ms-my", "ms-sg", "mt", "mt-mt", "mua", "mua-cm", "my", "my-mm", "mzn", "mzn-ir", "naq", "naq-na", "nb", "nb-no", "nb-sj", "nd", "nd-zw", "nds", "nds-de", "nds-nl", "ne", "ne-in", "ne-np", "nl", "nl-aw", "nl-be", "nl-ch", "nl-bq", "nl-cw", "nl-lu", "nl-nl", "nl-sr", "nl-sx", "nmg", "nmg-cm", "nn", "nn-no", "nnh", "nnh-cm", "no", "no-no", "nus", "nus-ss", "nyn", "nyn-ug", "om", "om-et", "om-ke", "or", "or-in", "os", "os-ge", "os-ru", "pa", "pa-in", "pa-pk", "pcm", "pcm-ng", "pl", "pl-pl", "prg", "prg-001", "ps", "ps-af", "ps-pk", "pt", "pt-ao", "pt-br", "pt-ch", "pt-cv", "pt-gq", "pt-gw", "pt-lu", "pt-mo", "pt-mz", "pt-pt", "pt-st", "pt-tl", "qu", "qu-bo", "qu-ec", "qu-pe", "rm", "rm-ch", "rn", "rn-bi", "ro", "ro-md", "ro-ro", "rof", "rof-tz", "ru", "ru-by", "ru-kg", "ru-kz", "ru-md", "ru-ru", "ru-ua", "rw", "rw-rw", "rwk", "rwk-tz", "sa", "sa-in", "sah", "sah-ru", "saq", "saq-ke", "sat", "sat-in", "sbp", "sbp-tz", "sd", "sd-in", "sd-pk", "se", "se-fi", "se-no", "se-se", "seh", "seh-mz", "ses", "ses-ml", "sg", "sg-cf", "shi", "shi-ma", "si", "si-lk", "sk", "sk-sk", "sl", "sl-si", "smn", "smn-fi", "sn", "sn-zw", "so", "so-dj", "so-et", "so-ke", "so-so", "sq", "sq-al", "sq-mk", "sq-xk", "sr", "sr-ba", "sr-cs", "sr-me", "sr-rs", "sr-xk", "su", "su-id", "sv", "sv-ax", "sv-fi", "sv-se", "sw", "sw-cd", "sw-ke", "sw-tz", "sw-ug", "sy", "ta", "ta-in", "ta-lk", "ta-my", "ta-sg", "te", "te-in", "teo", "teo-ke", "teo-ug", "tg", "tg-tj", "th", "th-th", "ti", "ti-er", "ti-et", "tk", "tk-tm", "tl", "to", "to-to", "tr", "tr-cy", "tr-tr", "tt", "tt-ru", "twq", "twq-ne", "tzm", "tzm-ma", "ug", "ug-cn", "uk", "uk-ua", "ur", "ur-in", "ur-pk", "uz", "uz-af", "uz-uz", "vai", "vai-lr", "vi", "vi-vn", "vo", "vo-001", "vun", "vun-tz", "wae", "wae-ch", "wo", "wo-sn", "xh", "xh-za", "xog", "xog-ug", "yav", "yav-cm", "yo", "yo-bj", "yo-ng", "yue", "yue-cn", "yue-hk", "zgh", "zgh-ma", "zh", "zh-cn", "zh-hk", "zh-mo", "zh-sg", "zh-tw", "zh-hans", "zh-hant", "zu", "zu-za"]) return false unless language_validator.valid?(@language) return false if @linkedin.nil? return false if @avatar.nil? return false if @translated_from_id.nil? return false if @twitter.nil? return false if @deleted_at.nil? return false if @name.nil? return false if @id.nil? return false if @updated.nil? return false if @email.nil? return false if @slug.nil? true end # Custom attribute writer method checking allowed values (enum). # @param [Object] language Object to be assigned def language=(language) validator = EnumAttributeValidator.new('String', ["af", "af-na", "af-za", "agq", "agq-cm", "ak", "ak-gh", "am", "am-et", "ar", "ar-001", "ar-ae", "ar-bh", "ar-dj", "ar-dz", "ar-eg", "ar-eh", "ar-er", "ar-il", "ar-iq", "ar-jo", "ar-km", "ar-kw", "ar-lb", "ar-ly", "ar-ma", "ar-mr", "ar-om", "ar-ps", "ar-qa", "ar-sa", "ar-sd", "ar-so", "ar-ss", "ar-sy", "ar-td", "ar-tn", "ar-ye", "as", "as-in", "asa", "asa-tz", "ast", "ast-es", "az", "az-az", "bas", "bas-cm", "be", "be-by", "bem", "bem-zm", "bez", "bez-tz", "bg", "bg-bg", "bm", "bm-ml", "bn", "bn-bd", "bn-in", "bo", "bo-cn", "bo-in", "br", "br-fr", "brx", "brx-in", "bs", "bs-ba", "ca", "ca-ad", "ca-es", "ca-fr", "ca-it", "ccp", "ccp-bd", "ccp-in", "ce", "ce-ru", "ceb", "ceb-ph", "cgg", "cgg-ug", "chr", "chr-us", "ckb", "ckb-iq", "ckb-ir", "cs", "cs-cz", "cu", "cu-ru", "cy", "cy-gb", "da", "da-dk", "da-gl", "dav", "dav-ke", "de", "de-at", "de-be", "de-ch", "de-de", "de-gr", "de-it", "de-li", "de-lu", "dje", "dje-ne", "doi", "doi-in", "dsb", "dsb-de", "dua", "dua-cm", "dyo", "dyo-sn", "dz", "dz-bt", "ebu", "ebu-ke", "ee", "ee-gh", "ee-tg", "el", "el-cy", "el-gr", "en", "en-001", "en-150", "en-ae", "en-ag", "en-ai", "en-as", "en-at", "en-au", "en-bb", "en-be", "en-bi", "en-bm", "en-bs", "en-bw", "en-bz", "en-ca", "en-cc", "en-ch", "en-ck", "en-cm", "en-cn", "en-cx", "en-cy", "en-de", "en-dg", "en-dk", "en-dm", "en-er", "en-fi", "en-fj", "en-fk", "en-fm", "en-gb", "en-gd", "en-gg", "en-gh", "en-gi", "en-gm", "en-gu", "en-gy", "en-hk", "en-ie", "en-il", "en-im", "en-in", "en-io", "en-je", "en-jm", "en-ke", "en-ki", "en-kn", "en-ky", "en-lc", "en-lr", "en-ls", "en-lu", "en-mg", "en-mh", "en-mo", "en-mp", "en-ms", "en-mt", "en-mu", "en-mw", "en-mx", "en-my", "en-na", "en-nf", "en-ng", "en-nl", "en-nr", "en-nu", "en-nz", "en-pg", "en-ph", "en-pk", "en-pn", "en-pr", "en-pw", "en-rw", "en-sb", "en-sc", "en-sd", "en-se", "en-sg", "en-sh", "en-si", "en-sl", "en-ss", "en-sx", "en-sz", "en-tc", "en-tk", "en-to", "en-tt", "en-tv", "en-tz", "en-ug", "en-um", "en-us", "en-vc", "en-vg", "en-vi", "en-vu", "en-ws", "en-za", "en-zm", "en-zw", "eo", "eo-001", "es", "es-419", "es-ar", "es-bo", "es-br", "es-bz", "es-cl", "es-co", "es-cr", "es-cu", "es-do", "es-ea", "es-ec", "es-es", "es-gq", "es-gt", "es-hn", "es-ic", "es-mx", "es-ni", "es-pa", "es-pe", "es-ph", "es-pr", "es-py", "es-sv", "es-us", "es-uy", "es-ve", "et", "et-ee", "eu", "eu-es", "ewo", "ewo-cm", "fa", "fa-af", "fa-ir", "ff", "ff-bf", "ff-cm", "ff-gh", "ff-gm", "ff-gn", "ff-gw", "ff-lr", "ff-mr", "ff-ne", "ff-ng", "ff-sl", "ff-sn", "fi", "fi-fi", "fil", "fil-ph", "fo", "fo-dk", "fo-fo", "fr", "fr-be", "fr-bf", "fr-bi", "fr-bj", "fr-bl", "fr-ca", "fr-cd", "fr-cf", "fr-cg", "fr-ch", "fr-ci", "fr-cm", "fr-dj", "fr-dz", "fr-fr", "fr-ga", "fr-gf", "fr-gn", "fr-gp", "fr-gq", "fr-ht", "fr-km", "fr-lu", "fr-ma", "fr-mc", "fr-mf", "fr-mg", "fr-ml", "fr-mq", "fr-mr", "fr-mu", "fr-nc", "fr-ne", "fr-pf", "fr-pm", "fr-re", "fr-rw", "fr-sc", "fr-sn", "fr-sy", "fr-td", "fr-tg", "fr-tn", "fr-vu", "fr-wf", "fr-yt", "fur", "fur-it", "fy", "fy-nl", "ga", "ga-gb", "ga-ie", "gd", "gd-gb", "gl", "gl-es", "gsw", "gsw-ch", "gsw-fr", "gsw-li", "gu", "gu-in", "guz", "guz-ke", "gv", "gv-im", "ha", "ha-gh", "ha-ne", "ha-ng", "haw", "haw-us", "he", "hi", "hi-in", "hr", "hr-ba", "hr-hr", "hsb", "hsb-de", "hu", "hu-hu", "hy", "hy-am", "ia", "ia-001", "id", "ig", "ig-ng", "ii", "ii-cn", "id-id", "is", "is-is", "it", "it-ch", "it-it", "it-sm", "it-va", "he-il", "ja", "ja-jp", "jgo", "jgo-cm", "yi", "yi-001", "jmc", "jmc-tz", "jv", "jv-id", "ka", "ka-ge", "kab", "kab-dz", "kam", "kam-ke", "kde", "kde-tz", "kea", "kea-cv", "khq", "khq-ml", "ki", "ki-ke", "kk", "kk-kz", "kkj", "kkj-cm", "kl", "kl-gl", "kln", "kln-ke", "km", "km-kh", "kn", "kn-in", "ko", "ko-kp", "ko-kr", "kok", "kok-in", "ks", "ks-in", "ksb", "ksb-tz", "ksf", "ksf-cm", "ksh", "ksh-de", "kw", "kw-gb", "ku", "ku-tr", "ky", "ky-kg", "lag", "lag-tz", "lb", "lb-lu", "lg", "lg-ug", "lkt", "lkt-us", "ln", "ln-ao", "ln-cd", "ln-cf", "ln-cg", "lo", "lo-la", "lrc", "lrc-iq", "lrc-ir", "lt", "lt-lt", "lu", "lu-cd", "luo", "luo-ke", "luy", "luy-ke", "lv", "lv-lv", "mai", "mai-in", "mas", "mas-ke", "mas-tz", "mer", "mer-ke", "mfe", "mfe-mu", "mg", "mg-mg", "mgh", "mgh-mz", "mgo", "mgo-cm", "mi", "mi-nz", "mk", "mk-mk", "ml", "ml-in", "mn", "mn-mn", "mni", "mni-in", "mr", "mr-in", "ms", "ms-bn", "ms-id", "ms-my", "ms-sg", "mt", "mt-mt", "mua", "mua-cm", "my", "my-mm", "mzn", "mzn-ir", "naq", "naq-na", "nb", "nb-no", "nb-sj", "nd", "nd-zw", "nds", "nds-de", "nds-nl", "ne", "ne-in", "ne-np", "nl", "nl-aw", "nl-be", "nl-ch", "nl-bq", "nl-cw", "nl-lu", "nl-nl", "nl-sr", "nl-sx", "nmg", "nmg-cm", "nn", "nn-no", "nnh", "nnh-cm", "no", "no-no", "nus", "nus-ss", "nyn", "nyn-ug", "om", "om-et", "om-ke", "or", "or-in", "os", "os-ge", "os-ru", "pa", "pa-in", "pa-pk", "pcm", "pcm-ng", "pl", "pl-pl", "prg", "prg-001", "ps", "ps-af", "ps-pk", "pt", "pt-ao", "pt-br", "pt-ch", "pt-cv", "pt-gq", "pt-gw", "pt-lu", "pt-mo", "pt-mz", "pt-pt", "pt-st", "pt-tl", "qu", "qu-bo", "qu-ec", "qu-pe", "rm", "rm-ch", "rn", "rn-bi", "ro", "ro-md", "ro-ro", "rof", "rof-tz", "ru", "ru-by", "ru-kg", "ru-kz", "ru-md", "ru-ru", "ru-ua", "rw", "rw-rw", "rwk", "rwk-tz", "sa", "sa-in", "sah", "sah-ru", "saq", "saq-ke", "sat", "sat-in", "sbp", "sbp-tz", "sd", "sd-in", "sd-pk", "se", "se-fi", "se-no", "se-se", "seh", "seh-mz", "ses", "ses-ml", "sg", "sg-cf", "shi", "shi-ma", "si", "si-lk", "sk", "sk-sk", "sl", "sl-si", "smn", "smn-fi", "sn", "sn-zw", "so", "so-dj", "so-et", "so-ke", "so-so", "sq", "sq-al", "sq-mk", "sq-xk", "sr", "sr-ba", "sr-cs", "sr-me", "sr-rs", "sr-xk", "su", "su-id", "sv", "sv-ax", "sv-fi", "sv-se", "sw", "sw-cd", "sw-ke", "sw-tz", "sw-ug", "sy", "ta", "ta-in", "ta-lk", "ta-my", "ta-sg", "te", "te-in", "teo", "teo-ke", "teo-ug", "tg", "tg-tj", "th", "th-th", "ti", "ti-er", "ti-et", "tk", "tk-tm", "tl", "to", "to-to", "tr", "tr-cy", "tr-tr", "tt", "tt-ru", "twq", "twq-ne", "tzm", "tzm-ma", "ug", "ug-cn", "uk", "uk-ua", "ur", "ur-in", "ur-pk", "uz", "uz-af", "uz-uz", "vai", "vai-lr", "vi", "vi-vn", "vo", "vo-001", "vun", "vun-tz", "wae", "wae-ch", "wo", "wo-sn", "xh", "xh-za", "xog", "xog-ug", "yav", "yav-cm", "yo", "yo-bj", "yo-ng", "yue", "yue-cn", "yue-hk", "zgh", "zgh-ma", "zh", "zh-cn", "zh-hk", "zh-mo", "zh-sg", "zh-tw", "zh-hans", "zh-hant", "zu", "zu-za"]) unless validator.valid?(language) fail ArgumentError, "invalid value for \"language\", must be one of #{validator.allowable_values}." end @language = language 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 && website == o.website && display_name == o.display_name && created == o.created && facebook == o.facebook && full_name == o.full_name && bio == o.bio && language == o.language && linkedin == o.linkedin && avatar == o.avatar && translated_from_id == o.translated_from_id && twitter == o.twitter && deleted_at == o.deleted_at && name == o.name && id == o.id && updated == o.updated && email == o.email && slug == o.slug 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 [website, display_name, created, facebook, full_name, bio, language, linkedin, avatar, translated_from_id, twitter, deleted_at, name, id, updated, email, slug].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/update_languages_request_v_next.rb
lib/hubspot/codegen/cms/blogs/authors/models/update_languages_request_v_next.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors # Request object for updating languages within a multi-language group. class UpdateLanguagesRequestVNext # Map of object IDs to associated languages of object in the multi-language group. attr_accessor :languages # ID of the primary object in the multi-language group. attr_accessor :primary_id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'languages' => :'languages', :'primary_id' => :'primaryId' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'languages' => :'Hash<String, String>', :'primary_id' => :'String' } 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::Blogs::Authors::UpdateLanguagesRequestVNext` 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::Blogs::Authors::UpdateLanguagesRequestVNext`. 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?(:'languages') if (value = attributes[:'languages']).is_a?(Hash) self.languages = value end end if attributes.key?(:'primary_id') self.primary_id = attributes[:'primary_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 @languages.nil? invalid_properties.push('invalid value for "languages", languages cannot be nil.') end if @primary_id.nil? invalid_properties.push('invalid value for "primary_id", primary_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 @languages.nil? return false if @primary_id.nil? true 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 && languages == o.languages && primary_id == o.primary_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 [languages, primary_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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/models/error.rb
lib/hubspot/codegen/cms/blogs/authors/models/error.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Authors class Error # A specific category that contains more specific detail about the error attr_accessor :sub_category # Context about the error condition attr_accessor :context # A unique identifier for the request. Include this value with any error reports or support tickets attr_accessor :correlation_id # A map of link names to associated URIs containing documentation about the error or recommended remediation steps attr_accessor :links # A human readable message describing the error along with remediation steps where appropriate attr_accessor :message # The error category attr_accessor :category # further information about the error attr_accessor :errors # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'context' => :'context', :'correlation_id' => :'correlationId', :'links' => :'links', :'message' => :'message', :'category' => :'category', :'errors' => :'errors' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'String', :'context' => :'Hash<String, Array<String>>', :'correlation_id' => :'String', :'links' => :'Hash<String, String>', :'message' => :'String', :'category' => :'String', :'errors' => :'Array<ErrorDetail>' } 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::Blogs::Authors::Error` 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::Blogs::Authors::Error`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end 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 @correlation_id.nil? invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') end if @message.nil? invalid_properties.push('invalid value for "message", message cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category 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 @correlation_id.nil? return false if @message.nil? return false if @category.nil? true 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 && sub_category == o.sub_category && context == o.context && correlation_id == o.correlation_id && links == o.links && message == o.message && category == o.category && errors == o.errors 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 [sub_category, context, correlation_id, links, message, category, errors].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Authors.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/authors/api/blog_authors_api.rb
lib/hubspot/codegen/cms/blogs/authors/api/blog_authors_api.rb
=begin #Authors #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Cms module Blogs module Authors class BlogAuthorsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete a Blog Author # Delete the Blog Author object identified by the id in the path. # @param object_id [String] The Blog Author id. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Whether to return only results that have been archived. # @return [nil] def archive(object_id, opts = {}) archive_with_http_info(object_id, opts) nil end # Delete a Blog Author # Delete the Blog Author object identified by the id in the path. # @param object_id [String] The Blog Author id. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Whether to return only results that have been archived. # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.archive ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BlogAuthorsApi.archive" end # resource path local_var_path = '/cms/v3/blogs/authors/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.archive", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogAuthorsApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a batch of Blog Authors # Delete the Blog Author objects identified in the request body. # @param batch_input_string [BatchInputString] The JSON array of Blog Author ids. # @param [Hash] opts the optional parameters # @return [nil] def archive_batch(batch_input_string, opts = {}) archive_batch_with_http_info(batch_input_string, opts) nil end # Delete a batch of Blog Authors # Delete the Blog Author objects identified in the request body. # @param batch_input_string [BatchInputString] The JSON array of Blog Author ids. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_batch_with_http_info(batch_input_string, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.archive_batch ...' end # verify the required parameter 'batch_input_string' is set if @api_client.config.client_side_validation && batch_input_string.nil? fail ArgumentError, "Missing the required parameter 'batch_input_string' when calling BlogAuthorsApi.archive_batch" end # resource path local_var_path = '/cms/v3/blogs/authors/batch/archive' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_string) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.archive_batch", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogAuthorsApi#archive_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Attach a Blog Author to a multi-language group # Attach a Blog Author to a multi-language group. # @param attach_to_lang_primary_request_v_next [AttachToLangPrimaryRequestVNext] The JSON representation of the AttachToLangPrimaryRequest object. # @param [Hash] opts the optional parameters # @return [nil] def attach_to_lang_group(attach_to_lang_primary_request_v_next, opts = {}) attach_to_lang_group_with_http_info(attach_to_lang_primary_request_v_next, opts) nil end # Attach a Blog Author to a multi-language group # Attach a Blog Author to a multi-language group. # @param attach_to_lang_primary_request_v_next [AttachToLangPrimaryRequestVNext] The JSON representation of the AttachToLangPrimaryRequest object. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def attach_to_lang_group_with_http_info(attach_to_lang_primary_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.attach_to_lang_group ...' end # verify the required parameter 'attach_to_lang_primary_request_v_next' is set if @api_client.config.client_side_validation && attach_to_lang_primary_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'attach_to_lang_primary_request_v_next' when calling BlogAuthorsApi.attach_to_lang_group" end # resource path local_var_path = '/cms/v3/blogs/authors/multi-language/attach-to-lang-group' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(attach_to_lang_primary_request_v_next) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.attach_to_lang_group", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogAuthorsApi#attach_to_lang_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new Blog Author # Create a new Blog Author. # @param blog_author [BlogAuthor] The JSON representation of a new Blog Author. # @param [Hash] opts the optional parameters # @return [BlogAuthor] def create(blog_author, opts = {}) data, _status_code, _headers = create_with_http_info(blog_author, opts) data end # Create a new Blog Author # Create a new Blog Author. # @param blog_author [BlogAuthor] The JSON representation of a new Blog Author. # @param [Hash] opts the optional parameters # @return [Array<(BlogAuthor, Integer, Hash)>] BlogAuthor data, response status code and response headers def create_with_http_info(blog_author, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.create ...' end # verify the required parameter 'blog_author' is set if @api_client.config.client_side_validation && blog_author.nil? fail ArgumentError, "Missing the required parameter 'blog_author' when calling BlogAuthorsApi.create" end # resource path local_var_path = '/cms/v3/blogs/authors' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(blog_author) # return_type return_type = opts[:debug_return_type] || 'BlogAuthor' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.create", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogAuthorsApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a batch of Blog Authors # Create the Blog Author objects detailed in the request body. # @param batch_input_blog_author [BatchInputBlogAuthor] The JSON array of new Blog Authors to create. # @param [Hash] opts the optional parameters # @return [BatchResponseBlogAuthor] def create_batch(batch_input_blog_author, opts = {}) data, _status_code, _headers = create_batch_with_http_info(batch_input_blog_author, opts) data end # Create a batch of Blog Authors # Create the Blog Author objects detailed in the request body. # @param batch_input_blog_author [BatchInputBlogAuthor] The JSON array of new Blog Authors to create. # @param [Hash] opts the optional parameters # @return [Array<(BatchResponseBlogAuthor, Integer, Hash)>] BatchResponseBlogAuthor data, response status code and response headers def create_batch_with_http_info(batch_input_blog_author, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.create_batch ...' end # verify the required parameter 'batch_input_blog_author' is set if @api_client.config.client_side_validation && batch_input_blog_author.nil? fail ArgumentError, "Missing the required parameter 'batch_input_blog_author' when calling BlogAuthorsApi.create_batch" end # resource path local_var_path = '/cms/v3/blogs/authors/batch/create' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_blog_author) # return_type return_type = opts[:debug_return_type] || 'BatchResponseBlogAuthor' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.create_batch", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogAuthorsApi#create_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new language variation # Create a new language variation from an existing Blog Author. # @param blog_author_clone_request_v_next [BlogAuthorCloneRequestVNext] The JSON representation of the ContentLanguageCloneRequest object. # @param [Hash] opts the optional parameters # @return [BlogAuthor] def create_lang_variation(blog_author_clone_request_v_next, opts = {}) data, _status_code, _headers = create_lang_variation_with_http_info(blog_author_clone_request_v_next, opts) data end # Create a new language variation # Create a new language variation from an existing Blog Author. # @param blog_author_clone_request_v_next [BlogAuthorCloneRequestVNext] The JSON representation of the ContentLanguageCloneRequest object. # @param [Hash] opts the optional parameters # @return [Array<(BlogAuthor, Integer, Hash)>] BlogAuthor data, response status code and response headers def create_lang_variation_with_http_info(blog_author_clone_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.create_lang_variation ...' end # verify the required parameter 'blog_author_clone_request_v_next' is set if @api_client.config.client_side_validation && blog_author_clone_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'blog_author_clone_request_v_next' when calling BlogAuthorsApi.create_lang_variation" end # resource path local_var_path = '/cms/v3/blogs/authors/multi-language/create-language-variation' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(blog_author_clone_request_v_next) # return_type return_type = opts[:debug_return_type] || 'BlogAuthor' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.create_lang_variation", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogAuthorsApi#create_lang_variation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Detach a Blog Author from a multi-language group # Detach a Blog Author from a multi-language group. # @param detach_from_lang_group_request_v_next [DetachFromLangGroupRequestVNext] The JSON representation of the DetachFromLangGroupRequest object. # @param [Hash] opts the optional parameters # @return [nil] def detach_from_lang_group(detach_from_lang_group_request_v_next, opts = {}) detach_from_lang_group_with_http_info(detach_from_lang_group_request_v_next, opts) nil end # Detach a Blog Author from a multi-language group # Detach a Blog Author from a multi-language group. # @param detach_from_lang_group_request_v_next [DetachFromLangGroupRequestVNext] The JSON representation of the DetachFromLangGroupRequest object. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def detach_from_lang_group_with_http_info(detach_from_lang_group_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.detach_from_lang_group ...' end # verify the required parameter 'detach_from_lang_group_request_v_next' is set if @api_client.config.client_side_validation && detach_from_lang_group_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'detach_from_lang_group_request_v_next' when calling BlogAuthorsApi.detach_from_lang_group" end # resource path local_var_path = '/cms/v3/blogs/authors/multi-language/detach-from-lang-group' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(detach_from_lang_group_request_v_next) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.detach_from_lang_group", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogAuthorsApi#detach_from_lang_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a Blog Author # Retrieve the Blog Author object identified by the id in the path. # @param object_id [String] The Blog Author id. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted Blog Authors. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [BlogAuthor] def get_by_id(object_id, opts = {}) data, _status_code, _headers = get_by_id_with_http_info(object_id, opts) data end # Retrieve a Blog Author # Retrieve the Blog Author object identified by the id in the path. # @param object_id [String] The Blog Author id. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted Blog Authors. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [Array<(BlogAuthor, Integer, Hash)>] BlogAuthor data, response status code and response headers def get_by_id_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.get_by_id ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BlogAuthorsApi.get_by_id" end # resource path local_var_path = '/cms/v3/blogs/authors/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? query_params[:'property'] = opts[:'property'] if !opts[:'property'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'BlogAuthor' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.get_by_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogAuthorsApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all Blog Authors # Get the list of blog authors. Supports paging and filtering. This method would be useful for an integration that examined these models and used an external service to suggest edits. # @param [Hash] opts the optional parameters # @option opts [Time] :created_at Only return Blog Authors created at exactly the specified time. # @option opts [Time] :created_after Only return Blog Authors created after the specified time. # @option opts [Time] :created_before Only return Blog Authors created before the specified time. # @option opts [Time] :updated_at Only return Blog Authors last updated at exactly the specified time. # @option opts [Time] :updated_after Only return Blog Authors last updated after the specified time. # @option opts [Time] :updated_before Only return Blog Authors last updated before the specified time. # @option opts [Array<String>] :sort Specifies which fields to use for sorting results. Valid fields are &#x60;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [Integer] :limit The maximum number of results to return. Default is 100. # @option opts [Boolean] :archived Specifies whether to return deleted Blog Authors. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [CollectionResponseWithTotalBlogAuthorForwardPaging] def get_page(opts = {}) data, _status_code, _headers = get_page_with_http_info(opts) data end # Get all Blog Authors # Get the list of blog authors. Supports paging and filtering. This method would be useful for an integration that examined these models and used an external service to suggest edits. # @param [Hash] opts the optional parameters # @option opts [Time] :created_at Only return Blog Authors created at exactly the specified time. # @option opts [Time] :created_after Only return Blog Authors created after the specified time. # @option opts [Time] :created_before Only return Blog Authors created before the specified time. # @option opts [Time] :updated_at Only return Blog Authors last updated at exactly the specified time. # @option opts [Time] :updated_after Only return Blog Authors last updated after the specified time. # @option opts [Time] :updated_before Only return Blog Authors last updated before the specified time. # @option opts [Array<String>] :sort Specifies which fields to use for sorting results. Valid fields are &#x60;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [Integer] :limit The maximum number of results to return. Default is 100. # @option opts [Boolean] :archived Specifies whether to return deleted Blog Authors. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [Array<(CollectionResponseWithTotalBlogAuthorForwardPaging, Integer, Hash)>] CollectionResponseWithTotalBlogAuthorForwardPaging data, response status code and response headers def get_page_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogAuthorsApi.get_page ...' end # resource path local_var_path = '/cms/v3/blogs/authors' # query parameters query_params = opts[:query_params] || {} query_params[:'createdAt'] = opts[:'created_at'] if !opts[:'created_at'].nil? query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil? query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil? query_params[:'updatedAt'] = opts[:'updated_at'] if !opts[:'updated_at'].nil? query_params[:'updatedAfter'] = opts[:'updated_after'] if !opts[:'updated_after'].nil? query_params[:'updatedBefore'] = opts[:'updated_before'] if !opts[:'updated_before'].nil? query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? query_params[:'property'] = opts[:'property'] if !opts[:'property'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CollectionResponseWithTotalBlogAuthorForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogAuthorsApi.get_page", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type )
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
true
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/api_error.rb
lib/hubspot/codegen/cms/blogs/blog_posts/api_error.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end module Hubspot module Cms module Blogs module BlogPosts class ApiError < ::StandardError attr_reader :code, :response_headers, :response_body # Usage examples: # ApiError.new # ApiError.new("message") # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") # ApiError.new(:code => 404, :message => "Not Found") def initialize(arg = nil) if arg.is_a? Hash if arg.key?(:message) || arg.key?('message') super(arg[:message] || arg['message']) else super arg end arg.each do |k, v| instance_variable_set "@#{k}", v end else super arg end end # Override to_s to display a friendly error message def to_s message end def message if @message.nil? msg = "Error message: the server returns an error" else msg = @message end msg += "\nHTTP status code: #{code}" if code msg += "\nResponse headers: #{response_headers}" if response_headers msg += "\nResponse body: #{response_body}" if response_body msg end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/configuration.rb
lib/hubspot/codegen/cms/blogs/blog_posts/configuration.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end module Hubspot module Cms module Blogs module BlogPosts class Configuration # Defines url scheme attr_accessor :scheme # Defines url host attr_accessor :host # Defines url base path attr_accessor :base_path # Define server configuration index attr_accessor :server_index # Define server operation configuration index attr_accessor :server_operation_index # Default server variables attr_accessor :server_variables # Default server operation variables attr_accessor :server_operation_variables # Defines API keys used with API Key authentications. # # @return [Hash] key: parameter name, value: parameter value (API key) # # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) # config.api_key['api_key'] = 'xxx' attr_accessor :api_key # Defines API key prefixes used with API Key authentications. # # @return [Hash] key: parameter name, value: API key prefix # # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) # config.api_key_prefix['api_key'] = 'Token' attr_accessor :api_key_prefix # Defines the username used with HTTP basic authentication. # # @return [String] attr_accessor :username # Defines the password used with HTTP basic authentication. # # @return [String] attr_accessor :password # Defines the access token (Bearer) used with OAuth2. attr_accessor :access_token # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response # details will be logged with `logger.debug` (see the `logger` attribute). # Default to false. # # @return [true, false] attr_accessor :debugging # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # # @return [#debug] attr_accessor :logger # Defines the temporary folder to store downloaded files # (for API endpoints that have file response). # Default to use `Tempfile`. # # @return [String] attr_accessor :temp_folder_path # The time limit for HTTP request in seconds. # Default to 0 (never times out). attr_accessor :timeout # Set this to false to skip client side validation in the operation. # Default to true. # @return [true, false] attr_accessor :client_side_validation ### TLS/SSL setting # Set this to false to skip verifying SSL certificate when calling API from https server. # Default to true. # # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. # # @return [true, false] attr_accessor :verify_ssl ### TLS/SSL setting # Set this to false to skip verifying SSL host name # Default to true. # # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. # # @return [true, false] attr_accessor :verify_ssl_host ### TLS/SSL setting # Set this to customize the certificate file to verify the peer. # # @return [String] the path to the certificate file # # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 attr_accessor :ssl_ca_cert ### TLS/SSL setting # Client certificate file (for client certificate) attr_accessor :cert_file ### TLS/SSL setting # Client private key file (for client certificate) attr_accessor :key_file # Set this to customize parameters encoding of array parameter with multi collectionFormat. # Default to nil. # # @see The params_encoding option of Ethon. Related source code: # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding attr_accessor :inject_format attr_accessor :force_ending_format attr_accessor :error_handler def initialize @scheme = 'https' @host = 'api.hubapi.com' @base_path = '' @server_index = 0 @server_operation_index = {} @server_variables = {} @server_operation_variables = {} @api_key = {} @api_key_prefix = {} @client_side_validation = true @verify_ssl = true @verify_ssl_host = true @cert_file = nil @key_file = nil @timeout = 0 @params_encoding = nil @debugging = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) # error_handler params: { 'status_code': { max_retries: ..., seconds_delay: ... }, ... } @error_handler = {} yield(self) if block_given? end # The default Configuration object. def self.default @@default ||= Configuration.new end def configure yield(self) if block_given? end def scheme=(scheme) # remove :// from scheme @scheme = scheme.sub(/:\/\//, '') end def host=(host) # remove http(s):// and anything after a slash @host = host.sub(/https?:\/\//, '').split('/').first end def base_path=(base_path) # Add leading and trailing slashes to base_path @base_path = "/#{base_path}".gsub(/\/+/, '/') @base_path = '' if @base_path == '/' end # Returns base URL for specified operation based on server settings def base_url(operation = nil) index = server_operation_index.fetch(operation, server_index) return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) end # Gets API key (with prefix if set). # @param [String] param_name the parameter name of API key auth def api_key_with_prefix(param_name, param_alias = nil) key = @api_key[param_name] key = @api_key.fetch(param_alias, key) unless param_alias.nil? if @api_key_prefix[param_name] "#{@api_key_prefix[param_name]} #{key}" else key end end # Gets Basic Auth token string def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") end # Returns Auth Settings hash for api client. def auth_settings { 'oauth2' => { type: 'oauth2', in: 'header', key: 'Authorization', value: "Bearer #{access_token}" }, } end # Returns an array of Server setting def server_settings [ { url: "https://api.hubapi.com", description: "No description provided", } ] end def operation_server_settings { } end # Returns URL based on server settings # # @param index array index of the server settings # @param variables hash of variable and the corresponding value def server_url(index, variables = {}, servers = nil) servers = server_settings if servers == nil # check array index out of bound if (index < 0 || index >= servers.size) fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" end server = servers[index] url = server[:url] return url unless server.key? :variables # go through variable and assign a value server[:variables].each do |name, variable| if variables.key?(name) if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) url.gsub! "{" + name.to_s + "}", variables[name] else fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." end else # use default value url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] end end url end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/api_client.rb
lib/hubspot/codegen/cms/blogs/blog_posts/api_client.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'json' require 'logger' require 'tempfile' require 'time' require 'typhoeus' module Hubspot module Cms module Blogs module BlogPosts class ApiClient # The Configuration object holding settings to be used in the API client. attr_accessor :config # Defines the headers to be used in HTTP requests of all API calls by default. # # @return [Hash] attr_accessor :default_headers # Initializes the ApiClient # @option config [Configuration] Configuration for initializing the object, default to Configuration.default def initialize(config = Configuration.default) @config = config @user_agent = "hubspot-api-client-ruby; #{VERSION}" @default_headers = { 'Content-Type' => 'application/json', 'User-Agent' => @user_agent } end def self.default @@default ||= ApiClient.new end # Call an API with given options. # # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: # the data deserialized from response body (could be nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) response = request.run if @config.debugging @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" end if !response.success? && config.error_handler.any? config.error_handler.each do |statuses, opts| statuses = statuses.is_a?(Integer) ? [statuses] : statuses retries = opts[:max_retries] || 5 while retries > 0 && statuses.include?(response.code) sleep opts[:seconds_delay] if opts[:seconds_delay] response = request.run opts[:retry_block].call if opts[:retry_block] retries -= 1 end end end unless response.success? if response.timed_out? fail ApiError.new('Connection timed out') elsif response.code == 0 # Errors from libcurl will be made visible here fail ApiError.new(:code => 0, :message => response.return_message) else fail ApiError.new(:code => response.code, :response_headers => response.headers, :response_body => response.body), response.status_message end end if opts[:return_type] data = deserialize(response, opts[:return_type]) else data = nil end return data, response.code, response.headers end # Builds the HTTP request # # @param [String] http_method HTTP method/verb (e.g. POST) # @param [String] path URL path (e.g. /account/new) # @option opts [Hash] :header_params Header parameters # @option opts [Hash] :query_params Query parameters # @option opts [Hash] :form_params Query parameters # @option opts [Object] :body HTTP body (JSON/XML) # @return [Typhoeus::Request] A Typhoeus Request def build_request(http_method, path, opts = {}) url = build_request_url(path, opts) http_method = http_method.to_sym.downcase header_params = @default_headers.merge(opts[:header_params] || {}) query_params = opts[:query_params] || {} form_params = opts[:form_params] || {} follow_location = opts[:follow_location] || true update_params_for_auth! header_params, query_params, opts[:auth_names] # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 req_opts = { :method => http_method, :headers => header_params, :params => query_params, :params_encoding => @config.params_encoding, :timeout => @config.timeout, :ssl_verifypeer => @config.verify_ssl, :ssl_verifyhost => _verify_ssl_host, :sslcert => @config.cert_file, :sslkey => @config.key_file, :verbose => @config.debugging, :followlocation => follow_location } # set custom cert, if provided req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert if [:post, :patch, :put, :delete].include?(http_method) req_body = build_request_body(header_params, form_params, opts[:body]) req_opts.update :body => req_body if @config.debugging @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" end end request = Typhoeus::Request.new(url, req_opts) download_file(request) if opts[:return_type] == 'File' request end # Builds the HTTP request body # # @param [Hash] header_params Header parameters # @param [Hash] form_params Query parameters # @param [Object] body HTTP body (JSON/XML) # @return [String] HTTP body data in the form of string def build_request_body(header_params, form_params, body) # http form if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || header_params['Content-Type'] == 'multipart/form-data' data = {} form_params.each do |key, value| case value when ::File, ::Array, nil # let typhoeus handle File, Array and nil parameters data[key] = value else data[key] = value.to_s end end elsif body data = body.is_a?(String) ? body : body.to_json else data = nil end data end # Save response body into a file in (the defined) temporary folder, using the filename # from the "Content-Disposition" header if provided, otherwise a random filename. # The response body is written to the file in chunks in order to handle files which # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby # process can use. # # @see Configuration#temp_folder_path def download_file(request) tempfile = nil encoding = nil request.on_headers do |response| content_disposition = response.headers['Content-Disposition'] if content_disposition && content_disposition =~ /filename=/i filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] prefix = sanitize_filename(filename) else prefix = 'download-' end prefix = prefix + '-' unless prefix.end_with?('-') encoding = response.body.encoding tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) @tempfile = tempfile end request.on_body do |chunk| chunk.force_encoding(encoding) tempfile.write(chunk) end request.on_complete do |response| if tempfile tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" end end end # Check if the given MIME is a JSON MIME. # JSON MIME examples: # application/json # application/json; charset=UTF8 # APPLICATION/JSON # */* # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. # # @param [Response] response HTTP response # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>" def deserialize(response, return_type) body = response.body # handle file downloading - return the File instance processed in request callbacks # note that response body is empty when the file is written in chunks in request on_body callback return @tempfile if return_type == 'File' return nil if body.nil? || body.empty? # return response body directly for String return type return body if return_type == 'String' # ensuring a default content type content_type = response.headers['Content-Type'] || 'application/json' fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) begin data = JSON.parse("[#{body}]", :symbolize_names => true)[0] rescue JSON::ParserError => e if %w(String Date Time).include?(return_type) data = body else raise e end end convert_to_type data, return_type end # Convert data to the given return type. # @param [Object] data Data to be converted # @param [String] return_type Return type # @return [Mixed] Data in a particular type def convert_to_type(data, return_type) return nil if data.nil? case return_type when 'String' data.to_s when 'Integer' data.to_i when 'Float' data.to_f when 'Boolean' data == true when 'Time' # parse date time (expecting ISO 8601 format) Time.parse data when 'Date' # parse date time (expecting ISO 8601 format) Date.parse data when 'Object' # generic object (usually a Hash), return directly data when /\AArray<(.+)>\z/ # e.g. Array<Pet> sub_type = $1 data.map { |item| convert_to_type(item, sub_type) } when /\AHash\<String, (.+)\>\z/ # e.g. Hash<String, Integer> sub_type = $1 {}.tap do |hash| data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(return_type) klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) end end # Sanitize filename by removing path. # e.g. ../../sun.gif becomes sun.gif # # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) filename.gsub(/.*[\/\\]/, '') end def build_request_url(path, opts = {}) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') @config.base_url(opts[:operation]) + path end # Update header and query params based on authentication settings. # # @param [Hash] header_params Header parameters # @param [Hash] query_params Query parameters # @param [String] auth_names Authentication scheme name def update_params_for_auth!(header_params, query_params, auth_names) Array(auth_names).each do |auth_name| auth_setting = @config.auth_settings[auth_name] next unless auth_setting case auth_setting[:in] when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] else fail ArgumentError, 'Authentication token must be in `query` or `header`' end end end # Sets user agent in HTTP header # # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) def user_agent=(user_agent) @user_agent = user_agent @default_headers['User-Agent'] = @user_agent end # Return Accept header based on an array of accepts provided. # @param [Array] accepts array for Accept # @return [String] the Accept header (e.g. application/json) def select_header_accept(accepts) return nil if accepts.nil? || accepts.empty? # use JSON when present, otherwise use all of the provided json_accept = accepts.find { |s| json_mime?(s) } json_accept || accepts.join(',') end # Return Content-Type header based on an array of content types provided. # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # return nil by default return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first end # Convert object (array, hash, object, etc) to JSON string. # @param [Object] model object to be converted into JSON string # @return [String] JSON string representation of the object def object_to_http_body(model) return model if model.nil? || model.is_a?(String) local_body = nil if model.is_a?(Array) local_body = model.map { |m| object_to_hash(m) } else local_body = object_to_hash(model) end local_body.to_json end # Convert object(non-array) to hash. # @param [Object] obj object to be converted into JSON string # @return [String] JSON string representation of the object def object_to_hash(obj) if obj.respond_to?(:to_hash) obj.to_hash else obj end end # Build parameter value according to the given collection format. # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi def build_collection_param(param, collection_format) case collection_format when :csv param.join(',') when :ssv param.join(' ') when :tsv param.join("\t") when :pipes param.join('|') when :multi # return the array directly as typhoeus will handle it as expected param else fail "unknown collection format: #{collection_format.inspect}" end end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_input_string.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_input_string.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Wrapper for providing an array of strings as inputs. class BatchInputString # Strings to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<String>' } 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::Blogs::BlogPosts::BatchInputString` 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::Blogs::BlogPosts::BatchInputString`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_response_blog_post_with_errors.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_response_blog_post_with_errors.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Response object for batch operations on blog posts with errors. class BatchResponseBlogPostWithErrors # Time of batch operation completion. attr_accessor :completed_at # Number of errors. attr_accessor :num_errors # Time of batch operation request. attr_accessor :requested_at # Time of batch operation start. attr_accessor :started_at # Links associated with batch operation. attr_accessor :links # Results of batch operation. attr_accessor :results # Errors in batch operation. attr_accessor :errors # Status of batch operation. attr_accessor :status 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 { :'completed_at' => :'completedAt', :'num_errors' => :'numErrors', :'requested_at' => :'requestedAt', :'started_at' => :'startedAt', :'links' => :'links', :'results' => :'results', :'errors' => :'errors', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'completed_at' => :'Time', :'num_errors' => :'Integer', :'requested_at' => :'Time', :'started_at' => :'Time', :'links' => :'Hash<String, String>', :'results' => :'Array<BlogPost>', :'errors' => :'Array<StandardError>', :'status' => :'String' } 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::Blogs::BlogPosts::BatchResponseBlogPostWithErrors` 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::Blogs::BlogPosts::BatchResponseBlogPostWithErrors`. 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?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'num_errors') self.num_errors = attributes[:'num_errors'] end if attributes.key?(:'requested_at') self.requested_at = attributes[:'requested_at'] end if attributes.key?(:'started_at') self.started_at = attributes[:'started_at'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @completed_at.nil? invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.') end if @started_at.nil? invalid_properties.push('invalid value for "started_at", started_at cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @completed_at.nil? return false if @started_at.nil? return false if @results.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) return false unless status_validator.valid?(@status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) unless validator.valid?(status) fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." end @status = status 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 && completed_at == o.completed_at && num_errors == o.num_errors && requested_at == o.requested_at && started_at == o.started_at && links == o.links && results == o.results && errors == o.errors && status == o.status 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 [completed_at, num_errors, requested_at, started_at, links, results, errors, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/gradient.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/gradient.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class Gradient attr_accessor :angle attr_accessor :side_or_corner attr_accessor :colors # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'angle' => :'angle', :'side_or_corner' => :'sideOrCorner', :'colors' => :'colors' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'angle' => :'Angle', :'side_or_corner' => :'SideOrCorner', :'colors' => :'Array<ColorStop>' } 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::Blogs::BlogPosts::Gradient` 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::Blogs::BlogPosts::Gradient`. 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?(:'angle') self.angle = attributes[:'angle'] end if attributes.key?(:'side_or_corner') self.side_or_corner = attributes[:'side_or_corner'] end if attributes.key?(:'colors') if (value = attributes[:'colors']).is_a?(Array) self.colors = value end 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 @angle.nil? invalid_properties.push('invalid value for "angle", angle cannot be nil.') end if @side_or_corner.nil? invalid_properties.push('invalid value for "side_or_corner", side_or_corner cannot be nil.') end if @colors.nil? invalid_properties.push('invalid value for "colors", colors 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 @angle.nil? return false if @side_or_corner.nil? return false if @colors.nil? true 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 && angle == o.angle && side_or_corner == o.side_or_corner && colors == o.colors 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 [angle, side_or_corner, colors].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/styles.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/styles.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class Styles attr_accessor :background_color attr_accessor :flexbox_positioning attr_accessor :background_image attr_accessor :force_full_width_section attr_accessor :breakpoint_styles attr_accessor :vertical_alignment attr_accessor :max_width_section_centering attr_accessor :background_gradient # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'background_color' => :'backgroundColor', :'flexbox_positioning' => :'flexboxPositioning', :'background_image' => :'backgroundImage', :'force_full_width_section' => :'forceFullWidthSection', :'breakpoint_styles' => :'breakpointStyles', :'vertical_alignment' => :'verticalAlignment', :'max_width_section_centering' => :'maxWidthSectionCentering', :'background_gradient' => :'backgroundGradient' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'background_color' => :'RGBAColor', :'flexbox_positioning' => :'String', :'background_image' => :'BackgroundImage', :'force_full_width_section' => :'Boolean', :'breakpoint_styles' => :'Hash<String, BreakpointStyles>', :'vertical_alignment' => :'String', :'max_width_section_centering' => :'Integer', :'background_gradient' => :'Gradient' } 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::Blogs::BlogPosts::Styles` 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::Blogs::BlogPosts::Styles`. 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?(:'background_color') self.background_color = attributes[:'background_color'] end if attributes.key?(:'flexbox_positioning') self.flexbox_positioning = attributes[:'flexbox_positioning'] end if attributes.key?(:'background_image') self.background_image = attributes[:'background_image'] end if attributes.key?(:'force_full_width_section') self.force_full_width_section = attributes[:'force_full_width_section'] end if attributes.key?(:'breakpoint_styles') if (value = attributes[:'breakpoint_styles']).is_a?(Hash) self.breakpoint_styles = value end end if attributes.key?(:'vertical_alignment') self.vertical_alignment = attributes[:'vertical_alignment'] end if attributes.key?(:'max_width_section_centering') self.max_width_section_centering = attributes[:'max_width_section_centering'] end if attributes.key?(:'background_gradient') self.background_gradient = attributes[:'background_gradient'] 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 @background_color.nil? invalid_properties.push('invalid value for "background_color", background_color cannot be nil.') end if @flexbox_positioning.nil? invalid_properties.push('invalid value for "flexbox_positioning", flexbox_positioning cannot be nil.') end if @background_image.nil? invalid_properties.push('invalid value for "background_image", background_image cannot be nil.') end if @force_full_width_section.nil? invalid_properties.push('invalid value for "force_full_width_section", force_full_width_section cannot be nil.') end if @vertical_alignment.nil? invalid_properties.push('invalid value for "vertical_alignment", vertical_alignment cannot be nil.') end if @max_width_section_centering.nil? invalid_properties.push('invalid value for "max_width_section_centering", max_width_section_centering cannot be nil.') end if @background_gradient.nil? invalid_properties.push('invalid value for "background_gradient", background_gradient 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 @background_color.nil? return false if @flexbox_positioning.nil? return false if @background_image.nil? return false if @force_full_width_section.nil? return false if @vertical_alignment.nil? return false if @max_width_section_centering.nil? return false if @background_gradient.nil? true 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 && background_color == o.background_color && flexbox_positioning == o.flexbox_positioning && background_image == o.background_image && force_full_width_section == o.force_full_width_section && breakpoint_styles == o.breakpoint_styles && vertical_alignment == o.vertical_alignment && max_width_section_centering == o.max_width_section_centering && background_gradient == o.background_gradient 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 [background_color, flexbox_positioning, background_image, force_full_width_section, breakpoint_styles, vertical_alignment, max_width_section_centering, background_gradient].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/standard_error.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/standard_error.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Model definition for a standard error. class StandardError # Error subcategory. attr_accessor :sub_category # Error context. attr_accessor :context # Error links. attr_accessor :links # Error ID. attr_accessor :id # Error category. attr_accessor :category # Error message. attr_accessor :message # List of error details. attr_accessor :errors # Error status. attr_accessor :status # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'context' => :'context', :'links' => :'links', :'id' => :'id', :'category' => :'category', :'message' => :'message', :'errors' => :'errors', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'Object', :'context' => :'Hash<String, Array<String>>', :'links' => :'Hash<String, String>', :'id' => :'String', :'category' => :'String', :'message' => :'String', :'errors' => :'Array<ErrorDetail>', :'status' => :'String' } 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::Blogs::BlogPosts::StandardError` 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::Blogs::BlogPosts::StandardError`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @context.nil? invalid_properties.push('invalid value for "context", context cannot be nil.') end if @links.nil? invalid_properties.push('invalid value for "links", links cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category cannot be nil.') end if @message.nil? invalid_properties.push('invalid value for "message", message cannot be nil.') end if @errors.nil? invalid_properties.push('invalid value for "errors", errors cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @context.nil? return false if @links.nil? return false if @category.nil? return false if @message.nil? return false if @errors.nil? return false if @status.nil? true 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 && sub_category == o.sub_category && context == o.context && links == o.links && id == o.id && category == o.category && message == o.message && errors == o.errors && status == o.status 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 [sub_category, context, links, id, category, message, errors, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/version_user.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/version_user.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Model definition for a version user. Contains addition information about the user who created a version. class VersionUser # The first and last name of the User. attr_accessor :full_name # The unique ID of the User. attr_accessor :id # The email address of the user. attr_accessor :email # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'full_name' => :'fullName', :'id' => :'id', :'email' => :'email' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'full_name' => :'String', :'id' => :'String', :'email' => :'String' } 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::Blogs::BlogPosts::VersionUser` 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::Blogs::BlogPosts::VersionUser`. 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?(:'full_name') self.full_name = attributes[:'full_name'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'email') self.email = attributes[:'email'] 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 @full_name.nil? invalid_properties.push('invalid value for "full_name", full_name cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @email.nil? invalid_properties.push('invalid value for "email", email 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 @full_name.nil? return false if @id.nil? return false if @email.nil? true 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 && full_name == o.full_name && id == o.id && email == o.email 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 [full_name, id, email].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/side_or_corner.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/side_or_corner.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class SideOrCorner attr_accessor :horizontal_side attr_accessor :vertical_side # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'horizontal_side' => :'horizontalSide', :'vertical_side' => :'verticalSide' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'horizontal_side' => :'String', :'vertical_side' => :'String' } 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::Blogs::BlogPosts::SideOrCorner` 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::Blogs::BlogPosts::SideOrCorner`. 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?(:'horizontal_side') self.horizontal_side = attributes[:'horizontal_side'] end if attributes.key?(:'vertical_side') self.vertical_side = attributes[:'vertical_side'] 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 @horizontal_side.nil? invalid_properties.push('invalid value for "horizontal_side", horizontal_side cannot be nil.') end if @vertical_side.nil? invalid_properties.push('invalid value for "vertical_side", vertical_side 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 @horizontal_side.nil? return false if @vertical_side.nil? true 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 && horizontal_side == o.horizontal_side && vertical_side == o.vertical_side 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 [horizontal_side, vertical_side].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/collection_response_with_total_blog_post_forward_paging.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/collection_response_with_total_blog_post_forward_paging.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Response object for collections of blog posts with pagination information. class CollectionResponseWithTotalBlogPostForwardPaging # Total number of blog posts. attr_accessor :total attr_accessor :paging # Collection of blog posts. attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'total' => :'total', :'paging' => :'paging', :'results' => :'results' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'total' => :'Integer', :'paging' => :'ForwardPaging', :'results' => :'Array<BlogPost>' } 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::Blogs::BlogPosts::CollectionResponseWithTotalBlogPostForwardPaging` 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::Blogs::BlogPosts::CollectionResponseWithTotalBlogPostForwardPaging`. 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?(:'total') self.total = attributes[:'total'] end if attributes.key?(:'paging') self.paging = attributes[:'paging'] end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end 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 @total.nil? invalid_properties.push('invalid value for "total", total cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results 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 @total.nil? return false if @results.nil? true 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 && total == o.total && paging == o.paging && results == o.results 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 [total, paging, results].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/background_image.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/background_image.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class BackgroundImage attr_accessor :image_url attr_accessor :background_size attr_accessor :background_position # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'image_url' => :'imageUrl', :'background_size' => :'backgroundSize', :'background_position' => :'backgroundPosition' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'image_url' => :'String', :'background_size' => :'String', :'background_position' => :'String' } 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::Blogs::BlogPosts::BackgroundImage` 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::Blogs::BlogPosts::BackgroundImage`. 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?(:'image_url') self.image_url = attributes[:'image_url'] end if attributes.key?(:'background_size') self.background_size = attributes[:'background_size'] end if attributes.key?(:'background_position') self.background_position = attributes[:'background_position'] 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 @image_url.nil? invalid_properties.push('invalid value for "image_url", image_url cannot be nil.') end if @background_size.nil? invalid_properties.push('invalid value for "background_size", background_size cannot be nil.') end if @background_position.nil? invalid_properties.push('invalid value for "background_position", background_position 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 @image_url.nil? return false if @background_size.nil? return false if @background_position.nil? true 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 && image_url == o.image_url && background_size == o.background_size && background_position == o.background_position 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 [image_url, background_size, background_position].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/attach_to_lang_primary_request_v_next.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/attach_to_lang_primary_request_v_next.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Request body object for attaching objects to multi-language groups. class AttachToLangPrimaryRequestVNext # Designated language of the object to add to a multi-language group. attr_accessor :language # ID of the object to add to a multi-language group. attr_accessor :id # ID of primary language object in multi-language group. attr_accessor :primary_id # Primary language of the multi-language group. attr_accessor :primary_language 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 { :'language' => :'language', :'id' => :'id', :'primary_id' => :'primaryId', :'primary_language' => :'primaryLanguage' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'language' => :'String', :'id' => :'String', :'primary_id' => :'String', :'primary_language' => :'String' } 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::Blogs::BlogPosts::AttachToLangPrimaryRequestVNext` 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::Blogs::BlogPosts::AttachToLangPrimaryRequestVNext`. 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?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'primary_id') self.primary_id = attributes[:'primary_id'] end if attributes.key?(:'primary_language') self.primary_language = attributes[:'primary_language'] 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 @language.nil? invalid_properties.push('invalid value for "language", language cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @primary_id.nil? invalid_properties.push('invalid value for "primary_id", primary_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 @language.nil? language_validator = EnumAttributeValidator.new('String', ["af", "af-na", "af-za", "agq", "agq-cm", "ak", "ak-gh", "am", "am-et", "ar", "ar-001", "ar-ae", "ar-bh", "ar-dj", "ar-dz", "ar-eg", "ar-eh", "ar-er", "ar-il", "ar-iq", "ar-jo", "ar-km", "ar-kw", "ar-lb", "ar-ly", "ar-ma", "ar-mr", "ar-om", "ar-ps", "ar-qa", "ar-sa", "ar-sd", "ar-so", "ar-ss", "ar-sy", "ar-td", "ar-tn", "ar-ye", "as", "as-in", "asa", "asa-tz", "ast", "ast-es", "az", "az-az", "bas", "bas-cm", "be", "be-by", "bem", "bem-zm", "bez", "bez-tz", "bg", "bg-bg", "bm", "bm-ml", "bn", "bn-bd", "bn-in", "bo", "bo-cn", "bo-in", "br", "br-fr", "brx", "brx-in", "bs", "bs-ba", "ca", "ca-ad", "ca-es", "ca-fr", "ca-it", "ccp", "ccp-bd", "ccp-in", "ce", "ce-ru", "ceb", "ceb-ph", "cgg", "cgg-ug", "chr", "chr-us", "ckb", "ckb-iq", "ckb-ir", "cs", "cs-cz", "cu", "cu-ru", "cy", "cy-gb", "da", "da-dk", "da-gl", "dav", "dav-ke", "de", "de-at", "de-be", "de-ch", "de-de", "de-gr", "de-it", "de-li", "de-lu", "dje", "dje-ne", "doi", "doi-in", "dsb", "dsb-de", "dua", "dua-cm", "dyo", "dyo-sn", "dz", "dz-bt", "ebu", "ebu-ke", "ee", "ee-gh", "ee-tg", "el", "el-cy", "el-gr", "en", "en-001", "en-150", "en-ae", "en-ag", "en-ai", "en-as", "en-at", "en-au", "en-bb", "en-be", "en-bi", "en-bm", "en-bs", "en-bw", "en-bz", "en-ca", "en-cc", "en-ch", "en-ck", "en-cm", "en-cn", "en-cx", "en-cy", "en-de", "en-dg", "en-dk", "en-dm", "en-ee", "en-er", "en-fr", "en-fi", "en-fj", "en-fk", "en-fm", "en-gb", "en-gd", "en-gg", "en-gh", "en-gi", "en-gm", "en-gu", "en-gy", "en-hk", "en-ie", "en-il", "en-im", "en-in", "en-io", "en-je", "en-jm", "en-ke", "en-ki", "en-kn", "en-ky", "en-lc", "en-lr", "en-ls", "en-lu", "en-mg", "en-mh", "en-mo", "en-mp", "en-ms", "en-mt", "en-mu", "en-mw", "en-mx", "en-my", "en-na", "en-nf", "en-ng", "en-nl", "en-nr", "en-nu", "en-nz", "en-pg", "en-ph", "en-pk", "en-pn", "en-pr", "en-pw", "en-rw", "en-sb", "en-sc", "en-sd", "en-se", "en-sg", "en-sh", "en-si", "en-sl", "en-ss", "en-sx", "en-sz", "en-tc", "en-tk", "en-to", "en-tt", "en-tv", "en-tz", "en-ug", "en-um", "en-us", "en-vc", "en-vg", "en-vi", "en-vu", "en-ws", "en-za", "en-zm", "en-zw", "eo", "eo-001", "es", "es-419", "es-ar", "es-bo", "es-br", "es-bz", "es-cl", "es-co", "es-cr", "es-cu", "es-do", "es-ea", "es-ec", "es-es", "es-gq", "es-gt", "es-hn", "es-ic", "es-mx", "es-ni", "es-pa", "es-pe", "es-ph", "es-pr", "es-py", "es-sv", "es-us", "es-uy", "es-ve", "et", "et-ee", "eu", "eu-es", "ewo", "ewo-cm", "fa", "fa-af", "fa-ir", "ff", "ff-bf", "ff-cm", "ff-gh", "ff-gm", "ff-gn", "ff-gw", "ff-lr", "ff-mr", "ff-ne", "ff-ng", "ff-sl", "ff-sn", "fi", "fi-fi", "fil", "fil-ph", "fo", "fo-dk", "fo-fo", "fr", "fr-be", "fr-bf", "fr-bi", "fr-bj", "fr-bl", "fr-ca", "fr-cd", "fr-cf", "fr-cg", "fr-ch", "fr-ci", "fr-cm", "fr-dj", "fr-dz", "fr-fr", "fr-ga", "fr-gf", "fr-gn", "fr-gp", "fr-gq", "fr-ht", "fr-km", "fr-lu", "fr-ma", "fr-mc", "fr-mf", "fr-mg", "fr-ml", "fr-mq", "fr-mr", "fr-mu", "fr-nc", "fr-ne", "fr-pf", "fr-pm", "fr-re", "fr-rw", "fr-sc", "fr-sn", "fr-sy", "fr-td", "fr-tg", "fr-tn", "fr-vu", "fr-wf", "fr-yt", "fur", "fur-it", "fy", "fy-nl", "ga", "ga-gb", "ga-ie", "gd", "gd-gb", "gl", "gl-es", "gsw", "gsw-ch", "gsw-fr", "gsw-li", "gu", "gu-in", "guz", "guz-ke", "gv", "gv-im", "ha", "ha-gh", "ha-ne", "ha-ng", "haw", "haw-us", "he", "hi", "hi-in", "hr", "hr-ba", "hr-hr", "hsb", "hsb-de", "hu", "hu-hu", "hy", "hy-am", "ia", "ia-001", "id", "ig", "ig-ng", "ii", "ii-cn", "id-id", "is", "is-is", "it", "it-ch", "it-it", "it-sm", "it-va", "he-il", "ja", "ja-jp", "jgo", "jgo-cm", "yi", "yi-001", "jmc", "jmc-tz", "jv", "jv-id", "ka", "ka-ge", "kab", "kab-dz", "kam", "kam-ke", "kde", "kde-tz", "kea", "kea-cv", "khq", "khq-ml", "ki", "ki-ke", "kk", "kk-kz", "kkj", "kkj-cm", "kl", "kl-gl", "kln", "kln-ke", "km", "km-kh", "kn", "kn-in", "ko", "ko-kp", "ko-kr", "kok", "kok-in", "ks", "ks-in", "ksb", "ksb-tz", "ksf", "ksf-cm", "ksh", "ksh-de", "kw", "kw-gb", "ku", "ku-tr", "ky", "ky-kg", "lag", "lag-tz", "lb", "lb-lu", "lg", "lg-ug", "lkt", "lkt-us", "ln", "ln-ao", "ln-cd", "ln-cf", "ln-cg", "lo", "lo-la", "lrc", "lrc-iq", "lrc-ir", "lt", "lt-lt", "lu", "lu-cd", "luo", "luo-ke", "luy", "luy-ke", "lv", "lv-lv", "mai", "mai-in", "mas", "mas-ke", "mas-tz", "mer", "mer-ke", "mfe", "mfe-mu", "mg", "mg-mg", "mgh", "mgh-mz", "mgo", "mgo-cm", "mi", "mi-nz", "mk", "mk-mk", "ml", "ml-in", "mn", "mn-mn", "mni", "mni-in", "mr", "mr-in", "ms", "ms-bn", "ms-id", "ms-my", "ms-sg", "mt", "mt-mt", "mua", "mua-cm", "my", "my-mm", "mzn", "mzn-ir", "naq", "naq-na", "nb", "nb-no", "nb-sj", "nd", "nd-zw", "nds", "nds-de", "nds-nl", "ne", "ne-in", "ne-np", "nl", "nl-aw", "nl-be", "nl-ch", "nl-bq", "nl-cw", "nl-lu", "nl-nl", "nl-sr", "nl-sx", "nmg", "nmg-cm", "nn", "nn-no", "nnh", "nnh-cm", "no", "no-no", "nus", "nus-ss", "nyn", "nyn-ug", "om", "om-et", "om-ke", "or", "or-in", "os", "os-ge", "os-ru", "pa", "pa-in", "pa-pk", "pcm", "pcm-ng", "pl", "pl-pl", "prg", "prg-001", "ps", "ps-af", "ps-pk", "pt", "pt-ao", "pt-br", "pt-ch", "pt-cv", "pt-gq", "pt-gw", "pt-lu", "pt-mo", "pt-mz", "pt-pt", "pt-st", "pt-tl", "qu", "qu-bo", "qu-ec", "qu-pe", "rm", "rm-ch", "rn", "rn-bi", "ro", "ro-md", "ro-ro", "rof", "rof-tz", "ru", "ru-by", "ru-kg", "ru-kz", "ru-md", "ru-ru", "ru-ua", "rw", "rw-rw", "rwk", "rwk-tz", "sa", "sa-in", "sah", "sah-ru", "saq", "saq-ke", "sat", "sat-in", "sbp", "sbp-tz", "sd", "sd-in", "sd-pk", "se", "se-fi", "se-no", "se-se", "seh", "seh-mz", "ses", "ses-ml", "sg", "sg-cf", "shi", "shi-ma", "si", "si-lk", "sk", "sk-sk", "sl", "sl-si", "smn", "smn-fi", "sn", "sn-zw", "so", "so-dj", "so-et", "so-ke", "so-so", "sq", "sq-al", "sq-mk", "sq-xk", "sr", "sr-ba", "sr-cs", "sr-me", "sr-rs", "sr-xk", "su", "su-id", "sv", "sv-ax", "sv-fi", "sv-se", "sw", "sw-cd", "sw-ke", "sw-tz", "sw-ug", "sy", "ta", "ta-in", "ta-lk", "ta-my", "ta-sg", "te", "te-in", "teo", "teo-ke", "teo-ug", "tg", "tg-tj", "th", "th-th", "ti", "ti-er", "ti-et", "tk", "tk-tm", "tl", "to", "to-to", "tr", "tr-cy", "tr-tr", "tt", "tt-ru", "twq", "twq-ne", "tzm", "tzm-ma", "ug", "ug-cn", "uk", "uk-ua", "ur", "ur-in", "ur-pk", "uz", "uz-af", "uz-uz", "vai", "vai-lr", "vi", "vi-vn", "vo", "vo-001", "vun", "vun-tz", "wae", "wae-ch", "wo", "wo-sn", "xh", "xh-za", "xog", "xog-ug", "yav", "yav-cm", "yo", "yo-bj", "yo-ng", "yue", "yue-cn", "yue-hk", "zgh", "zgh-ma", "zh", "zh-cn", "zh-hk", "zh-mo", "zh-sg", "zh-tw", "zh-hans", "zh-hant", "zu", "zu-za"]) return false unless language_validator.valid?(@language) return false if @id.nil? return false if @primary_id.nil? true end # Custom attribute writer method checking allowed values (enum). # @param [Object] language Object to be assigned def language=(language) validator = EnumAttributeValidator.new('String', ["af", "af-na", "af-za", "agq", "agq-cm", "ak", "ak-gh", "am", "am-et", "ar", "ar-001", "ar-ae", "ar-bh", "ar-dj", "ar-dz", "ar-eg", "ar-eh", "ar-er", "ar-il", "ar-iq", "ar-jo", "ar-km", "ar-kw", "ar-lb", "ar-ly", "ar-ma", "ar-mr", "ar-om", "ar-ps", "ar-qa", "ar-sa", "ar-sd", "ar-so", "ar-ss", "ar-sy", "ar-td", "ar-tn", "ar-ye", "as", "as-in", "asa", "asa-tz", "ast", "ast-es", "az", "az-az", "bas", "bas-cm", "be", "be-by", "bem", "bem-zm", "bez", "bez-tz", "bg", "bg-bg", "bm", "bm-ml", "bn", "bn-bd", "bn-in", "bo", "bo-cn", "bo-in", "br", "br-fr", "brx", "brx-in", "bs", "bs-ba", "ca", "ca-ad", "ca-es", "ca-fr", "ca-it", "ccp", "ccp-bd", "ccp-in", "ce", "ce-ru", "ceb", "ceb-ph", "cgg", "cgg-ug", "chr", "chr-us", "ckb", "ckb-iq", "ckb-ir", "cs", "cs-cz", "cu", "cu-ru", "cy", "cy-gb", "da", "da-dk", "da-gl", "dav", "dav-ke", "de", "de-at", "de-be", "de-ch", "de-de", "de-gr", "de-it", "de-li", "de-lu", "dje", "dje-ne", "doi", "doi-in", "dsb", "dsb-de", "dua", "dua-cm", "dyo", "dyo-sn", "dz", "dz-bt", "ebu", "ebu-ke", "ee", "ee-gh", "ee-tg", "el", "el-cy", "el-gr", "en", "en-001", "en-150", "en-ae", "en-ag", "en-ai", "en-as", "en-at", "en-au", "en-bb", "en-be", "en-bi", "en-bm", "en-bs", "en-bw", "en-bz", "en-ca", "en-cc", "en-ch", "en-ck", "en-cm", "en-cn", "en-cx", "en-cy", "en-de", "en-dg", "en-dk", "en-dm", "en-ee", "en-er", "en-fr", "en-fi", "en-fj", "en-fk", "en-fm", "en-gb", "en-gd", "en-gg", "en-gh", "en-gi", "en-gm", "en-gu", "en-gy", "en-hk", "en-ie", "en-il", "en-im", "en-in", "en-io", "en-je", "en-jm", "en-ke", "en-ki", "en-kn", "en-ky", "en-lc", "en-lr", "en-ls", "en-lu", "en-mg", "en-mh", "en-mo", "en-mp", "en-ms", "en-mt", "en-mu", "en-mw", "en-mx", "en-my", "en-na", "en-nf", "en-ng", "en-nl", "en-nr", "en-nu", "en-nz", "en-pg", "en-ph", "en-pk", "en-pn", "en-pr", "en-pw", "en-rw", "en-sb", "en-sc", "en-sd", "en-se", "en-sg", "en-sh", "en-si", "en-sl", "en-ss", "en-sx", "en-sz", "en-tc", "en-tk", "en-to", "en-tt", "en-tv", "en-tz", "en-ug", "en-um", "en-us", "en-vc", "en-vg", "en-vi", "en-vu", "en-ws", "en-za", "en-zm", "en-zw", "eo", "eo-001", "es", "es-419", "es-ar", "es-bo", "es-br", "es-bz", "es-cl", "es-co", "es-cr", "es-cu", "es-do", "es-ea", "es-ec", "es-es", "es-gq", "es-gt", "es-hn", "es-ic", "es-mx", "es-ni", "es-pa", "es-pe", "es-ph", "es-pr", "es-py", "es-sv", "es-us", "es-uy", "es-ve", "et", "et-ee", "eu", "eu-es", "ewo", "ewo-cm", "fa", "fa-af", "fa-ir", "ff", "ff-bf", "ff-cm", "ff-gh", "ff-gm", "ff-gn", "ff-gw", "ff-lr", "ff-mr", "ff-ne", "ff-ng", "ff-sl", "ff-sn", "fi", "fi-fi", "fil", "fil-ph", "fo", "fo-dk", "fo-fo", "fr", "fr-be", "fr-bf", "fr-bi", "fr-bj", "fr-bl", "fr-ca", "fr-cd", "fr-cf", "fr-cg", "fr-ch", "fr-ci", "fr-cm", "fr-dj", "fr-dz", "fr-fr", "fr-ga", "fr-gf", "fr-gn", "fr-gp", "fr-gq", "fr-ht", "fr-km", "fr-lu", "fr-ma", "fr-mc", "fr-mf", "fr-mg", "fr-ml", "fr-mq", "fr-mr", "fr-mu", "fr-nc", "fr-ne", "fr-pf", "fr-pm", "fr-re", "fr-rw", "fr-sc", "fr-sn", "fr-sy", "fr-td", "fr-tg", "fr-tn", "fr-vu", "fr-wf", "fr-yt", "fur", "fur-it", "fy", "fy-nl", "ga", "ga-gb", "ga-ie", "gd", "gd-gb", "gl", "gl-es", "gsw", "gsw-ch", "gsw-fr", "gsw-li", "gu", "gu-in", "guz", "guz-ke", "gv", "gv-im", "ha", "ha-gh", "ha-ne", "ha-ng", "haw", "haw-us", "he", "hi", "hi-in", "hr", "hr-ba", "hr-hr", "hsb", "hsb-de", "hu", "hu-hu", "hy", "hy-am", "ia", "ia-001", "id", "ig", "ig-ng", "ii", "ii-cn", "id-id", "is", "is-is", "it", "it-ch", "it-it", "it-sm", "it-va", "he-il", "ja", "ja-jp", "jgo", "jgo-cm", "yi", "yi-001", "jmc", "jmc-tz", "jv", "jv-id", "ka", "ka-ge", "kab", "kab-dz", "kam", "kam-ke", "kde", "kde-tz", "kea", "kea-cv", "khq", "khq-ml", "ki", "ki-ke", "kk", "kk-kz", "kkj", "kkj-cm", "kl", "kl-gl", "kln", "kln-ke", "km", "km-kh", "kn", "kn-in", "ko", "ko-kp", "ko-kr", "kok", "kok-in", "ks", "ks-in", "ksb", "ksb-tz", "ksf", "ksf-cm", "ksh", "ksh-de", "kw", "kw-gb", "ku", "ku-tr", "ky", "ky-kg", "lag", "lag-tz", "lb", "lb-lu", "lg", "lg-ug", "lkt", "lkt-us", "ln", "ln-ao", "ln-cd", "ln-cf", "ln-cg", "lo", "lo-la", "lrc", "lrc-iq", "lrc-ir", "lt", "lt-lt", "lu", "lu-cd", "luo", "luo-ke", "luy", "luy-ke", "lv", "lv-lv", "mai", "mai-in", "mas", "mas-ke", "mas-tz", "mer", "mer-ke", "mfe", "mfe-mu", "mg", "mg-mg", "mgh", "mgh-mz", "mgo", "mgo-cm", "mi", "mi-nz", "mk", "mk-mk", "ml", "ml-in", "mn", "mn-mn", "mni", "mni-in", "mr", "mr-in", "ms", "ms-bn", "ms-id", "ms-my", "ms-sg", "mt", "mt-mt", "mua", "mua-cm", "my", "my-mm", "mzn", "mzn-ir", "naq", "naq-na", "nb", "nb-no", "nb-sj", "nd", "nd-zw", "nds", "nds-de", "nds-nl", "ne", "ne-in", "ne-np", "nl", "nl-aw", "nl-be", "nl-ch", "nl-bq", "nl-cw", "nl-lu", "nl-nl", "nl-sr", "nl-sx", "nmg", "nmg-cm", "nn", "nn-no", "nnh", "nnh-cm", "no", "no-no", "nus", "nus-ss", "nyn", "nyn-ug", "om", "om-et", "om-ke", "or", "or-in", "os", "os-ge", "os-ru", "pa", "pa-in", "pa-pk", "pcm", "pcm-ng", "pl", "pl-pl", "prg", "prg-001", "ps", "ps-af", "ps-pk", "pt", "pt-ao", "pt-br", "pt-ch", "pt-cv", "pt-gq", "pt-gw", "pt-lu", "pt-mo", "pt-mz", "pt-pt", "pt-st", "pt-tl", "qu", "qu-bo", "qu-ec", "qu-pe", "rm", "rm-ch", "rn", "rn-bi", "ro", "ro-md", "ro-ro", "rof", "rof-tz", "ru", "ru-by", "ru-kg", "ru-kz", "ru-md", "ru-ru", "ru-ua", "rw", "rw-rw", "rwk", "rwk-tz", "sa", "sa-in", "sah", "sah-ru", "saq", "saq-ke", "sat", "sat-in", "sbp", "sbp-tz", "sd", "sd-in", "sd-pk", "se", "se-fi", "se-no", "se-se", "seh", "seh-mz", "ses", "ses-ml", "sg", "sg-cf", "shi", "shi-ma", "si", "si-lk", "sk", "sk-sk", "sl", "sl-si", "smn", "smn-fi", "sn", "sn-zw", "so", "so-dj", "so-et", "so-ke", "so-so", "sq", "sq-al", "sq-mk", "sq-xk", "sr", "sr-ba", "sr-cs", "sr-me", "sr-rs", "sr-xk", "su", "su-id", "sv", "sv-ax", "sv-fi", "sv-se", "sw", "sw-cd", "sw-ke", "sw-tz", "sw-ug", "sy", "ta", "ta-in", "ta-lk", "ta-my", "ta-sg", "te", "te-in", "teo", "teo-ke", "teo-ug", "tg", "tg-tj", "th", "th-th", "ti", "ti-er", "ti-et", "tk", "tk-tm", "tl", "to", "to-to", "tr", "tr-cy", "tr-tr", "tt", "tt-ru", "twq", "twq-ne", "tzm", "tzm-ma", "ug", "ug-cn", "uk", "uk-ua", "ur", "ur-in", "ur-pk", "uz", "uz-af", "uz-uz", "vai", "vai-lr", "vi", "vi-vn", "vo", "vo-001", "vun", "vun-tz", "wae", "wae-ch", "wo", "wo-sn", "xh", "xh-za", "xog", "xog-ug", "yav", "yav-cm", "yo", "yo-bj", "yo-ng", "yue", "yue-cn", "yue-hk", "zgh", "zgh-ma", "zh", "zh-cn", "zh-hk", "zh-mo", "zh-sg", "zh-tw", "zh-hans", "zh-hant", "zu", "zu-za"]) unless validator.valid?(language) fail ArgumentError, "invalid value for \"language\", must be one of #{validator.allowable_values}." end @language = language 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 && language == o.language && id == o.id && primary_id == o.primary_id && primary_language == o.primary_language 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 [language, id, primary_id, primary_language].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/previous_page.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/previous_page.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Model definition for a previous page class PreviousPage # attr_accessor :before # attr_accessor :link # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'before' => :'before', :'link' => :'link' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'before' => :'String', :'link' => :'String' } 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::Blogs::BlogPosts::PreviousPage` 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::Blogs::BlogPosts::PreviousPage`. 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?(:'before') self.before = attributes[:'before'] end if attributes.key?(:'link') self.link = attributes[:'link'] 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 @before.nil? invalid_properties.push('invalid value for "before", before 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 @before.nil? true 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 && before == o.before && link == o.link 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 [before, link].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/next_page.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/next_page.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Model definition for a next page. class NextPage # attr_accessor :link # attr_accessor :after # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'link' => :'link', :'after' => :'after' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'link' => :'String', :'after' => :'String' } 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::Blogs::BlogPosts::NextPage` 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::Blogs::BlogPosts::NextPage`. 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?(:'link') self.link = attributes[:'link'] end if attributes.key?(:'after') self.after = attributes[:'after'] 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 @after.nil? invalid_properties.push('invalid value for "after", after 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 @after.nil? true 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 && link == o.link && after == o.after 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 [link, after].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/rgba_color.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/rgba_color.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # A color defined by RGB values. class RGBAColor # Alpha. attr_accessor :a # Red. attr_accessor :r # Blue. attr_accessor :b # Green. attr_accessor :g # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'a' => :'a', :'r' => :'r', :'b' => :'b', :'g' => :'g' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'a' => :'Float', :'r' => :'Integer', :'b' => :'Integer', :'g' => :'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::Blogs::BlogPosts::RGBAColor` 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::Blogs::BlogPosts::RGBAColor`. 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?(:'a') self.a = attributes[:'a'] end if attributes.key?(:'r') self.r = attributes[:'r'] end if attributes.key?(:'b') self.b = attributes[:'b'] end if attributes.key?(:'g') self.g = attributes[:'g'] 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 @a.nil? invalid_properties.push('invalid value for "a", a cannot be nil.') end if @r.nil? invalid_properties.push('invalid value for "r", r cannot be nil.') end if @b.nil? invalid_properties.push('invalid value for "b", b cannot be nil.') end if @g.nil? invalid_properties.push('invalid value for "g", g 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 @a.nil? return false if @r.nil? return false if @b.nil? return false if @g.nil? true 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 && a == o.a && r == o.r && b == o.b && g == o.g 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 [a, r, b, g].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_input_blog_post.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_input_blog_post.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Wrapper for providing an array of blog posts as inputs. class BatchInputBlogPost # Blog posts to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<BlogPost>' } 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::Blogs::BlogPosts::BatchInputBlogPost` 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::Blogs::BlogPosts::BatchInputBlogPost`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/angle.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/angle.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class Angle attr_accessor :units attr_accessor :value # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'units' => :'units', :'value' => :'value' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'units' => :'String', :'value' => :'Float' } 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::Blogs::BlogPosts::Angle` 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::Blogs::BlogPosts::Angle`. 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?(:'units') self.units = attributes[:'units'] end if attributes.key?(:'value') self.value = attributes[:'value'] 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 @units.nil? invalid_properties.push('invalid value for "units", units cannot be nil.') end if @value.nil? invalid_properties.push('invalid value for "value", value 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 @units.nil? return false if @value.nil? true 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 && units == o.units && value == o.value 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 [units, value].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/collection_response_with_total_version_blog_post.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/collection_response_with_total_version_blog_post.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Response object for collections of blog post versions with pagination information. class CollectionResponseWithTotalVersionBlogPost # Total number of blog post versions. attr_accessor :total attr_accessor :paging # Collection of blog post versions. attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'total' => :'total', :'paging' => :'paging', :'results' => :'results' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'total' => :'Integer', :'paging' => :'Paging', :'results' => :'Array<VersionBlogPost>' } 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::Blogs::BlogPosts::CollectionResponseWithTotalVersionBlogPost` 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::Blogs::BlogPosts::CollectionResponseWithTotalVersionBlogPost`. 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?(:'total') self.total = attributes[:'total'] end if attributes.key?(:'paging') self.paging = attributes[:'paging'] end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end 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 @total.nil? invalid_properties.push('invalid value for "total", total cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results 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 @total.nil? return false if @results.nil? true 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 && total == o.total && paging == o.paging && results == o.results 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 [total, paging, results].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/paging.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/paging.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Model definition for paging. class Paging attr_accessor :_next attr_accessor :prev # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'_next' => :'next', :'prev' => :'prev' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'_next' => :'NextPage', :'prev' => :'PreviousPage' } 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::Blogs::BlogPosts::Paging` 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::Blogs::BlogPosts::Paging`. 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?(:'_next') self._next = attributes[:'_next'] end if attributes.key?(:'prev') self.prev = attributes[:'prev'] 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 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? true 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 && _next == o._next && prev == o.prev 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 [_next, prev].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/detach_from_lang_group_request_v_next.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/detach_from_lang_group_request_v_next.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Request body object for detaching objects from multi-language groups. class DetachFromLangGroupRequestVNext # ID of the object to remove from a multi-language group. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'id' => :'String' } 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::Blogs::BlogPosts::DetachFromLangGroupRequestVNext` 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::Blogs::BlogPosts::DetachFromLangGroupRequestVNext`. 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?(:'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 @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 @id.nil? true 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 && 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 [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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_input_json_node.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_input_json_node.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Wrapper for providing an array of JSON nodes as inputs. class BatchInputJsonNode # JSON nodes to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<Object>' } 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::Blogs::BlogPosts::BatchInputJsonNode` 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::Blogs::BlogPosts::BatchInputJsonNode`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/error_detail.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/error_detail.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class ErrorDetail # A specific category that contains more specific detail about the error attr_accessor :sub_category # The status code associated with the error detail attr_accessor :code # The name of the field or parameter in which the error was found. attr_accessor :_in # Context about the error condition attr_accessor :context # A human readable message describing the error along with remediation steps where appropriate attr_accessor :message # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'code' => :'code', :'_in' => :'in', :'context' => :'context', :'message' => :'message' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'String', :'code' => :'String', :'_in' => :'String', :'context' => :'Hash<String, Array<String>>', :'message' => :'String' } 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::Blogs::BlogPosts::ErrorDetail` 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::Blogs::BlogPosts::ErrorDetail`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'code') self.code = attributes[:'code'] end if attributes.key?(:'_in') self._in = attributes[:'_in'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'message') self.message = attributes[:'message'] 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 @message.nil? invalid_properties.push('invalid value for "message", message 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 @message.nil? true 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 && sub_category == o.sub_category && code == o.code && _in == o._in && context == o.context && message == o.message 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 [sub_category, code, _in, context, message].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/set_new_language_primary_request_v_next.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/set_new_language_primary_request_v_next.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Request body object for setting a new primary language. class SetNewLanguagePrimaryRequestVNext # ID of object to set as primary in multi-language group. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'id' => :'String' } 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::Blogs::BlogPosts::SetNewLanguagePrimaryRequestVNext` 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::Blogs::BlogPosts::SetNewLanguagePrimaryRequestVNext`. 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?(:'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 @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 @id.nil? true 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 && 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 [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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/version_blog_post.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/version_blog_post.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Model definition of a version of a blog post. class VersionBlogPost # The id of the version. attr_accessor :id attr_accessor :user attr_accessor :object attr_accessor :updated_at # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'user' => :'user', :'object' => :'object', :'updated_at' => :'updatedAt' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'id' => :'String', :'user' => :'VersionUser', :'object' => :'BlogPost', :'updated_at' => :'Time' } 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::Blogs::BlogPosts::VersionBlogPost` 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::Blogs::BlogPosts::VersionBlogPost`. 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?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'user') self.user = attributes[:'user'] end if attributes.key?(:'object') self.object = attributes[:'object'] end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] 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 @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @user.nil? invalid_properties.push('invalid value for "user", user cannot be nil.') end if @object.nil? invalid_properties.push('invalid value for "object", object cannot be nil.') end if @updated_at.nil? invalid_properties.push('invalid value for "updated_at", updated_at 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 @id.nil? return false if @user.nil? return false if @object.nil? return false if @updated_at.nil? true 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 && id == o.id && user == o.user && object == o.object && updated_at == o.updated_at 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 [id, user, object, updated_at].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/content_schedule_request_v_next.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/content_schedule_request_v_next.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Request body object for scheduling the publish of content class ContentScheduleRequestVNext # The date the object should transition from scheduled to published. attr_accessor :publish_date # The ID of the object to be scheduled. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'publish_date' => :'publishDate', :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'publish_date' => :'Time', :'id' => :'String' } 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::Blogs::BlogPosts::ContentScheduleRequestVNext` 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::Blogs::BlogPosts::ContentScheduleRequestVNext`. 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?(:'publish_date') self.publish_date = attributes[:'publish_date'] 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 @publish_date.nil? invalid_properties.push('invalid value for "publish_date", publish_date 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 @publish_date.nil? return false if @id.nil? true 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 && publish_date == o.publish_date && 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 [publish_date, 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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/content_clone_request_v_next.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/content_clone_request_v_next.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Request body object for cloning content. class ContentCloneRequestVNext # Name of the cloned object. attr_accessor :clone_name # ID of the object to be cloned. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'clone_name' => :'cloneName', :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'clone_name' => :'String', :'id' => :'String' } 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::Blogs::BlogPosts::ContentCloneRequestVNext` 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::Blogs::BlogPosts::ContentCloneRequestVNext`. 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?(:'clone_name') self.clone_name = attributes[:'clone_name'] 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 @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 @id.nil? true 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 && clone_name == o.clone_name && 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 [clone_name, 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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/forward_paging.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/forward_paging.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Model definition for forward paging. class ForwardPaging attr_accessor :_next # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'_next' => :'next' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'_next' => :'NextPage' } 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::Blogs::BlogPosts::ForwardPaging` 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::Blogs::BlogPosts::ForwardPaging`. 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?(:'_next') self._next = attributes[:'_next'] 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 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? true 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 && _next == o._next 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 [_next].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_response_blog_post.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/batch_response_blog_post.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Response object for batch operations on blog posts. class BatchResponseBlogPost # Time of batch operation completion. attr_accessor :completed_at # Time of batch operation request. attr_accessor :requested_at # Time of batch operation start. attr_accessor :started_at # Links associated with batch operation. attr_accessor :links # Results of batch operation. attr_accessor :results # Status of batch operation. attr_accessor :status 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 { :'completed_at' => :'completedAt', :'requested_at' => :'requestedAt', :'started_at' => :'startedAt', :'links' => :'links', :'results' => :'results', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'completed_at' => :'Time', :'requested_at' => :'Time', :'started_at' => :'Time', :'links' => :'Hash<String, String>', :'results' => :'Array<BlogPost>', :'status' => :'String' } 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::Blogs::BlogPosts::BatchResponseBlogPost` 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::Blogs::BlogPosts::BatchResponseBlogPost`. 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?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'requested_at') self.requested_at = attributes[:'requested_at'] end if attributes.key?(:'started_at') self.started_at = attributes[:'started_at'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @completed_at.nil? invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.') end if @started_at.nil? invalid_properties.push('invalid value for "started_at", started_at cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @completed_at.nil? return false if @started_at.nil? return false if @results.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) return false unless status_validator.valid?(@status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) unless validator.valid?(status) fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." end @status = status 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 && completed_at == o.completed_at && requested_at == o.requested_at && started_at == o.started_at && links == o.links && results == o.results && status == o.status 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 [completed_at, requested_at, started_at, links, results, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/color_stop.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/color_stop.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class ColorStop attr_accessor :color # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'color' => :'color' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'color' => :'RGBAColor' } 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::Blogs::BlogPosts::ColorStop` 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::Blogs::BlogPosts::ColorStop`. 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?(:'color') self.color = attributes[:'color'] 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 @color.nil? invalid_properties.push('invalid value for "color", color 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 @color.nil? true 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 && color == o.color 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 [color].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/content_language_variation.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/content_language_variation.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class ContentLanguageVariation attr_accessor :archived_in_dashboard attr_accessor :created attr_accessor :tag_ids attr_accessor :publish_date attr_accessor :public_access_rules attr_accessor :password attr_accessor :author_name attr_accessor :public_access_rules_enabled attr_accessor :name attr_accessor :campaign attr_accessor :id attr_accessor :state attr_accessor :campaign_name attr_accessor :updated attr_accessor :slug # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'archived_in_dashboard' => :'archivedInDashboard', :'created' => :'created', :'tag_ids' => :'tagIds', :'publish_date' => :'publishDate', :'public_access_rules' => :'publicAccessRules', :'password' => :'password', :'author_name' => :'authorName', :'public_access_rules_enabled' => :'publicAccessRulesEnabled', :'name' => :'name', :'campaign' => :'campaign', :'id' => :'id', :'state' => :'state', :'campaign_name' => :'campaignName', :'updated' => :'updated', :'slug' => :'slug' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'archived_in_dashboard' => :'Boolean', :'created' => :'Time', :'tag_ids' => :'Array<Integer>', :'publish_date' => :'Time', :'public_access_rules' => :'Array<Object>', :'password' => :'String', :'author_name' => :'String', :'public_access_rules_enabled' => :'Boolean', :'name' => :'String', :'campaign' => :'String', :'id' => :'Integer', :'state' => :'String', :'campaign_name' => :'String', :'updated' => :'Time', :'slug' => :'String' } 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::Blogs::BlogPosts::ContentLanguageVariation` 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::Blogs::BlogPosts::ContentLanguageVariation`. 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?(:'archived_in_dashboard') self.archived_in_dashboard = attributes[:'archived_in_dashboard'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'tag_ids') if (value = attributes[:'tag_ids']).is_a?(Array) self.tag_ids = value end end if attributes.key?(:'publish_date') self.publish_date = attributes[:'publish_date'] end if attributes.key?(:'public_access_rules') if (value = attributes[:'public_access_rules']).is_a?(Array) self.public_access_rules = value end end if attributes.key?(:'password') self.password = attributes[:'password'] end if attributes.key?(:'author_name') self.author_name = attributes[:'author_name'] end if attributes.key?(:'public_access_rules_enabled') self.public_access_rules_enabled = attributes[:'public_access_rules_enabled'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'campaign') self.campaign = attributes[:'campaign'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'campaign_name') self.campaign_name = attributes[:'campaign_name'] end if attributes.key?(:'updated') self.updated = attributes[:'updated'] end if attributes.key?(:'slug') self.slug = attributes[:'slug'] 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 @archived_in_dashboard.nil? invalid_properties.push('invalid value for "archived_in_dashboard", archived_in_dashboard cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @publish_date.nil? invalid_properties.push('invalid value for "publish_date", publish_date cannot be nil.') end if @public_access_rules.nil? invalid_properties.push('invalid value for "public_access_rules", public_access_rules cannot be nil.') end if @password.nil? invalid_properties.push('invalid value for "password", password cannot be nil.') end if @author_name.nil? invalid_properties.push('invalid value for "author_name", author_name cannot be nil.') end if @public_access_rules_enabled.nil? invalid_properties.push('invalid value for "public_access_rules_enabled", public_access_rules_enabled cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @campaign.nil? invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @state.nil? invalid_properties.push('invalid value for "state", state cannot be nil.') end if @campaign_name.nil? invalid_properties.push('invalid value for "campaign_name", campaign_name cannot be nil.') end if @updated.nil? invalid_properties.push('invalid value for "updated", updated cannot be nil.') end if @slug.nil? invalid_properties.push('invalid value for "slug", slug 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 @archived_in_dashboard.nil? return false if @created.nil? return false if @publish_date.nil? return false if @public_access_rules.nil? return false if @password.nil? return false if @author_name.nil? return false if @public_access_rules_enabled.nil? return false if @name.nil? return false if @campaign.nil? return false if @id.nil? return false if @state.nil? return false if @campaign_name.nil? return false if @updated.nil? return false if @slug.nil? true 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 && archived_in_dashboard == o.archived_in_dashboard && created == o.created && tag_ids == o.tag_ids && publish_date == o.publish_date && public_access_rules == o.public_access_rules && password == o.password && author_name == o.author_name && public_access_rules_enabled == o.public_access_rules_enabled && name == o.name && campaign == o.campaign && id == o.id && state == o.state && campaign_name == o.campaign_name && updated == o.updated && slug == o.slug 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 [archived_in_dashboard, created, tag_ids, publish_date, public_access_rules, password, author_name, public_access_rules_enabled, name, campaign, id, state, campaign_name, updated, slug].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/update_languages_request_v_next.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/update_languages_request_v_next.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Request object for updating languages within a multi-language group. class UpdateLanguagesRequestVNext # Map of object IDs to associated languages of object in the multi-language group. attr_accessor :languages # ID of the primary object in the multi-language group. attr_accessor :primary_id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'languages' => :'languages', :'primary_id' => :'primaryId' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'languages' => :'Hash<String, String>', :'primary_id' => :'String' } 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::Blogs::BlogPosts::UpdateLanguagesRequestVNext` 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::Blogs::BlogPosts::UpdateLanguagesRequestVNext`. 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?(:'languages') if (value = attributes[:'languages']).is_a?(Hash) self.languages = value end end if attributes.key?(:'primary_id') self.primary_id = attributes[:'primary_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 @languages.nil? invalid_properties.push('invalid value for "languages", languages cannot be nil.') end if @primary_id.nil? invalid_properties.push('invalid value for "primary_id", primary_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 @languages.nil? return false if @primary_id.nil? true 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 && languages == o.languages && primary_id == o.primary_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 [languages, primary_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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/breakpoint_styles.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/breakpoint_styles.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class BreakpointStyles attr_accessor :padding attr_accessor :margin attr_accessor :hidden # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'padding' => :'padding', :'margin' => :'margin', :'hidden' => :'hidden' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'padding' => :'Object', :'margin' => :'Object', :'hidden' => :'Boolean' } 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::Blogs::BlogPosts::BreakpointStyles` 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::Blogs::BlogPosts::BreakpointStyles`. 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?(:'padding') self.padding = attributes[:'padding'] end if attributes.key?(:'margin') self.margin = attributes[:'margin'] end if attributes.key?(:'hidden') self.hidden = attributes[:'hidden'] 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 @padding.nil? invalid_properties.push('invalid value for "padding", padding cannot be nil.') end if @margin.nil? invalid_properties.push('invalid value for "margin", margin cannot be nil.') end if @hidden.nil? invalid_properties.push('invalid value for "hidden", hidden 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 @padding.nil? return false if @margin.nil? return false if @hidden.nil? true 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 && padding == o.padding && margin == o.margin && hidden == o.hidden 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 [padding, margin, hidden].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/layout_section.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/layout_section.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class LayoutSection attr_accessor :css_style attr_accessor :label attr_accessor :type # null attr_accessor :params attr_accessor :rows attr_accessor :row_meta_data attr_accessor :cells attr_accessor :css_class attr_accessor :w attr_accessor :css_id attr_accessor :x attr_accessor :name attr_accessor :styles # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'css_style' => :'cssStyle', :'label' => :'label', :'type' => :'type', :'params' => :'params', :'rows' => :'rows', :'row_meta_data' => :'rowMetaData', :'cells' => :'cells', :'css_class' => :'cssClass', :'w' => :'w', :'css_id' => :'cssId', :'x' => :'x', :'name' => :'name', :'styles' => :'styles' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'css_style' => :'String', :'label' => :'String', :'type' => :'String', :'params' => :'Hash<String, Object>', :'rows' => :'Array<Hash<String, LayoutSection>>', :'row_meta_data' => :'Array<RowMetaData>', :'cells' => :'Array<LayoutSection>', :'css_class' => :'String', :'w' => :'Integer', :'css_id' => :'String', :'x' => :'Integer', :'name' => :'String', :'styles' => :'Styles' } 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::Blogs::BlogPosts::LayoutSection` 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::Blogs::BlogPosts::LayoutSection`. 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?(:'css_style') self.css_style = attributes[:'css_style'] end if attributes.key?(:'label') self.label = attributes[:'label'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'params') if (value = attributes[:'params']).is_a?(Hash) self.params = value end end if attributes.key?(:'rows') if (value = attributes[:'rows']).is_a?(Array) self.rows = value end end if attributes.key?(:'row_meta_data') if (value = attributes[:'row_meta_data']).is_a?(Array) self.row_meta_data = value end end if attributes.key?(:'cells') if (value = attributes[:'cells']).is_a?(Array) self.cells = value end end if attributes.key?(:'css_class') self.css_class = attributes[:'css_class'] end if attributes.key?(:'w') self.w = attributes[:'w'] end if attributes.key?(:'css_id') self.css_id = attributes[:'css_id'] end if attributes.key?(:'x') self.x = attributes[:'x'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'styles') self.styles = attributes[:'styles'] 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 @css_style.nil? invalid_properties.push('invalid value for "css_style", css_style cannot be nil.') end if @label.nil? invalid_properties.push('invalid value for "label", label cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @params.nil? invalid_properties.push('invalid value for "params", params cannot be nil.') end if @rows.nil? invalid_properties.push('invalid value for "rows", rows cannot be nil.') end if @row_meta_data.nil? invalid_properties.push('invalid value for "row_meta_data", row_meta_data cannot be nil.') end if @cells.nil? invalid_properties.push('invalid value for "cells", cells cannot be nil.') end if @css_class.nil? invalid_properties.push('invalid value for "css_class", css_class cannot be nil.') end if @w.nil? invalid_properties.push('invalid value for "w", w cannot be nil.') end if @css_id.nil? invalid_properties.push('invalid value for "css_id", css_id cannot be nil.') end if @x.nil? invalid_properties.push('invalid value for "x", x cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @styles.nil? invalid_properties.push('invalid value for "styles", styles 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 @css_style.nil? return false if @label.nil? return false if @type.nil? return false if @params.nil? return false if @rows.nil? return false if @row_meta_data.nil? return false if @cells.nil? return false if @css_class.nil? return false if @w.nil? return false if @css_id.nil? return false if @x.nil? return false if @name.nil? return false if @styles.nil? true 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 && css_style == o.css_style && label == o.label && type == o.type && params == o.params && rows == o.rows && row_meta_data == o.row_meta_data && cells == o.cells && css_class == o.css_class && w == o.w && css_id == o.css_id && x == o.x && name == o.name && styles == o.styles 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 [css_style, label, type, params, rows, row_meta_data, cells, css_class, w, css_id, x, name, styles].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/error.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/error.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class Error # A specific category that contains more specific detail about the error attr_accessor :sub_category # Context about the error condition attr_accessor :context # A unique identifier for the request. Include this value with any error reports or support tickets attr_accessor :correlation_id # A map of link names to associated URIs containing documentation about the error or recommended remediation steps attr_accessor :links # A human readable message describing the error along with remediation steps where appropriate attr_accessor :message # The error category attr_accessor :category # further information about the error attr_accessor :errors # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'context' => :'context', :'correlation_id' => :'correlationId', :'links' => :'links', :'message' => :'message', :'category' => :'category', :'errors' => :'errors' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'String', :'context' => :'Hash<String, Array<String>>', :'correlation_id' => :'String', :'links' => :'Hash<String, String>', :'message' => :'String', :'category' => :'String', :'errors' => :'Array<ErrorDetail>' } 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::Blogs::BlogPosts::Error` 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::Blogs::BlogPosts::Error`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end 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 @correlation_id.nil? invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') end if @message.nil? invalid_properties.push('invalid value for "message", message cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category 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 @correlation_id.nil? return false if @message.nil? return false if @category.nil? true 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 && sub_category == o.sub_category && context == o.context && correlation_id == o.correlation_id && links == o.links && message == o.message && category == o.category && errors == o.errors 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 [sub_category, context, correlation_id, links, message, category, errors].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/blog_post.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/blog_post.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Model definition for a Blog Post. class BlogPost # The date (ISO8601 format) the blog post is to be published at. attr_accessor :publish_date # The explicitly defined ISO 639 language code of the post. If null, the post will default to the language of the parent blog. attr_accessor :language # Boolean to determine whether or not the styles from the template should be applied. attr_accessor :enable_layout_stylesheets # A description that goes in <meta> tag on the page. attr_accessor :meta_description # List of stylesheets to attach to this blog post. These stylesheets are attached to just this page. Order of precedence is bottom to top, just like in the HTML. attr_accessor :attached_stylesheets # Set this to create a password protected page. Entering the password will be required to view the page. attr_accessor :password # The HTML title of the post. attr_accessor :html_title # Set this to true if you want to be published immediately when the schedule publish endpoint is called, and to ignore the publish_date setting. attr_accessor :publish_immediately attr_accessor :translations # The unique ID of the blog post. attr_accessor :id # An enumeration describing the current publish state of the post. attr_accessor :state # The URL slug of the blog post. This field is appended to the domain to construct the url of this post. attr_accessor :slug # The ID of the user that created the post. attr_accessor :created_by_id # The contents of the RSS body for this Blog Post. attr_accessor :rss_body attr_accessor :currently_published # If True, the post will not show up in your dashboard, although the post could still be live. attr_accessor :archived_in_dashboard attr_accessor :created # An ENUM descibing the type of this object. Should always be BLOG_POST. attr_accessor :content_type_category # attr_accessor :mab_experiment_id # The ID of the user that updated the post. attr_accessor :updated_by_id # ID of the primary blog post that this post was translated from. attr_accessor :translated_from_id # attr_accessor :folder_id # A data structure containing the data for all the modules inside the containers for this post. This will only be populated if the page has widget containers. attr_accessor :widget_containers # attr_accessor :page_expiry_redirect_id attr_accessor :dynamic_page_data_source_type # The featuredImage of this Blog Post. attr_accessor :featured_image # The name of the blog author associated with the post. attr_accessor :author_name # The domain that the post lives on. If null, the post will default to the domain of the parent blog. attr_accessor :domain # The internal name of the post. attr_accessor :name # For dynamic HubDB pages, the ID of the HubDB table this post references. attr_accessor :dynamic_page_hub_db_table_id # The GUID of the marketing campaign the post is associated with. attr_accessor :campaign attr_accessor :dynamic_page_data_source_id # Boolean to determine whether or not the styles from the template should be applied. attr_accessor :enable_domain_stylesheets # Boolean to determine whether or not the Primary CSS Files should be applied. attr_accessor :include_default_custom_css # attr_accessor :layout_sections attr_accessor :updated # Custom HTML for embed codes, javascript that should be placed before the </body> tag of the page. attr_accessor :footer_html # The IDs of the tags associated with this post. attr_accessor :tag_ids # A data structure containing the data for all the modules for this page. attr_accessor :widgets # The summary of the blog post that will appear on the main listing page. attr_accessor :post_summary # Custom HTML for embed codes, javascript, etc. that goes in the <head> tag of the page. attr_accessor :head_html # attr_accessor :page_expiry_redirect_url # attr_accessor :ab_status # Boolean to determine if this post should use a featured image. attr_accessor :use_featured_image # attr_accessor :ab_test_id # Alt Text of the featuredImage. attr_accessor :featured_image_alt_text # The ID of the blog author associated with this post. attr_accessor :blog_author_id # The ID of the post's parent blog. attr_accessor :content_group_id # The contents of the RSS summary for this Blog Post. attr_accessor :rss_summary # attr_accessor :page_expiry_enabled # A generated field representing the URL of this blog post. attr_accessor :url # Boolean to allow overriding the AMP settings for the blog. attr_accessor :enable_google_amp_output_override # Rules for require member registration to access private content. attr_accessor :public_access_rules # The timestamp (ISO8601 format) when this Blog Post was deleted. attr_accessor :archived_at # The HTML of the main post body. attr_accessor :_post_body # attr_accessor :theme_settings_values # attr_accessor :page_expiry_date # Boolean to determine whether or not to respect publicAccessRules. attr_accessor :public_access_rules_enabled # A generated ENUM descibing the current state of this Blog Post. Should always match state. attr_accessor :current_state # ID of the object type. attr_accessor :category_id # Optional override to set the URL to be used in the rel=canonical link tag on the page. attr_accessor :link_rel_canonical_url 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 { :'publish_date' => :'publishDate', :'language' => :'language', :'enable_layout_stylesheets' => :'enableLayoutStylesheets', :'meta_description' => :'metaDescription', :'attached_stylesheets' => :'attachedStylesheets', :'password' => :'password', :'html_title' => :'htmlTitle', :'publish_immediately' => :'publishImmediately', :'translations' => :'translations', :'id' => :'id', :'state' => :'state', :'slug' => :'slug', :'created_by_id' => :'createdById', :'rss_body' => :'rssBody', :'currently_published' => :'currentlyPublished', :'archived_in_dashboard' => :'archivedInDashboard', :'created' => :'created', :'content_type_category' => :'contentTypeCategory', :'mab_experiment_id' => :'mabExperimentId', :'updated_by_id' => :'updatedById', :'translated_from_id' => :'translatedFromId', :'folder_id' => :'folderId', :'widget_containers' => :'widgetContainers', :'page_expiry_redirect_id' => :'pageExpiryRedirectId', :'dynamic_page_data_source_type' => :'dynamicPageDataSourceType', :'featured_image' => :'featuredImage', :'author_name' => :'authorName', :'domain' => :'domain', :'name' => :'name', :'dynamic_page_hub_db_table_id' => :'dynamicPageHubDbTableId', :'campaign' => :'campaign', :'dynamic_page_data_source_id' => :'dynamicPageDataSourceId', :'enable_domain_stylesheets' => :'enableDomainStylesheets', :'include_default_custom_css' => :'includeDefaultCustomCss', :'layout_sections' => :'layoutSections', :'updated' => :'updated', :'footer_html' => :'footerHtml', :'tag_ids' => :'tagIds', :'widgets' => :'widgets', :'post_summary' => :'postSummary', :'head_html' => :'headHtml', :'page_expiry_redirect_url' => :'pageExpiryRedirectUrl', :'ab_status' => :'abStatus', :'use_featured_image' => :'useFeaturedImage', :'ab_test_id' => :'abTestId', :'featured_image_alt_text' => :'featuredImageAltText', :'blog_author_id' => :'blogAuthorId', :'content_group_id' => :'contentGroupId', :'rss_summary' => :'rssSummary', :'page_expiry_enabled' => :'pageExpiryEnabled', :'url' => :'url', :'enable_google_amp_output_override' => :'enableGoogleAmpOutputOverride', :'public_access_rules' => :'publicAccessRules', :'archived_at' => :'archivedAt', :'_post_body' => :'postBody', :'theme_settings_values' => :'themeSettingsValues', :'page_expiry_date' => :'pageExpiryDate', :'public_access_rules_enabled' => :'publicAccessRulesEnabled', :'current_state' => :'currentState', :'category_id' => :'categoryId', :'link_rel_canonical_url' => :'linkRelCanonicalUrl' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'publish_date' => :'Time', :'language' => :'String', :'enable_layout_stylesheets' => :'Boolean', :'meta_description' => :'String', :'attached_stylesheets' => :'Array<Hash<String, Object>>', :'password' => :'String', :'html_title' => :'String', :'publish_immediately' => :'Boolean', :'translations' => :'Hash<String, ContentLanguageVariation>', :'id' => :'String', :'state' => :'String', :'slug' => :'String', :'created_by_id' => :'String', :'rss_body' => :'String', :'currently_published' => :'Boolean', :'archived_in_dashboard' => :'Boolean', :'created' => :'Time', :'content_type_category' => :'String', :'mab_experiment_id' => :'String', :'updated_by_id' => :'String', :'translated_from_id' => :'String', :'folder_id' => :'String', :'widget_containers' => :'Hash<String, Object>', :'page_expiry_redirect_id' => :'Integer', :'dynamic_page_data_source_type' => :'Integer', :'featured_image' => :'String', :'author_name' => :'String', :'domain' => :'String', :'name' => :'String', :'dynamic_page_hub_db_table_id' => :'String', :'campaign' => :'String', :'dynamic_page_data_source_id' => :'String', :'enable_domain_stylesheets' => :'Boolean', :'include_default_custom_css' => :'Boolean', :'layout_sections' => :'Hash<String, LayoutSection>', :'updated' => :'Time', :'footer_html' => :'String', :'tag_ids' => :'Array<Integer>', :'widgets' => :'Hash<String, Object>', :'post_summary' => :'String', :'head_html' => :'String', :'page_expiry_redirect_url' => :'String', :'ab_status' => :'String', :'use_featured_image' => :'Boolean', :'ab_test_id' => :'String', :'featured_image_alt_text' => :'String', :'blog_author_id' => :'String', :'content_group_id' => :'String', :'rss_summary' => :'String', :'page_expiry_enabled' => :'Boolean', :'url' => :'String', :'enable_google_amp_output_override' => :'Boolean', :'public_access_rules' => :'Array<Object>', :'archived_at' => :'Integer', :'_post_body' => :'String', :'theme_settings_values' => :'Hash<String, Object>', :'page_expiry_date' => :'Integer', :'public_access_rules_enabled' => :'Boolean', :'current_state' => :'String', :'category_id' => :'Integer', :'link_rel_canonical_url' => :'String' } 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::Blogs::BlogPosts::BlogPost` 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::Blogs::BlogPosts::BlogPost`. 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?(:'publish_date') self.publish_date = attributes[:'publish_date'] end if attributes.key?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'enable_layout_stylesheets') self.enable_layout_stylesheets = attributes[:'enable_layout_stylesheets'] end if attributes.key?(:'meta_description') self.meta_description = attributes[:'meta_description'] end if attributes.key?(:'attached_stylesheets') if (value = attributes[:'attached_stylesheets']).is_a?(Array) self.attached_stylesheets = value end end if attributes.key?(:'password') self.password = attributes[:'password'] end if attributes.key?(:'html_title') self.html_title = attributes[:'html_title'] end if attributes.key?(:'publish_immediately') self.publish_immediately = attributes[:'publish_immediately'] end if attributes.key?(:'translations') if (value = attributes[:'translations']).is_a?(Hash) self.translations = value end end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'slug') self.slug = attributes[:'slug'] end if attributes.key?(:'created_by_id') self.created_by_id = attributes[:'created_by_id'] end if attributes.key?(:'rss_body') self.rss_body = attributes[:'rss_body'] end if attributes.key?(:'currently_published') self.currently_published = attributes[:'currently_published'] end if attributes.key?(:'archived_in_dashboard') self.archived_in_dashboard = attributes[:'archived_in_dashboard'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'content_type_category') self.content_type_category = attributes[:'content_type_category'] end if attributes.key?(:'mab_experiment_id') self.mab_experiment_id = attributes[:'mab_experiment_id'] end if attributes.key?(:'updated_by_id') self.updated_by_id = attributes[:'updated_by_id'] end if attributes.key?(:'translated_from_id') self.translated_from_id = attributes[:'translated_from_id'] end if attributes.key?(:'folder_id') self.folder_id = attributes[:'folder_id'] end if attributes.key?(:'widget_containers') if (value = attributes[:'widget_containers']).is_a?(Hash) self.widget_containers = value end end if attributes.key?(:'page_expiry_redirect_id') self.page_expiry_redirect_id = attributes[:'page_expiry_redirect_id'] end if attributes.key?(:'dynamic_page_data_source_type') self.dynamic_page_data_source_type = attributes[:'dynamic_page_data_source_type'] end if attributes.key?(:'featured_image') self.featured_image = attributes[:'featured_image'] end if attributes.key?(:'author_name') self.author_name = attributes[:'author_name'] end if attributes.key?(:'domain') self.domain = attributes[:'domain'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'dynamic_page_hub_db_table_id') self.dynamic_page_hub_db_table_id = attributes[:'dynamic_page_hub_db_table_id'] end if attributes.key?(:'campaign') self.campaign = attributes[:'campaign'] end if attributes.key?(:'dynamic_page_data_source_id') self.dynamic_page_data_source_id = attributes[:'dynamic_page_data_source_id'] end if attributes.key?(:'enable_domain_stylesheets') self.enable_domain_stylesheets = attributes[:'enable_domain_stylesheets'] end if attributes.key?(:'include_default_custom_css') self.include_default_custom_css = attributes[:'include_default_custom_css'] end if attributes.key?(:'layout_sections') if (value = attributes[:'layout_sections']).is_a?(Hash) self.layout_sections = value end end if attributes.key?(:'updated') self.updated = attributes[:'updated'] end if attributes.key?(:'footer_html') self.footer_html = attributes[:'footer_html'] end if attributes.key?(:'tag_ids') if (value = attributes[:'tag_ids']).is_a?(Array) self.tag_ids = value end end if attributes.key?(:'widgets') if (value = attributes[:'widgets']).is_a?(Hash) self.widgets = value end end if attributes.key?(:'post_summary') self.post_summary = attributes[:'post_summary'] end if attributes.key?(:'head_html') self.head_html = attributes[:'head_html'] end if attributes.key?(:'page_expiry_redirect_url') self.page_expiry_redirect_url = attributes[:'page_expiry_redirect_url'] end if attributes.key?(:'ab_status') self.ab_status = attributes[:'ab_status'] end if attributes.key?(:'use_featured_image') self.use_featured_image = attributes[:'use_featured_image'] end if attributes.key?(:'ab_test_id') self.ab_test_id = attributes[:'ab_test_id'] end if attributes.key?(:'featured_image_alt_text') self.featured_image_alt_text = attributes[:'featured_image_alt_text'] end if attributes.key?(:'blog_author_id') self.blog_author_id = attributes[:'blog_author_id'] end if attributes.key?(:'content_group_id') self.content_group_id = attributes[:'content_group_id'] end if attributes.key?(:'rss_summary') self.rss_summary = attributes[:'rss_summary'] end if attributes.key?(:'page_expiry_enabled') self.page_expiry_enabled = attributes[:'page_expiry_enabled'] end if attributes.key?(:'url') self.url = attributes[:'url'] end if attributes.key?(:'enable_google_amp_output_override') self.enable_google_amp_output_override = attributes[:'enable_google_amp_output_override'] end if attributes.key?(:'public_access_rules') if (value = attributes[:'public_access_rules']).is_a?(Array) self.public_access_rules = value end end if attributes.key?(:'archived_at') self.archived_at = attributes[:'archived_at'] end if attributes.key?(:'_post_body') self._post_body = attributes[:'_post_body'] end if attributes.key?(:'theme_settings_values') if (value = attributes[:'theme_settings_values']).is_a?(Hash) self.theme_settings_values = value end end if attributes.key?(:'page_expiry_date') self.page_expiry_date = attributes[:'page_expiry_date'] end if attributes.key?(:'public_access_rules_enabled') self.public_access_rules_enabled = attributes[:'public_access_rules_enabled'] end if attributes.key?(:'current_state') self.current_state = attributes[:'current_state'] end if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] end if attributes.key?(:'link_rel_canonical_url') self.link_rel_canonical_url = attributes[:'link_rel_canonical_url'] 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 @publish_date.nil? invalid_properties.push('invalid value for "publish_date", publish_date cannot be nil.') end if @language.nil? invalid_properties.push('invalid value for "language", language cannot be nil.') end if @enable_layout_stylesheets.nil? invalid_properties.push('invalid value for "enable_layout_stylesheets", enable_layout_stylesheets cannot be nil.') end if @meta_description.nil? invalid_properties.push('invalid value for "meta_description", meta_description cannot be nil.') end if @attached_stylesheets.nil? invalid_properties.push('invalid value for "attached_stylesheets", attached_stylesheets cannot be nil.') end if @password.nil? invalid_properties.push('invalid value for "password", password cannot be nil.') end if @html_title.nil? invalid_properties.push('invalid value for "html_title", html_title cannot be nil.') end if @publish_immediately.nil? invalid_properties.push('invalid value for "publish_immediately", publish_immediately cannot be nil.') end if @translations.nil? invalid_properties.push('invalid value for "translations", translations cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @state.nil? invalid_properties.push('invalid value for "state", state cannot be nil.') end if @state.to_s.length > 25 invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 25.') end if @slug.nil? invalid_properties.push('invalid value for "slug", slug cannot be nil.') end if @created_by_id.nil? invalid_properties.push('invalid value for "created_by_id", created_by_id cannot be nil.') end if @rss_body.nil? invalid_properties.push('invalid value for "rss_body", rss_body cannot be nil.') end if @currently_published.nil? invalid_properties.push('invalid value for "currently_published", currently_published cannot be nil.') end if @archived_in_dashboard.nil? invalid_properties.push('invalid value for "archived_in_dashboard", archived_in_dashboard cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @content_type_category.nil? invalid_properties.push('invalid value for "content_type_category", content_type_category cannot be nil.') end if @mab_experiment_id.nil? invalid_properties.push('invalid value for "mab_experiment_id", mab_experiment_id cannot be nil.') end if @updated_by_id.nil? invalid_properties.push('invalid value for "updated_by_id", updated_by_id cannot be nil.') end if @translated_from_id.nil? invalid_properties.push('invalid value for "translated_from_id", translated_from_id cannot be nil.') end if @folder_id.nil? invalid_properties.push('invalid value for "folder_id", folder_id cannot be nil.') end if @widget_containers.nil? invalid_properties.push('invalid value for "widget_containers", widget_containers cannot be nil.') end if @page_expiry_redirect_id.nil? invalid_properties.push('invalid value for "page_expiry_redirect_id", page_expiry_redirect_id cannot be nil.') end if @dynamic_page_data_source_type.nil? invalid_properties.push('invalid value for "dynamic_page_data_source_type", dynamic_page_data_source_type cannot be nil.') end if @featured_image.nil? invalid_properties.push('invalid value for "featured_image", featured_image cannot be nil.') end if @author_name.nil? invalid_properties.push('invalid value for "author_name", author_name cannot be nil.') end if @domain.nil? invalid_properties.push('invalid value for "domain", domain cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @dynamic_page_hub_db_table_id.nil? invalid_properties.push('invalid value for "dynamic_page_hub_db_table_id", dynamic_page_hub_db_table_id cannot be nil.') end if @campaign.nil? invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') end if @dynamic_page_data_source_id.nil? invalid_properties.push('invalid value for "dynamic_page_data_source_id", dynamic_page_data_source_id cannot be nil.') end if @enable_domain_stylesheets.nil? invalid_properties.push('invalid value for "enable_domain_stylesheets", enable_domain_stylesheets cannot be nil.') end if @include_default_custom_css.nil? invalid_properties.push('invalid value for "include_default_custom_css", include_default_custom_css cannot be nil.') end if @layout_sections.nil? invalid_properties.push('invalid value for "layout_sections", layout_sections cannot be nil.') end if @updated.nil? invalid_properties.push('invalid value for "updated", updated cannot be nil.') end if @footer_html.nil? invalid_properties.push('invalid value for "footer_html", footer_html cannot be nil.') end if @tag_ids.nil? invalid_properties.push('invalid value for "tag_ids", tag_ids cannot be nil.') end if @widgets.nil? invalid_properties.push('invalid value for "widgets", widgets cannot be nil.') end if @post_summary.nil? invalid_properties.push('invalid value for "post_summary", post_summary cannot be nil.') end if @head_html.nil? invalid_properties.push('invalid value for "head_html", head_html cannot be nil.') end if @page_expiry_redirect_url.nil? invalid_properties.push('invalid value for "page_expiry_redirect_url", page_expiry_redirect_url cannot be nil.') end if @ab_status.nil? invalid_properties.push('invalid value for "ab_status", ab_status cannot be nil.') end if @use_featured_image.nil? invalid_properties.push('invalid value for "use_featured_image", use_featured_image cannot be nil.') end if @ab_test_id.nil? invalid_properties.push('invalid value for "ab_test_id", ab_test_id cannot be nil.') end if @featured_image_alt_text.nil? invalid_properties.push('invalid value for "featured_image_alt_text", featured_image_alt_text cannot be nil.') end if @blog_author_id.nil? invalid_properties.push('invalid value for "blog_author_id", blog_author_id cannot be nil.') end if @content_group_id.nil? invalid_properties.push('invalid value for "content_group_id", content_group_id cannot be nil.') end if @rss_summary.nil? invalid_properties.push('invalid value for "rss_summary", rss_summary cannot be nil.') end if @page_expiry_enabled.nil? invalid_properties.push('invalid value for "page_expiry_enabled", page_expiry_enabled cannot be nil.') end if @url.nil? invalid_properties.push('invalid value for "url", url cannot be nil.') end if @enable_google_amp_output_override.nil? invalid_properties.push('invalid value for "enable_google_amp_output_override", enable_google_amp_output_override cannot be nil.') end if @public_access_rules.nil?
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
true
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/blog_post_language_clone_request_v_next.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/blog_post_language_clone_request_v_next.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts # Request body object for creating new blog post language variant. class BlogPostLanguageCloneRequestVNext # Target language of new variant. attr_accessor :language # ID of blog post to clone. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'language' => :'language', :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'language' => :'String', :'id' => :'String' } 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::Blogs::BlogPosts::BlogPostLanguageCloneRequestVNext` 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::Blogs::BlogPosts::BlogPostLanguageCloneRequestVNext`. 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?(:'language') self.language = attributes[:'language'] 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 @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 @id.nil? true 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 && language == o.language && 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 [language, 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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/models/row_meta_data.rb
lib/hubspot/codegen/cms/blogs/blog_posts/models/row_meta_data.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module BlogPosts class RowMetaData attr_accessor :css_class attr_accessor :styles # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'css_class' => :'cssClass', :'styles' => :'styles' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'css_class' => :'String', :'styles' => :'Styles' } 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::Blogs::BlogPosts::RowMetaData` 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::Blogs::BlogPosts::RowMetaData`. 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?(:'css_class') self.css_class = attributes[:'css_class'] end if attributes.key?(:'styles') self.styles = attributes[:'styles'] 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 @css_class.nil? invalid_properties.push('invalid value for "css_class", css_class cannot be nil.') end if @styles.nil? invalid_properties.push('invalid value for "styles", styles 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 @css_class.nil? return false if @styles.nil? true 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 && css_class == o.css_class && styles == o.styles 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 [css_class, styles].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::BlogPosts.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/api/multi_language_api.rb
lib/hubspot/codegen/cms/blogs/blog_posts/api/multi_language_api.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Cms module Blogs module BlogPosts class MultiLanguageApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Attach post to a multi-language group # Attach a blog post to a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content). # @param attach_to_lang_primary_request_v_next [AttachToLangPrimaryRequestVNext] The JSON representation of the AttachToLangPrimaryRequest object. # @param [Hash] opts the optional parameters # @return [nil] def attach_to_lang_group(attach_to_lang_primary_request_v_next, opts = {}) attach_to_lang_group_with_http_info(attach_to_lang_primary_request_v_next, opts) nil end # Attach post to a multi-language group # Attach a blog post to a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content). # @param attach_to_lang_primary_request_v_next [AttachToLangPrimaryRequestVNext] The JSON representation of the AttachToLangPrimaryRequest object. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def attach_to_lang_group_with_http_info(attach_to_lang_primary_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MultiLanguageApi.attach_to_lang_group ...' end # verify the required parameter 'attach_to_lang_primary_request_v_next' is set if @api_client.config.client_side_validation && attach_to_lang_primary_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'attach_to_lang_primary_request_v_next' when calling MultiLanguageApi.attach_to_lang_group" end # resource path local_var_path = '/cms/v3/blogs/posts/multi-language/attach-to-lang-group' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(attach_to_lang_primary_request_v_next) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"MultiLanguageApi.attach_to_lang_group", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MultiLanguageApi#attach_to_lang_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a language variation # Create a new language variation from an existing blog post # @param blog_post_language_clone_request_v_next [BlogPostLanguageCloneRequestVNext] The JSON representation of the BlogPostLanguageCloneRequestVNext object. # @param [Hash] opts the optional parameters # @return [BlogPost] def create_lang_variation(blog_post_language_clone_request_v_next, opts = {}) data, _status_code, _headers = create_lang_variation_with_http_info(blog_post_language_clone_request_v_next, opts) data end # Create a language variation # Create a new language variation from an existing blog post # @param blog_post_language_clone_request_v_next [BlogPostLanguageCloneRequestVNext] The JSON representation of the BlogPostLanguageCloneRequestVNext object. # @param [Hash] opts the optional parameters # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers def create_lang_variation_with_http_info(blog_post_language_clone_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MultiLanguageApi.create_lang_variation ...' end # verify the required parameter 'blog_post_language_clone_request_v_next' is set if @api_client.config.client_side_validation && blog_post_language_clone_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'blog_post_language_clone_request_v_next' when calling MultiLanguageApi.create_lang_variation" end # resource path local_var_path = '/cms/v3/blogs/posts/multi-language/create-language-variation' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(blog_post_language_clone_request_v_next) # return_type return_type = opts[:debug_return_type] || 'BlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"MultiLanguageApi.create_lang_variation", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MultiLanguageApi#create_lang_variation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Detach post from a multi-language group # Detach a blog post from a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content). # @param detach_from_lang_group_request_v_next [DetachFromLangGroupRequestVNext] The JSON representation of the DetachFromLangGroupRequest object. # @param [Hash] opts the optional parameters # @return [nil] def detach_from_lang_group(detach_from_lang_group_request_v_next, opts = {}) detach_from_lang_group_with_http_info(detach_from_lang_group_request_v_next, opts) nil end # Detach post from a multi-language group # Detach a blog post from a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content). # @param detach_from_lang_group_request_v_next [DetachFromLangGroupRequestVNext] The JSON representation of the DetachFromLangGroupRequest object. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def detach_from_lang_group_with_http_info(detach_from_lang_group_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MultiLanguageApi.detach_from_lang_group ...' end # verify the required parameter 'detach_from_lang_group_request_v_next' is set if @api_client.config.client_side_validation && detach_from_lang_group_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'detach_from_lang_group_request_v_next' when calling MultiLanguageApi.detach_from_lang_group" end # resource path local_var_path = '/cms/v3/blogs/posts/multi-language/detach-from-lang-group' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(detach_from_lang_group_request_v_next) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"MultiLanguageApi.detach_from_lang_group", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MultiLanguageApi#detach_from_lang_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Set a new primary language # Set the primary language of a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content) to the language of the provided post (specified as an ID in the request body) # @param set_new_language_primary_request_v_next [SetNewLanguagePrimaryRequestVNext] The JSON representation of the SetNewLanguagePrimaryRequest object. # @param [Hash] opts the optional parameters # @return [nil] def set_lang_primary(set_new_language_primary_request_v_next, opts = {}) set_lang_primary_with_http_info(set_new_language_primary_request_v_next, opts) nil end # Set a new primary language # Set the primary language of a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content) to the language of the provided post (specified as an ID in the request body) # @param set_new_language_primary_request_v_next [SetNewLanguagePrimaryRequestVNext] The JSON representation of the SetNewLanguagePrimaryRequest object. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def set_lang_primary_with_http_info(set_new_language_primary_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MultiLanguageApi.set_lang_primary ...' end # verify the required parameter 'set_new_language_primary_request_v_next' is set if @api_client.config.client_side_validation && set_new_language_primary_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'set_new_language_primary_request_v_next' when calling MultiLanguageApi.set_lang_primary" end # resource path local_var_path = '/cms/v3/blogs/posts/multi-language/set-new-lang-primary' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(set_new_language_primary_request_v_next) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"MultiLanguageApi.set_lang_primary", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MultiLanguageApi#set_lang_primary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update languages of multi-language group # Explicitly set new languages for each post in a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content). # @param update_languages_request_v_next [UpdateLanguagesRequestVNext] The JSON representation of the SetNewLanguagePrimaryRequest object. # @param [Hash] opts the optional parameters # @return [nil] def update_langs(update_languages_request_v_next, opts = {}) update_langs_with_http_info(update_languages_request_v_next, opts) nil end # Update languages of multi-language group # Explicitly set new languages for each post in a [multi-language group](https://developers.hubspot.com/docs/guides/cms/content/multi-language-content). # @param update_languages_request_v_next [UpdateLanguagesRequestVNext] The JSON representation of the SetNewLanguagePrimaryRequest object. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def update_langs_with_http_info(update_languages_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MultiLanguageApi.update_langs ...' end # verify the required parameter 'update_languages_request_v_next' is set if @api_client.config.client_side_validation && update_languages_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'update_languages_request_v_next' when calling MultiLanguageApi.update_langs" end # resource path local_var_path = '/cms/v3/blogs/posts/multi-language/update-languages' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_languages_request_v_next) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"MultiLanguageApi.update_langs", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MultiLanguageApi#update_langs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/api/batch_api.rb
lib/hubspot/codegen/cms/blogs/blog_posts/api/batch_api.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Cms module Blogs module BlogPosts class BatchApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete a batch of blog posts # Delete a blog post by ID. Note: This is not the same as the in-app `archive` function. To perform a dashboard `archive` send an normal update with the `archivedInDashboard` field set to `true`. # @param batch_input_string [BatchInputString] The JSON array of Blog Post ids. # @param [Hash] opts the optional parameters # @return [nil] def archive(batch_input_string, opts = {}) archive_with_http_info(batch_input_string, opts) nil end # Delete a batch of blog posts # Delete a blog post by ID. Note: This is not the same as the in-app &#x60;archive&#x60; function. To perform a dashboard &#x60;archive&#x60; send an normal update with the &#x60;archivedInDashboard&#x60; field set to &#x60;true&#x60;. # @param batch_input_string [BatchInputString] The JSON array of Blog Post ids. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_with_http_info(batch_input_string, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BatchApi.archive ...' end # verify the required parameter 'batch_input_string' is set if @api_client.config.client_side_validation && batch_input_string.nil? fail ArgumentError, "Missing the required parameter 'batch_input_string' when calling BatchApi.archive" end # resource path local_var_path = '/cms/v3/blogs/posts/batch/archive' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_string) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BatchApi.archive", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BatchApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a batch of blog posts # Create a batch of blog posts, specifying their content in the request body. # @param batch_input_blog_post [BatchInputBlogPost] The JSON array of new Blog Posts to create. # @param [Hash] opts the optional parameters # @return [BatchResponseBlogPost] def create(batch_input_blog_post, opts = {}) data, _status_code, _headers = create_with_http_info(batch_input_blog_post, opts) data end # Create a batch of blog posts # Create a batch of blog posts, specifying their content in the request body. # @param batch_input_blog_post [BatchInputBlogPost] The JSON array of new Blog Posts to create. # @param [Hash] opts the optional parameters # @return [Array<(BatchResponseBlogPost, Integer, Hash)>] BatchResponseBlogPost data, response status code and response headers def create_with_http_info(batch_input_blog_post, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BatchApi.create ...' end # verify the required parameter 'batch_input_blog_post' is set if @api_client.config.client_side_validation && batch_input_blog_post.nil? fail ArgumentError, "Missing the required parameter 'batch_input_blog_post' when calling BatchApi.create" end # resource path local_var_path = '/cms/v3/blogs/posts/batch/create' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_blog_post) # return_type return_type = opts[:debug_return_type] || 'BatchResponseBlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BatchApi.create", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BatchApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a batch of Blog Posts # Retrieve a batch of blog posts by ID. identified in the request body. # @param batch_input_string [BatchInputString] The JSON array of Blog Post ids. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted blog posts Defaults to &#x60;false&#x60;. # @return [BatchResponseBlogPost] def read(batch_input_string, opts = {}) data, _status_code, _headers = read_with_http_info(batch_input_string, opts) data end # Retrieve a batch of Blog Posts # Retrieve a batch of blog posts by ID. identified in the request body. # @param batch_input_string [BatchInputString] The JSON array of Blog Post ids. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted blog posts Defaults to &#x60;false&#x60;. # @return [Array<(BatchResponseBlogPost, Integer, Hash)>] BatchResponseBlogPost data, response status code and response headers def read_with_http_info(batch_input_string, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BatchApi.read ...' end # verify the required parameter 'batch_input_string' is set if @api_client.config.client_side_validation && batch_input_string.nil? fail ArgumentError, "Missing the required parameter 'batch_input_string' when calling BatchApi.read" end # resource path local_var_path = '/cms/v3/blogs/posts/batch/read' # query parameters query_params = opts[:query_params] || {} query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_string) # return_type return_type = opts[:debug_return_type] || 'BatchResponseBlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BatchApi.read", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BatchApi#read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a batch of Blog Posts # Update a batch of blog posts. # @param batch_input_json_node [BatchInputJsonNode] A JSON array of the JSON representations of the updated Blog Posts. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to update deleted Blog Posts. Defaults to &#x60;false&#x60;. # @return [BatchResponseBlogPost] def update(batch_input_json_node, opts = {}) data, _status_code, _headers = update_with_http_info(batch_input_json_node, opts) data end # Update a batch of Blog Posts # Update a batch of blog posts. # @param batch_input_json_node [BatchInputJsonNode] A JSON array of the JSON representations of the updated Blog Posts. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to update deleted Blog Posts. Defaults to &#x60;false&#x60;. # @return [Array<(BatchResponseBlogPost, Integer, Hash)>] BatchResponseBlogPost data, response status code and response headers def update_with_http_info(batch_input_json_node, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BatchApi.update ...' end # verify the required parameter 'batch_input_json_node' is set if @api_client.config.client_side_validation && batch_input_json_node.nil? fail ArgumentError, "Missing the required parameter 'batch_input_json_node' when calling BatchApi.update" end # resource path local_var_path = '/cms/v3/blogs/posts/batch/update' # query parameters query_params = opts[:query_params] || {} query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_json_node) # return_type return_type = opts[:debug_return_type] || 'BatchResponseBlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BatchApi.update", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BatchApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb
lib/hubspot/codegen/cms/blogs/blog_posts/api/basic_api.rb
=begin #Posts #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Cms module Blogs module BlogPosts class BasicApi require 'hubspot/helpers/get_all_helper' include Hubspot::Helpers::GetAllHelper attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete a blog post # Delete a blog post by ID. # @param object_id [String] The ID of the blog post to delete. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Whether to return only results that have been deleted. # @return [nil] def archive(object_id, opts = {}) archive_with_http_info(object_id, opts) nil end # Delete a blog post # Delete a blog post by ID. # @param object_id [String] The ID of the blog post to delete. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Whether to return only results that have been deleted. # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.archive ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.archive" end # resource path local_var_path = '/cms/v3/blogs/posts/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.archive", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Clone a blog post # Clone a blog post, making a copy of it in a new blog post. # @param content_clone_request_v_next [ContentCloneRequestVNext] The JSON representation of the ContentCloneRequest object. # @param [Hash] opts the optional parameters # @return [BlogPost] def clone(content_clone_request_v_next, opts = {}) data, _status_code, _headers = clone_with_http_info(content_clone_request_v_next, opts) data end # Clone a blog post # Clone a blog post, making a copy of it in a new blog post. # @param content_clone_request_v_next [ContentCloneRequestVNext] The JSON representation of the ContentCloneRequest object. # @param [Hash] opts the optional parameters # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers def clone_with_http_info(content_clone_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.clone ...' end # verify the required parameter 'content_clone_request_v_next' is set if @api_client.config.client_side_validation && content_clone_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'content_clone_request_v_next' when calling BasicApi.clone" end # resource path local_var_path = '/cms/v3/blogs/posts/clone' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(content_clone_request_v_next) # return_type return_type = opts[:debug_return_type] || 'BlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.clone", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#clone\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new post # Create a new blog post, specifying its content in the request body. # @param blog_post [BlogPost] The JSON representation of a new Blog Post. # @param [Hash] opts the optional parameters # @return [BlogPost] def create(blog_post, opts = {}) data, _status_code, _headers = create_with_http_info(blog_post, opts) data end # Create a new post # Create a new blog post, specifying its content in the request body. # @param blog_post [BlogPost] The JSON representation of a new Blog Post. # @param [Hash] opts the optional parameters # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers def create_with_http_info(blog_post, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.create ...' end # verify the required parameter 'blog_post' is set if @api_client.config.client_side_validation && blog_post.nil? fail ArgumentError, "Missing the required parameter 'blog_post' when calling BasicApi.create" end # resource path local_var_path = '/cms/v3/blogs/posts' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(blog_post) # return_type return_type = opts[:debug_return_type] || 'BlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.create", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a blog post # Retrieve a blog post by the post ID. # @param object_id [String] The ID of the blog post to retrieve. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;. # @option opts [String] :property Specific properties to return. # @return [BlogPost] def get_by_id(object_id, opts = {}) data, _status_code, _headers = get_by_id_with_http_info(object_id, opts) data end # Retrieve a blog post # Retrieve a blog post by the post ID. # @param object_id [String] The ID of the blog post to retrieve. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;. # @option opts [String] :property Specific properties to return. # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers def get_by_id_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.get_by_id ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_by_id" end # resource path local_var_path = '/cms/v3/blogs/posts/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? query_params[:'property'] = opts[:'property'] if !opts[:'property'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'BlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.get_by_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve the full draft version of the Blog Post # Retrieve the full draft version of a blog post. # @param object_id [String] The ID of the blog post to retrieve the draft of. # @param [Hash] opts the optional parameters # @return [BlogPost] def get_draft_by_id(object_id, opts = {}) data, _status_code, _headers = get_draft_by_id_with_http_info(object_id, opts) data end # Retrieve the full draft version of the Blog Post # Retrieve the full draft version of a blog post. # @param object_id [String] The ID of the blog post to retrieve the draft of. # @param [Hash] opts the optional parameters # @return [Array<(BlogPost, Integer, Hash)>] BlogPost data, response status code and response headers def get_draft_by_id_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.get_draft_by_id ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_draft_by_id" end # resource path local_var_path = '/cms/v3/blogs/posts/{objectId}/draft'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'BlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.get_draft_by_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#get_draft_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all posts # Retrieve all blog posts, with paging and filtering options. This method would be useful for an integration that ingests posts and suggests edits. # @param [Hash] opts the optional parameters # @option opts [Time] :created_at Only return blog posts created at exactly the specified time. # @option opts [Time] :created_after Only return blog posts created after the specified time. # @option opts [Time] :created_before Only return blog posts created before the specified time. # @option opts [Time] :updated_at Only return blog posts last updated at exactly the specified time. # @option opts [Time] :updated_after Only return blog posts last updated after the specified time. # @option opts [Time] :updated_before Only return blog posts last updated before the specified time. # @option opts [Array<String>] :sort Specifies which fields to use for sorting results. Valid fields are &#x60;createdAt&#x60; (default), &#x60;name&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [Integer] :limit The maximum number of results to return. Default is 20. # @option opts [Boolean] :archived Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [CollectionResponseWithTotalBlogPostForwardPaging] def get_page(opts = {}) data, _status_code, _headers = get_page_with_http_info(opts) data end # Get all posts # Retrieve all blog posts, with paging and filtering options. This method would be useful for an integration that ingests posts and suggests edits. # @param [Hash] opts the optional parameters # @option opts [Time] :created_at Only return blog posts created at exactly the specified time. # @option opts [Time] :created_after Only return blog posts created after the specified time. # @option opts [Time] :created_before Only return blog posts created before the specified time. # @option opts [Time] :updated_at Only return blog posts last updated at exactly the specified time. # @option opts [Time] :updated_after Only return blog posts last updated after the specified time. # @option opts [Time] :updated_before Only return blog posts last updated before the specified time. # @option opts [Array<String>] :sort Specifies which fields to use for sorting results. Valid fields are &#x60;createdAt&#x60; (default), &#x60;name&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [Integer] :limit The maximum number of results to return. Default is 20. # @option opts [Boolean] :archived Specifies whether to return deleted blog posts. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [Array<(CollectionResponseWithTotalBlogPostForwardPaging, Integer, Hash)>] CollectionResponseWithTotalBlogPostForwardPaging data, response status code and response headers def get_page_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.get_page ...' end # resource path local_var_path = '/cms/v3/blogs/posts' # query parameters query_params = opts[:query_params] || {} query_params[:'createdAt'] = opts[:'created_at'] if !opts[:'created_at'].nil? query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil? query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil? query_params[:'updatedAt'] = opts[:'updated_at'] if !opts[:'updated_at'].nil? query_params[:'updatedAfter'] = opts[:'updated_after'] if !opts[:'updated_after'].nil? query_params[:'updatedBefore'] = opts[:'updated_before'] if !opts[:'updated_before'].nil? query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? query_params[:'property'] = opts[:'property'] if !opts[:'property'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CollectionResponseWithTotalBlogPostForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.get_page", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a previous version of a blog post # Retrieve a previous version of a blog post. # @param object_id [String] The ID of the blog post. # @param revision_id [String] The ID of the version to retrieve. # @param [Hash] opts the optional parameters # @return [VersionBlogPost] def get_previous_version(object_id, revision_id, opts = {}) data, _status_code, _headers = get_previous_version_with_http_info(object_id, revision_id, opts) data end # Retrieve a previous version of a blog post # Retrieve a previous version of a blog post. # @param object_id [String] The ID of the blog post. # @param revision_id [String] The ID of the version to retrieve. # @param [Hash] opts the optional parameters # @return [Array<(VersionBlogPost, Integer, Hash)>] VersionBlogPost data, response status code and response headers def get_previous_version_with_http_info(object_id, revision_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.get_previous_version ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_previous_version" end # verify the required parameter 'revision_id' is set if @api_client.config.client_side_validation && revision_id.nil? fail ArgumentError, "Missing the required parameter 'revision_id' when calling BasicApi.get_previous_version" end # resource path local_var_path = '/cms/v3/blogs/posts/{objectId}/revisions/{revisionId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'revisionId' + '}', CGI.escape(revision_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'VersionBlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.get_previous_version", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#get_previous_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieves all previous versions of a post # Retrieve all the previous versions of a blog post. # @param object_id [String] The ID of the blog post to retrieve previous versions of. # @param [Hash] opts the optional parameters # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [String] :before # @option opts [Integer] :limit The maximum number of results to return. Default is 100. # @return [CollectionResponseWithTotalVersionBlogPost] def get_previous_versions(object_id, opts = {}) data, _status_code, _headers = get_previous_versions_with_http_info(object_id, opts) data end # Retrieves all previous versions of a post # Retrieve all the previous versions of a blog post. # @param object_id [String] The ID of the blog post to retrieve previous versions of. # @param [Hash] opts the optional parameters # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [String] :before # @option opts [Integer] :limit The maximum number of results to return. Default is 100. # @return [Array<(CollectionResponseWithTotalVersionBlogPost, Integer, Hash)>] CollectionResponseWithTotalVersionBlogPost data, response status code and response headers def get_previous_versions_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.get_previous_versions ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_previous_versions" end # resource path local_var_path = '/cms/v3/blogs/posts/{objectId}/revisions'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CollectionResponseWithTotalVersionBlogPost' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.get_previous_versions", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#get_previous_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Publish blog post draft # Publish the draft version of the blog post, sending its content to the live page. # @param object_id [String] The ID of the post to publish. # @param [Hash] opts the optional parameters # @return [nil] def push_live(object_id, opts = {}) push_live_with_http_info(object_id, opts) nil end # Publish blog post draft # Publish the draft version of the blog post, sending its content to the live page. # @param object_id [String] The ID of the post to publish. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def push_live_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.push_live ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.push_live" end # resource path local_var_path = '/cms/v3/blogs/posts/{objectId}/draft/push-live'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.push_live", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#push_live\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Reset post draft to the live version # Discard all drafted content, resetting the draft to contain the content in the currently published version. # @param object_id [String] The ID of the blog post to reset. # @param [Hash] opts the optional parameters # @return [nil] def reset_draft(object_id, opts = {})
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
true
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/api_error.rb
lib/hubspot/codegen/cms/blogs/tags/api_error.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end module Hubspot module Cms module Blogs module Tags class ApiError < ::StandardError attr_reader :code, :response_headers, :response_body # Usage examples: # ApiError.new # ApiError.new("message") # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") # ApiError.new(:code => 404, :message => "Not Found") def initialize(arg = nil) if arg.is_a? Hash if arg.key?(:message) || arg.key?('message') super(arg[:message] || arg['message']) else super arg end arg.each do |k, v| instance_variable_set "@#{k}", v end else super arg end end # Override to_s to display a friendly error message def to_s message end def message if @message.nil? msg = "Error message: the server returns an error" else msg = @message end msg += "\nHTTP status code: #{code}" if code msg += "\nResponse headers: #{response_headers}" if response_headers msg += "\nResponse body: #{response_body}" if response_body msg end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/configuration.rb
lib/hubspot/codegen/cms/blogs/tags/configuration.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end module Hubspot module Cms module Blogs module Tags class Configuration # Defines url scheme attr_accessor :scheme # Defines url host attr_accessor :host # Defines url base path attr_accessor :base_path # Define server configuration index attr_accessor :server_index # Define server operation configuration index attr_accessor :server_operation_index # Default server variables attr_accessor :server_variables # Default server operation variables attr_accessor :server_operation_variables # Defines API keys used with API Key authentications. # # @return [Hash] key: parameter name, value: parameter value (API key) # # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) # config.api_key['api_key'] = 'xxx' attr_accessor :api_key # Defines API key prefixes used with API Key authentications. # # @return [Hash] key: parameter name, value: API key prefix # # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) # config.api_key_prefix['api_key'] = 'Token' attr_accessor :api_key_prefix # Defines the username used with HTTP basic authentication. # # @return [String] attr_accessor :username # Defines the password used with HTTP basic authentication. # # @return [String] attr_accessor :password # Defines the access token (Bearer) used with OAuth2. attr_accessor :access_token # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response # details will be logged with `logger.debug` (see the `logger` attribute). # Default to false. # # @return [true, false] attr_accessor :debugging # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # # @return [#debug] attr_accessor :logger # Defines the temporary folder to store downloaded files # (for API endpoints that have file response). # Default to use `Tempfile`. # # @return [String] attr_accessor :temp_folder_path # The time limit for HTTP request in seconds. # Default to 0 (never times out). attr_accessor :timeout # Set this to false to skip client side validation in the operation. # Default to true. # @return [true, false] attr_accessor :client_side_validation ### TLS/SSL setting # Set this to false to skip verifying SSL certificate when calling API from https server. # Default to true. # # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. # # @return [true, false] attr_accessor :verify_ssl ### TLS/SSL setting # Set this to false to skip verifying SSL host name # Default to true. # # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. # # @return [true, false] attr_accessor :verify_ssl_host ### TLS/SSL setting # Set this to customize the certificate file to verify the peer. # # @return [String] the path to the certificate file # # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 attr_accessor :ssl_ca_cert ### TLS/SSL setting # Client certificate file (for client certificate) attr_accessor :cert_file ### TLS/SSL setting # Client private key file (for client certificate) attr_accessor :key_file # Set this to customize parameters encoding of array parameter with multi collectionFormat. # Default to nil. # # @see The params_encoding option of Ethon. Related source code: # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding attr_accessor :inject_format attr_accessor :force_ending_format attr_accessor :error_handler def initialize @scheme = 'https' @host = 'api.hubapi.com' @base_path = '' @server_index = 0 @server_operation_index = {} @server_variables = {} @server_operation_variables = {} @api_key = {} @api_key_prefix = {} @client_side_validation = true @verify_ssl = true @verify_ssl_host = true @cert_file = nil @key_file = nil @timeout = 0 @params_encoding = nil @debugging = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) # error_handler params: { 'status_code': { max_retries: ..., seconds_delay: ... }, ... } @error_handler = {} yield(self) if block_given? end # The default Configuration object. def self.default @@default ||= Configuration.new end def configure yield(self) if block_given? end def scheme=(scheme) # remove :// from scheme @scheme = scheme.sub(/:\/\//, '') end def host=(host) # remove http(s):// and anything after a slash @host = host.sub(/https?:\/\//, '').split('/').first end def base_path=(base_path) # Add leading and trailing slashes to base_path @base_path = "/#{base_path}".gsub(/\/+/, '/') @base_path = '' if @base_path == '/' end # Returns base URL for specified operation based on server settings def base_url(operation = nil) index = server_operation_index.fetch(operation, server_index) return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) end # Gets API key (with prefix if set). # @param [String] param_name the parameter name of API key auth def api_key_with_prefix(param_name, param_alias = nil) key = @api_key[param_name] key = @api_key.fetch(param_alias, key) unless param_alias.nil? if @api_key_prefix[param_name] "#{@api_key_prefix[param_name]} #{key}" else key end end # Gets Basic Auth token string def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") end # Returns Auth Settings hash for api client. def auth_settings { 'oauth2' => { type: 'oauth2', in: 'header', key: 'Authorization', value: "Bearer #{access_token}" }, } end # Returns an array of Server setting def server_settings [ { url: "https://api.hubapi.com", description: "No description provided", } ] end def operation_server_settings { } end # Returns URL based on server settings # # @param index array index of the server settings # @param variables hash of variable and the corresponding value def server_url(index, variables = {}, servers = nil) servers = server_settings if servers == nil # check array index out of bound if (index < 0 || index >= servers.size) fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" end server = servers[index] url = server[:url] return url unless server.key? :variables # go through variable and assign a value server[:variables].each do |name, variable| if variables.key?(name) if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) url.gsub! "{" + name.to_s + "}", variables[name] else fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." end else # use default value url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] end end url end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/api_client.rb
lib/hubspot/codegen/cms/blogs/tags/api_client.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'json' require 'logger' require 'tempfile' require 'time' require 'typhoeus' module Hubspot module Cms module Blogs module Tags class ApiClient # The Configuration object holding settings to be used in the API client. attr_accessor :config # Defines the headers to be used in HTTP requests of all API calls by default. # # @return [Hash] attr_accessor :default_headers # Initializes the ApiClient # @option config [Configuration] Configuration for initializing the object, default to Configuration.default def initialize(config = Configuration.default) @config = config @user_agent = "hubspot-api-client-ruby; #{VERSION}" @default_headers = { 'Content-Type' => 'application/json', 'User-Agent' => @user_agent } end def self.default @@default ||= ApiClient.new end # Call an API with given options. # # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: # the data deserialized from response body (could be nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) response = request.run if @config.debugging @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" end if !response.success? && config.error_handler.any? config.error_handler.each do |statuses, opts| statuses = statuses.is_a?(Integer) ? [statuses] : statuses retries = opts[:max_retries] || 5 while retries > 0 && statuses.include?(response.code) sleep opts[:seconds_delay] if opts[:seconds_delay] response = request.run opts[:retry_block].call if opts[:retry_block] retries -= 1 end end end unless response.success? if response.timed_out? fail ApiError.new('Connection timed out') elsif response.code == 0 # Errors from libcurl will be made visible here fail ApiError.new(:code => 0, :message => response.return_message) else fail ApiError.new(:code => response.code, :response_headers => response.headers, :response_body => response.body), response.status_message end end if opts[:return_type] data = deserialize(response, opts[:return_type]) else data = nil end return data, response.code, response.headers end # Builds the HTTP request # # @param [String] http_method HTTP method/verb (e.g. POST) # @param [String] path URL path (e.g. /account/new) # @option opts [Hash] :header_params Header parameters # @option opts [Hash] :query_params Query parameters # @option opts [Hash] :form_params Query parameters # @option opts [Object] :body HTTP body (JSON/XML) # @return [Typhoeus::Request] A Typhoeus Request def build_request(http_method, path, opts = {}) url = build_request_url(path, opts) http_method = http_method.to_sym.downcase header_params = @default_headers.merge(opts[:header_params] || {}) query_params = opts[:query_params] || {} form_params = opts[:form_params] || {} follow_location = opts[:follow_location] || true update_params_for_auth! header_params, query_params, opts[:auth_names] # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 req_opts = { :method => http_method, :headers => header_params, :params => query_params, :params_encoding => @config.params_encoding, :timeout => @config.timeout, :ssl_verifypeer => @config.verify_ssl, :ssl_verifyhost => _verify_ssl_host, :sslcert => @config.cert_file, :sslkey => @config.key_file, :verbose => @config.debugging, :followlocation => follow_location } # set custom cert, if provided req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert if [:post, :patch, :put, :delete].include?(http_method) req_body = build_request_body(header_params, form_params, opts[:body]) req_opts.update :body => req_body if @config.debugging @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" end end request = Typhoeus::Request.new(url, req_opts) download_file(request) if opts[:return_type] == 'File' request end # Builds the HTTP request body # # @param [Hash] header_params Header parameters # @param [Hash] form_params Query parameters # @param [Object] body HTTP body (JSON/XML) # @return [String] HTTP body data in the form of string def build_request_body(header_params, form_params, body) # http form if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || header_params['Content-Type'] == 'multipart/form-data' data = {} form_params.each do |key, value| case value when ::File, ::Array, nil # let typhoeus handle File, Array and nil parameters data[key] = value else data[key] = value.to_s end end elsif body data = body.is_a?(String) ? body : body.to_json else data = nil end data end # Save response body into a file in (the defined) temporary folder, using the filename # from the "Content-Disposition" header if provided, otherwise a random filename. # The response body is written to the file in chunks in order to handle files which # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby # process can use. # # @see Configuration#temp_folder_path def download_file(request) tempfile = nil encoding = nil request.on_headers do |response| content_disposition = response.headers['Content-Disposition'] if content_disposition && content_disposition =~ /filename=/i filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] prefix = sanitize_filename(filename) else prefix = 'download-' end prefix = prefix + '-' unless prefix.end_with?('-') encoding = response.body.encoding tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) @tempfile = tempfile end request.on_body do |chunk| chunk.force_encoding(encoding) tempfile.write(chunk) end request.on_complete do |response| if tempfile tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" end end end # Check if the given MIME is a JSON MIME. # JSON MIME examples: # application/json # application/json; charset=UTF8 # APPLICATION/JSON # */* # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. # # @param [Response] response HTTP response # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>" def deserialize(response, return_type) body = response.body # handle file downloading - return the File instance processed in request callbacks # note that response body is empty when the file is written in chunks in request on_body callback return @tempfile if return_type == 'File' return nil if body.nil? || body.empty? # return response body directly for String return type return body if return_type == 'String' # ensuring a default content type content_type = response.headers['Content-Type'] || 'application/json' fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) begin data = JSON.parse("[#{body}]", :symbolize_names => true)[0] rescue JSON::ParserError => e if %w(String Date Time).include?(return_type) data = body else raise e end end convert_to_type data, return_type end # Convert data to the given return type. # @param [Object] data Data to be converted # @param [String] return_type Return type # @return [Mixed] Data in a particular type def convert_to_type(data, return_type) return nil if data.nil? case return_type when 'String' data.to_s when 'Integer' data.to_i when 'Float' data.to_f when 'Boolean' data == true when 'Time' # parse date time (expecting ISO 8601 format) Time.parse data when 'Date' # parse date time (expecting ISO 8601 format) Date.parse data when 'Object' # generic object (usually a Hash), return directly data when /\AArray<(.+)>\z/ # e.g. Array<Pet> sub_type = $1 data.map { |item| convert_to_type(item, sub_type) } when /\AHash\<String, (.+)\>\z/ # e.g. Hash<String, Integer> sub_type = $1 {}.tap do |hash| data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(return_type) klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) end end # Sanitize filename by removing path. # e.g. ../../sun.gif becomes sun.gif # # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) filename.gsub(/.*[\/\\]/, '') end def build_request_url(path, opts = {}) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') @config.base_url(opts[:operation]) + path end # Update header and query params based on authentication settings. # # @param [Hash] header_params Header parameters # @param [Hash] query_params Query parameters # @param [String] auth_names Authentication scheme name def update_params_for_auth!(header_params, query_params, auth_names) Array(auth_names).each do |auth_name| auth_setting = @config.auth_settings[auth_name] next unless auth_setting case auth_setting[:in] when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] else fail ArgumentError, 'Authentication token must be in `query` or `header`' end end end # Sets user agent in HTTP header # # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) def user_agent=(user_agent) @user_agent = user_agent @default_headers['User-Agent'] = @user_agent end # Return Accept header based on an array of accepts provided. # @param [Array] accepts array for Accept # @return [String] the Accept header (e.g. application/json) def select_header_accept(accepts) return nil if accepts.nil? || accepts.empty? # use JSON when present, otherwise use all of the provided json_accept = accepts.find { |s| json_mime?(s) } json_accept || accepts.join(',') end # Return Content-Type header based on an array of content types provided. # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # return nil by default return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first end # Convert object (array, hash, object, etc) to JSON string. # @param [Object] model object to be converted into JSON string # @return [String] JSON string representation of the object def object_to_http_body(model) return model if model.nil? || model.is_a?(String) local_body = nil if model.is_a?(Array) local_body = model.map { |m| object_to_hash(m) } else local_body = object_to_hash(model) end local_body.to_json end # Convert object(non-array) to hash. # @param [Object] obj object to be converted into JSON string # @return [String] JSON string representation of the object def object_to_hash(obj) if obj.respond_to?(:to_hash) obj.to_hash else obj end end # Build parameter value according to the given collection format. # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi def build_collection_param(param, collection_format) case collection_format when :csv param.join(',') when :ssv param.join(' ') when :tsv param.join("\t") when :pipes param.join('|') when :multi # return the array directly as typhoeus will handle it as expected param else fail "unknown collection format: #{collection_format.inspect}" end end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/batch_input_string.rb
lib/hubspot/codegen/cms/blogs/tags/models/batch_input_string.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Wrapper for providing an array of strings as inputs. class BatchInputString # Strings to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<String>' } 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::Blogs::Tags::BatchInputString` 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::Blogs::Tags::BatchInputString`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/tag.rb
lib/hubspot/codegen/cms/blogs/tags/models/tag.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Model definition for a Tag. class Tag # The timestamp (ISO8601 format) when this Blog Tag was deleted. attr_accessor :deleted_at attr_accessor :created # The name of the tag. attr_accessor :name # The explicitly defined ISO 639 language code of the tag. attr_accessor :language # The unique ID of the Blog Tag. attr_accessor :id # ID of the primary tag this object was translated from. attr_accessor :translated_from_id attr_accessor :updated 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 { :'deleted_at' => :'deletedAt', :'created' => :'created', :'name' => :'name', :'language' => :'language', :'id' => :'id', :'translated_from_id' => :'translatedFromId', :'updated' => :'updated' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'deleted_at' => :'Time', :'created' => :'Time', :'name' => :'String', :'language' => :'String', :'id' => :'String', :'translated_from_id' => :'Integer', :'updated' => :'Time' } 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::Blogs::Tags::Tag` 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::Blogs::Tags::Tag`. 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?(:'deleted_at') self.deleted_at = attributes[:'deleted_at'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'translated_from_id') self.translated_from_id = attributes[:'translated_from_id'] end if attributes.key?(:'updated') self.updated = attributes[:'updated'] 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 @deleted_at.nil? invalid_properties.push('invalid value for "deleted_at", deleted_at cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @language.nil? invalid_properties.push('invalid value for "language", language cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @translated_from_id.nil? invalid_properties.push('invalid value for "translated_from_id", translated_from_id cannot be nil.') end if @updated.nil? invalid_properties.push('invalid value for "updated", updated 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 @deleted_at.nil? return false if @created.nil? return false if @name.nil? return false if @language.nil? language_validator = EnumAttributeValidator.new('String', ["af", "af-na", "af-za", "agq", "agq-cm", "ak", "ak-gh", "am", "am-et", "ar", "ar-001", "ar-ae", "ar-bh", "ar-dj", "ar-dz", "ar-eg", "ar-eh", "ar-er", "ar-il", "ar-iq", "ar-jo", "ar-km", "ar-kw", "ar-lb", "ar-ly", "ar-ma", "ar-mr", "ar-om", "ar-ps", "ar-qa", "ar-sa", "ar-sd", "ar-so", "ar-ss", "ar-sy", "ar-td", "ar-tn", "ar-ye", "as", "as-in", "asa", "asa-tz", "ast", "ast-es", "az", "az-az", "bas", "bas-cm", "be", "be-by", "bem", "bem-zm", "bez", "bez-tz", "bg", "bg-bg", "bm", "bm-ml", "bn", "bn-bd", "bn-in", "bo", "bo-cn", "bo-in", "br", "br-fr", "brx", "brx-in", "bs", "bs-ba", "ca", "ca-ad", "ca-es", "ca-fr", "ca-it", "ccp", "ccp-bd", "ccp-in", "ce", "ce-ru", "ceb", "ceb-ph", "cgg", "cgg-ug", "chr", "chr-us", "ckb", "ckb-iq", "ckb-ir", "cs", "cs-cz", "cu", "cu-ru", "cy", "cy-gb", "da", "da-dk", "da-gl", "dav", "dav-ke", "de", "de-at", "de-be", "de-ch", "de-de", "de-gr", "de-it", "de-li", "de-lu", "dje", "dje-ne", "doi", "doi-in", "dsb", "dsb-de", "dua", "dua-cm", "dyo", "dyo-sn", "dz", "dz-bt", "ebu", "ebu-ke", "ee", "ee-gh", "ee-tg", "el", "el-cy", "el-gr", "en", "en-001", "en-150", "en-ae", "en-ag", "en-ai", "en-as", "en-at", "en-au", "en-bb", "en-be", "en-bi", "en-bm", "en-bs", "en-bw", "en-bz", "en-ca", "en-cc", "en-ch", "en-ck", "en-cm", "en-cn", "en-cx", "en-cy", "en-de", "en-dg", "en-dk", "en-dm", "en-er", "en-fi", "en-fj", "en-fk", "en-fm", "en-gb", "en-gd", "en-gg", "en-gh", "en-gi", "en-gm", "en-gu", "en-gy", "en-hk", "en-ie", "en-il", "en-im", "en-in", "en-io", "en-je", "en-jm", "en-ke", "en-ki", "en-kn", "en-ky", "en-lc", "en-lr", "en-ls", "en-lu", "en-mg", "en-mh", "en-mo", "en-mp", "en-ms", "en-mt", "en-mu", "en-mw", "en-mx", "en-my", "en-na", "en-nf", "en-ng", "en-nl", "en-nr", "en-nu", "en-nz", "en-pg", "en-ph", "en-pk", "en-pn", "en-pr", "en-pw", "en-rw", "en-sb", "en-sc", "en-sd", "en-se", "en-sg", "en-sh", "en-si", "en-sl", "en-ss", "en-sx", "en-sz", "en-tc", "en-tk", "en-to", "en-tt", "en-tv", "en-tz", "en-ug", "en-um", "en-us", "en-vc", "en-vg", "en-vi", "en-vu", "en-ws", "en-za", "en-zm", "en-zw", "eo", "eo-001", "es", "es-419", "es-ar", "es-bo", "es-br", "es-bz", "es-cl", "es-co", "es-cr", "es-cu", "es-do", "es-ea", "es-ec", "es-es", "es-gq", "es-gt", "es-hn", "es-ic", "es-mx", "es-ni", "es-pa", "es-pe", "es-ph", "es-pr", "es-py", "es-sv", "es-us", "es-uy", "es-ve", "et", "et-ee", "eu", "eu-es", "ewo", "ewo-cm", "fa", "fa-af", "fa-ir", "ff", "ff-bf", "ff-cm", "ff-gh", "ff-gm", "ff-gn", "ff-gw", "ff-lr", "ff-mr", "ff-ne", "ff-ng", "ff-sl", "ff-sn", "fi", "fi-fi", "fil", "fil-ph", "fo", "fo-dk", "fo-fo", "fr", "fr-be", "fr-bf", "fr-bi", "fr-bj", "fr-bl", "fr-ca", "fr-cd", "fr-cf", "fr-cg", "fr-ch", "fr-ci", "fr-cm", "fr-dj", "fr-dz", "fr-fr", "fr-ga", "fr-gf", "fr-gn", "fr-gp", "fr-gq", "fr-ht", "fr-km", "fr-lu", "fr-ma", "fr-mc", "fr-mf", "fr-mg", "fr-ml", "fr-mq", "fr-mr", "fr-mu", "fr-nc", "fr-ne", "fr-pf", "fr-pm", "fr-re", "fr-rw", "fr-sc", "fr-sn", "fr-sy", "fr-td", "fr-tg", "fr-tn", "fr-vu", "fr-wf", "fr-yt", "fur", "fur-it", "fy", "fy-nl", "ga", "ga-gb", "ga-ie", "gd", "gd-gb", "gl", "gl-es", "gsw", "gsw-ch", "gsw-fr", "gsw-li", "gu", "gu-in", "guz", "guz-ke", "gv", "gv-im", "ha", "ha-gh", "ha-ne", "ha-ng", "haw", "haw-us", "he", "hi", "hi-in", "hr", "hr-ba", "hr-hr", "hsb", "hsb-de", "hu", "hu-hu", "hy", "hy-am", "ia", "ia-001", "id", "ig", "ig-ng", "ii", "ii-cn", "id-id", "is", "is-is", "it", "it-ch", "it-it", "it-sm", "it-va", "he-il", "ja", "ja-jp", "jgo", "jgo-cm", "yi", "yi-001", "jmc", "jmc-tz", "jv", "jv-id", "ka", "ka-ge", "kab", "kab-dz", "kam", "kam-ke", "kde", "kde-tz", "kea", "kea-cv", "khq", "khq-ml", "ki", "ki-ke", "kk", "kk-kz", "kkj", "kkj-cm", "kl", "kl-gl", "kln", "kln-ke", "km", "km-kh", "kn", "kn-in", "ko", "ko-kp", "ko-kr", "kok", "kok-in", "ks", "ks-in", "ksb", "ksb-tz", "ksf", "ksf-cm", "ksh", "ksh-de", "kw", "kw-gb", "ku", "ku-tr", "ky", "ky-kg", "lag", "lag-tz", "lb", "lb-lu", "lg", "lg-ug", "lkt", "lkt-us", "ln", "ln-ao", "ln-cd", "ln-cf", "ln-cg", "lo", "lo-la", "lrc", "lrc-iq", "lrc-ir", "lt", "lt-lt", "lu", "lu-cd", "luo", "luo-ke", "luy", "luy-ke", "lv", "lv-lv", "mai", "mai-in", "mas", "mas-ke", "mas-tz", "mer", "mer-ke", "mfe", "mfe-mu", "mg", "mg-mg", "mgh", "mgh-mz", "mgo", "mgo-cm", "mi", "mi-nz", "mk", "mk-mk", "ml", "ml-in", "mn", "mn-mn", "mni", "mni-in", "mr", "mr-in", "ms", "ms-bn", "ms-id", "ms-my", "ms-sg", "mt", "mt-mt", "mua", "mua-cm", "my", "my-mm", "mzn", "mzn-ir", "naq", "naq-na", "nb", "nb-no", "nb-sj", "nd", "nd-zw", "nds", "nds-de", "nds-nl", "ne", "ne-in", "ne-np", "nl", "nl-aw", "nl-be", "nl-ch", "nl-bq", "nl-cw", "nl-lu", "nl-nl", "nl-sr", "nl-sx", "nmg", "nmg-cm", "nn", "nn-no", "nnh", "nnh-cm", "no", "no-no", "nus", "nus-ss", "nyn", "nyn-ug", "om", "om-et", "om-ke", "or", "or-in", "os", "os-ge", "os-ru", "pa", "pa-in", "pa-pk", "pcm", "pcm-ng", "pl", "pl-pl", "prg", "prg-001", "ps", "ps-af", "ps-pk", "pt", "pt-ao", "pt-br", "pt-ch", "pt-cv", "pt-gq", "pt-gw", "pt-lu", "pt-mo", "pt-mz", "pt-pt", "pt-st", "pt-tl", "qu", "qu-bo", "qu-ec", "qu-pe", "rm", "rm-ch", "rn", "rn-bi", "ro", "ro-md", "ro-ro", "rof", "rof-tz", "ru", "ru-by", "ru-kg", "ru-kz", "ru-md", "ru-ru", "ru-ua", "rw", "rw-rw", "rwk", "rwk-tz", "sa", "sa-in", "sah", "sah-ru", "saq", "saq-ke", "sat", "sat-in", "sbp", "sbp-tz", "sd", "sd-in", "sd-pk", "se", "se-fi", "se-no", "se-se", "seh", "seh-mz", "ses", "ses-ml", "sg", "sg-cf", "shi", "shi-ma", "si", "si-lk", "sk", "sk-sk", "sl", "sl-si", "smn", "smn-fi", "sn", "sn-zw", "so", "so-dj", "so-et", "so-ke", "so-so", "sq", "sq-al", "sq-mk", "sq-xk", "sr", "sr-ba", "sr-cs", "sr-me", "sr-rs", "sr-xk", "su", "su-id", "sv", "sv-ax", "sv-fi", "sv-se", "sw", "sw-cd", "sw-ke", "sw-tz", "sw-ug", "sy", "ta", "ta-in", "ta-lk", "ta-my", "ta-sg", "te", "te-in", "teo", "teo-ke", "teo-ug", "tg", "tg-tj", "th", "th-th", "ti", "ti-er", "ti-et", "tk", "tk-tm", "tl", "to", "to-to", "tr", "tr-cy", "tr-tr", "tt", "tt-ru", "twq", "twq-ne", "tzm", "tzm-ma", "ug", "ug-cn", "uk", "uk-ua", "ur", "ur-in", "ur-pk", "uz", "uz-af", "uz-uz", "vai", "vai-lr", "vi", "vi-vn", "vo", "vo-001", "vun", "vun-tz", "wae", "wae-ch", "wo", "wo-sn", "xh", "xh-za", "xog", "xog-ug", "yav", "yav-cm", "yo", "yo-bj", "yo-ng", "yue", "yue-cn", "yue-hk", "zgh", "zgh-ma", "zh", "zh-cn", "zh-hk", "zh-mo", "zh-sg", "zh-tw", "zh-hans", "zh-hant", "zu", "zu-za"]) return false unless language_validator.valid?(@language) return false if @id.nil? return false if @translated_from_id.nil? return false if @updated.nil? true end # Custom attribute writer method checking allowed values (enum). # @param [Object] language Object to be assigned def language=(language) validator = EnumAttributeValidator.new('String', ["af", "af-na", "af-za", "agq", "agq-cm", "ak", "ak-gh", "am", "am-et", "ar", "ar-001", "ar-ae", "ar-bh", "ar-dj", "ar-dz", "ar-eg", "ar-eh", "ar-er", "ar-il", "ar-iq", "ar-jo", "ar-km", "ar-kw", "ar-lb", "ar-ly", "ar-ma", "ar-mr", "ar-om", "ar-ps", "ar-qa", "ar-sa", "ar-sd", "ar-so", "ar-ss", "ar-sy", "ar-td", "ar-tn", "ar-ye", "as", "as-in", "asa", "asa-tz", "ast", "ast-es", "az", "az-az", "bas", "bas-cm", "be", "be-by", "bem", "bem-zm", "bez", "bez-tz", "bg", "bg-bg", "bm", "bm-ml", "bn", "bn-bd", "bn-in", "bo", "bo-cn", "bo-in", "br", "br-fr", "brx", "brx-in", "bs", "bs-ba", "ca", "ca-ad", "ca-es", "ca-fr", "ca-it", "ccp", "ccp-bd", "ccp-in", "ce", "ce-ru", "ceb", "ceb-ph", "cgg", "cgg-ug", "chr", "chr-us", "ckb", "ckb-iq", "ckb-ir", "cs", "cs-cz", "cu", "cu-ru", "cy", "cy-gb", "da", "da-dk", "da-gl", "dav", "dav-ke", "de", "de-at", "de-be", "de-ch", "de-de", "de-gr", "de-it", "de-li", "de-lu", "dje", "dje-ne", "doi", "doi-in", "dsb", "dsb-de", "dua", "dua-cm", "dyo", "dyo-sn", "dz", "dz-bt", "ebu", "ebu-ke", "ee", "ee-gh", "ee-tg", "el", "el-cy", "el-gr", "en", "en-001", "en-150", "en-ae", "en-ag", "en-ai", "en-as", "en-at", "en-au", "en-bb", "en-be", "en-bi", "en-bm", "en-bs", "en-bw", "en-bz", "en-ca", "en-cc", "en-ch", "en-ck", "en-cm", "en-cn", "en-cx", "en-cy", "en-de", "en-dg", "en-dk", "en-dm", "en-er", "en-fi", "en-fj", "en-fk", "en-fm", "en-gb", "en-gd", "en-gg", "en-gh", "en-gi", "en-gm", "en-gu", "en-gy", "en-hk", "en-ie", "en-il", "en-im", "en-in", "en-io", "en-je", "en-jm", "en-ke", "en-ki", "en-kn", "en-ky", "en-lc", "en-lr", "en-ls", "en-lu", "en-mg", "en-mh", "en-mo", "en-mp", "en-ms", "en-mt", "en-mu", "en-mw", "en-mx", "en-my", "en-na", "en-nf", "en-ng", "en-nl", "en-nr", "en-nu", "en-nz", "en-pg", "en-ph", "en-pk", "en-pn", "en-pr", "en-pw", "en-rw", "en-sb", "en-sc", "en-sd", "en-se", "en-sg", "en-sh", "en-si", "en-sl", "en-ss", "en-sx", "en-sz", "en-tc", "en-tk", "en-to", "en-tt", "en-tv", "en-tz", "en-ug", "en-um", "en-us", "en-vc", "en-vg", "en-vi", "en-vu", "en-ws", "en-za", "en-zm", "en-zw", "eo", "eo-001", "es", "es-419", "es-ar", "es-bo", "es-br", "es-bz", "es-cl", "es-co", "es-cr", "es-cu", "es-do", "es-ea", "es-ec", "es-es", "es-gq", "es-gt", "es-hn", "es-ic", "es-mx", "es-ni", "es-pa", "es-pe", "es-ph", "es-pr", "es-py", "es-sv", "es-us", "es-uy", "es-ve", "et", "et-ee", "eu", "eu-es", "ewo", "ewo-cm", "fa", "fa-af", "fa-ir", "ff", "ff-bf", "ff-cm", "ff-gh", "ff-gm", "ff-gn", "ff-gw", "ff-lr", "ff-mr", "ff-ne", "ff-ng", "ff-sl", "ff-sn", "fi", "fi-fi", "fil", "fil-ph", "fo", "fo-dk", "fo-fo", "fr", "fr-be", "fr-bf", "fr-bi", "fr-bj", "fr-bl", "fr-ca", "fr-cd", "fr-cf", "fr-cg", "fr-ch", "fr-ci", "fr-cm", "fr-dj", "fr-dz", "fr-fr", "fr-ga", "fr-gf", "fr-gn", "fr-gp", "fr-gq", "fr-ht", "fr-km", "fr-lu", "fr-ma", "fr-mc", "fr-mf", "fr-mg", "fr-ml", "fr-mq", "fr-mr", "fr-mu", "fr-nc", "fr-ne", "fr-pf", "fr-pm", "fr-re", "fr-rw", "fr-sc", "fr-sn", "fr-sy", "fr-td", "fr-tg", "fr-tn", "fr-vu", "fr-wf", "fr-yt", "fur", "fur-it", "fy", "fy-nl", "ga", "ga-gb", "ga-ie", "gd", "gd-gb", "gl", "gl-es", "gsw", "gsw-ch", "gsw-fr", "gsw-li", "gu", "gu-in", "guz", "guz-ke", "gv", "gv-im", "ha", "ha-gh", "ha-ne", "ha-ng", "haw", "haw-us", "he", "hi", "hi-in", "hr", "hr-ba", "hr-hr", "hsb", "hsb-de", "hu", "hu-hu", "hy", "hy-am", "ia", "ia-001", "id", "ig", "ig-ng", "ii", "ii-cn", "id-id", "is", "is-is", "it", "it-ch", "it-it", "it-sm", "it-va", "he-il", "ja", "ja-jp", "jgo", "jgo-cm", "yi", "yi-001", "jmc", "jmc-tz", "jv", "jv-id", "ka", "ka-ge", "kab", "kab-dz", "kam", "kam-ke", "kde", "kde-tz", "kea", "kea-cv", "khq", "khq-ml", "ki", "ki-ke", "kk", "kk-kz", "kkj", "kkj-cm", "kl", "kl-gl", "kln", "kln-ke", "km", "km-kh", "kn", "kn-in", "ko", "ko-kp", "ko-kr", "kok", "kok-in", "ks", "ks-in", "ksb", "ksb-tz", "ksf", "ksf-cm", "ksh", "ksh-de", "kw", "kw-gb", "ku", "ku-tr", "ky", "ky-kg", "lag", "lag-tz", "lb", "lb-lu", "lg", "lg-ug", "lkt", "lkt-us", "ln", "ln-ao", "ln-cd", "ln-cf", "ln-cg", "lo", "lo-la", "lrc", "lrc-iq", "lrc-ir", "lt", "lt-lt", "lu", "lu-cd", "luo", "luo-ke", "luy", "luy-ke", "lv", "lv-lv", "mai", "mai-in", "mas", "mas-ke", "mas-tz", "mer", "mer-ke", "mfe", "mfe-mu", "mg", "mg-mg", "mgh", "mgh-mz", "mgo", "mgo-cm", "mi", "mi-nz", "mk", "mk-mk", "ml", "ml-in", "mn", "mn-mn", "mni", "mni-in", "mr", "mr-in", "ms", "ms-bn", "ms-id", "ms-my", "ms-sg", "mt", "mt-mt", "mua", "mua-cm", "my", "my-mm", "mzn", "mzn-ir", "naq", "naq-na", "nb", "nb-no", "nb-sj", "nd", "nd-zw", "nds", "nds-de", "nds-nl", "ne", "ne-in", "ne-np", "nl", "nl-aw", "nl-be", "nl-ch", "nl-bq", "nl-cw", "nl-lu", "nl-nl", "nl-sr", "nl-sx", "nmg", "nmg-cm", "nn", "nn-no", "nnh", "nnh-cm", "no", "no-no", "nus", "nus-ss", "nyn", "nyn-ug", "om", "om-et", "om-ke", "or", "or-in", "os", "os-ge", "os-ru", "pa", "pa-in", "pa-pk", "pcm", "pcm-ng", "pl", "pl-pl", "prg", "prg-001", "ps", "ps-af", "ps-pk", "pt", "pt-ao", "pt-br", "pt-ch", "pt-cv", "pt-gq", "pt-gw", "pt-lu", "pt-mo", "pt-mz", "pt-pt", "pt-st", "pt-tl", "qu", "qu-bo", "qu-ec", "qu-pe", "rm", "rm-ch", "rn", "rn-bi", "ro", "ro-md", "ro-ro", "rof", "rof-tz", "ru", "ru-by", "ru-kg", "ru-kz", "ru-md", "ru-ru", "ru-ua", "rw", "rw-rw", "rwk", "rwk-tz", "sa", "sa-in", "sah", "sah-ru", "saq", "saq-ke", "sat", "sat-in", "sbp", "sbp-tz", "sd", "sd-in", "sd-pk", "se", "se-fi", "se-no", "se-se", "seh", "seh-mz", "ses", "ses-ml", "sg", "sg-cf", "shi", "shi-ma", "si", "si-lk", "sk", "sk-sk", "sl", "sl-si", "smn", "smn-fi", "sn", "sn-zw", "so", "so-dj", "so-et", "so-ke", "so-so", "sq", "sq-al", "sq-mk", "sq-xk", "sr", "sr-ba", "sr-cs", "sr-me", "sr-rs", "sr-xk", "su", "su-id", "sv", "sv-ax", "sv-fi", "sv-se", "sw", "sw-cd", "sw-ke", "sw-tz", "sw-ug", "sy", "ta", "ta-in", "ta-lk", "ta-my", "ta-sg", "te", "te-in", "teo", "teo-ke", "teo-ug", "tg", "tg-tj", "th", "th-th", "ti", "ti-er", "ti-et", "tk", "tk-tm", "tl", "to", "to-to", "tr", "tr-cy", "tr-tr", "tt", "tt-ru", "twq", "twq-ne", "tzm", "tzm-ma", "ug", "ug-cn", "uk", "uk-ua", "ur", "ur-in", "ur-pk", "uz", "uz-af", "uz-uz", "vai", "vai-lr", "vi", "vi-vn", "vo", "vo-001", "vun", "vun-tz", "wae", "wae-ch", "wo", "wo-sn", "xh", "xh-za", "xog", "xog-ug", "yav", "yav-cm", "yo", "yo-bj", "yo-ng", "yue", "yue-cn", "yue-hk", "zgh", "zgh-ma", "zh", "zh-cn", "zh-hk", "zh-mo", "zh-sg", "zh-tw", "zh-hans", "zh-hant", "zu", "zu-za"]) unless validator.valid?(language) fail ArgumentError, "invalid value for \"language\", must be one of #{validator.allowable_values}." end @language = language 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 && deleted_at == o.deleted_at && created == o.created && name == o.name && language == o.language && id == o.id && translated_from_id == o.translated_from_id && updated == o.updated 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 [deleted_at, created, name, language, id, translated_from_id, updated].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/standard_error.rb
lib/hubspot/codegen/cms/blogs/tags/models/standard_error.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Model definition for a standard error. class StandardError # Error subcategory. attr_accessor :sub_category # Error context. attr_accessor :context # Error links. attr_accessor :links # Error ID. attr_accessor :id # Error category. attr_accessor :category # Error message. attr_accessor :message # List of error details. attr_accessor :errors # Error status. attr_accessor :status # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'context' => :'context', :'links' => :'links', :'id' => :'id', :'category' => :'category', :'message' => :'message', :'errors' => :'errors', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'Object', :'context' => :'Hash<String, Array<String>>', :'links' => :'Hash<String, String>', :'id' => :'String', :'category' => :'String', :'message' => :'String', :'errors' => :'Array<ErrorDetail>', :'status' => :'String' } 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::Blogs::Tags::StandardError` 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::Blogs::Tags::StandardError`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @context.nil? invalid_properties.push('invalid value for "context", context cannot be nil.') end if @links.nil? invalid_properties.push('invalid value for "links", links cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category cannot be nil.') end if @message.nil? invalid_properties.push('invalid value for "message", message cannot be nil.') end if @errors.nil? invalid_properties.push('invalid value for "errors", errors cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @context.nil? return false if @links.nil? return false if @category.nil? return false if @message.nil? return false if @errors.nil? return false if @status.nil? true 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 && sub_category == o.sub_category && context == o.context && links == o.links && id == o.id && category == o.category && message == o.message && errors == o.errors && status == o.status 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 [sub_category, context, links, id, category, message, errors, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/batch_response_tag.rb
lib/hubspot/codegen/cms/blogs/tags/models/batch_response_tag.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Response object for batch operations on blog tags. class BatchResponseTag # Time of batch operation completion. attr_accessor :completed_at # Time of batch operation request. attr_accessor :requested_at # Time of batch operation start. attr_accessor :started_at # Links associated with batch operation. attr_accessor :links # Results of batch operation. attr_accessor :results # Status of batch operation. attr_accessor :status 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 { :'completed_at' => :'completedAt', :'requested_at' => :'requestedAt', :'started_at' => :'startedAt', :'links' => :'links', :'results' => :'results', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'completed_at' => :'Time', :'requested_at' => :'Time', :'started_at' => :'Time', :'links' => :'Hash<String, String>', :'results' => :'Array<Tag>', :'status' => :'String' } 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::Blogs::Tags::BatchResponseTag` 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::Blogs::Tags::BatchResponseTag`. 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?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'requested_at') self.requested_at = attributes[:'requested_at'] end if attributes.key?(:'started_at') self.started_at = attributes[:'started_at'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @completed_at.nil? invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.') end if @started_at.nil? invalid_properties.push('invalid value for "started_at", started_at cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @completed_at.nil? return false if @started_at.nil? return false if @results.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) return false unless status_validator.valid?(@status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) unless validator.valid?(status) fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." end @status = status 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 && completed_at == o.completed_at && requested_at == o.requested_at && started_at == o.started_at && links == o.links && results == o.results && status == o.status 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 [completed_at, requested_at, started_at, links, results, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/attach_to_lang_primary_request_v_next.rb
lib/hubspot/codegen/cms/blogs/tags/models/attach_to_lang_primary_request_v_next.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Request body object for attaching objects to multi-language groups. class AttachToLangPrimaryRequestVNext # Designated language of the object to add to a multi-language group. attr_accessor :language # ID of the object to add to a multi-language group. attr_accessor :id # ID of primary language object in multi-language group. attr_accessor :primary_id # Primary language of the multi-language group. attr_accessor :primary_language # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'language' => :'language', :'id' => :'id', :'primary_id' => :'primaryId', :'primary_language' => :'primaryLanguage' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'language' => :'String', :'id' => :'String', :'primary_id' => :'String', :'primary_language' => :'String' } 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::Blogs::Tags::AttachToLangPrimaryRequestVNext` 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::Blogs::Tags::AttachToLangPrimaryRequestVNext`. 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?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'primary_id') self.primary_id = attributes[:'primary_id'] end if attributes.key?(:'primary_language') self.primary_language = attributes[:'primary_language'] 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 @language.nil? invalid_properties.push('invalid value for "language", language cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @primary_id.nil? invalid_properties.push('invalid value for "primary_id", primary_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 @language.nil? return false if @id.nil? return false if @primary_id.nil? true 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 && language == o.language && id == o.id && primary_id == o.primary_id && primary_language == o.primary_language 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 [language, id, primary_id, primary_language].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/next_page.rb
lib/hubspot/codegen/cms/blogs/tags/models/next_page.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Model definition for a next page. class NextPage # attr_accessor :link # attr_accessor :after # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'link' => :'link', :'after' => :'after' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'link' => :'String', :'after' => :'String' } 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::Blogs::Tags::NextPage` 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::Blogs::Tags::NextPage`. 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?(:'link') self.link = attributes[:'link'] end if attributes.key?(:'after') self.after = attributes[:'after'] 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 @after.nil? invalid_properties.push('invalid value for "after", after 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 @after.nil? true 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 && link == o.link && after == o.after 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 [link, after].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/batch_response_tag_with_errors.rb
lib/hubspot/codegen/cms/blogs/tags/models/batch_response_tag_with_errors.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Response object for batch operations on blog tags with errors. class BatchResponseTagWithErrors # Time of batch operation completion. attr_accessor :completed_at # Number of errors. attr_accessor :num_errors # Time of batch operation request. attr_accessor :requested_at # Time of batch operation start. attr_accessor :started_at # Links associated with batch operation. attr_accessor :links # Results of batch operation. attr_accessor :results # Errors in batch operation. attr_accessor :errors # Status of batch operation. attr_accessor :status 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 { :'completed_at' => :'completedAt', :'num_errors' => :'numErrors', :'requested_at' => :'requestedAt', :'started_at' => :'startedAt', :'links' => :'links', :'results' => :'results', :'errors' => :'errors', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'completed_at' => :'Time', :'num_errors' => :'Integer', :'requested_at' => :'Time', :'started_at' => :'Time', :'links' => :'Hash<String, String>', :'results' => :'Array<Tag>', :'errors' => :'Array<StandardError>', :'status' => :'String' } 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::Blogs::Tags::BatchResponseTagWithErrors` 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::Blogs::Tags::BatchResponseTagWithErrors`. 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?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'num_errors') self.num_errors = attributes[:'num_errors'] end if attributes.key?(:'requested_at') self.requested_at = attributes[:'requested_at'] end if attributes.key?(:'started_at') self.started_at = attributes[:'started_at'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @completed_at.nil? invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.') end if @started_at.nil? invalid_properties.push('invalid value for "started_at", started_at cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @completed_at.nil? return false if @started_at.nil? return false if @results.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) return false unless status_validator.valid?(@status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) unless validator.valid?(status) fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." end @status = status 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 && completed_at == o.completed_at && num_errors == o.num_errors && requested_at == o.requested_at && started_at == o.started_at && links == o.links && results == o.results && errors == o.errors && status == o.status 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 [completed_at, num_errors, requested_at, started_at, links, results, errors, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/collection_response_with_total_tag_forward_paging.rb
lib/hubspot/codegen/cms/blogs/tags/models/collection_response_with_total_tag_forward_paging.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Response object for collections of blog tags with pagination information. class CollectionResponseWithTotalTagForwardPaging # Total number of blog tags. attr_accessor :total attr_accessor :paging # Collection of blog tags. attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'total' => :'total', :'paging' => :'paging', :'results' => :'results' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'total' => :'Integer', :'paging' => :'ForwardPaging', :'results' => :'Array<Tag>' } 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::Blogs::Tags::CollectionResponseWithTotalTagForwardPaging` 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::Blogs::Tags::CollectionResponseWithTotalTagForwardPaging`. 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?(:'total') self.total = attributes[:'total'] end if attributes.key?(:'paging') self.paging = attributes[:'paging'] end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end 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 @total.nil? invalid_properties.push('invalid value for "total", total cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results 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 @total.nil? return false if @results.nil? true 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 && total == o.total && paging == o.paging && results == o.results 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 [total, paging, results].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/detach_from_lang_group_request_v_next.rb
lib/hubspot/codegen/cms/blogs/tags/models/detach_from_lang_group_request_v_next.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Request body object for detaching objects from multi-language groups. class DetachFromLangGroupRequestVNext # ID of the object to remove from a multi-language group. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'id' => :'String' } 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::Blogs::Tags::DetachFromLangGroupRequestVNext` 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::Blogs::Tags::DetachFromLangGroupRequestVNext`. 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?(:'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 @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 @id.nil? true 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 && 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 [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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/batch_input_json_node.rb
lib/hubspot/codegen/cms/blogs/tags/models/batch_input_json_node.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Wrapper for providing an array of JSON nodes as inputs. class BatchInputJsonNode # JSON nodes to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<Object>' } 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::Blogs::Tags::BatchInputJsonNode` 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::Blogs::Tags::BatchInputJsonNode`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/error_detail.rb
lib/hubspot/codegen/cms/blogs/tags/models/error_detail.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags class ErrorDetail # A specific category that contains more specific detail about the error attr_accessor :sub_category # The status code associated with the error detail attr_accessor :code # The name of the field or parameter in which the error was found. attr_accessor :_in # Context about the error condition attr_accessor :context # A human readable message describing the error along with remediation steps where appropriate attr_accessor :message # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'code' => :'code', :'_in' => :'in', :'context' => :'context', :'message' => :'message' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'String', :'code' => :'String', :'_in' => :'String', :'context' => :'Hash<String, Array<String>>', :'message' => :'String' } 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::Blogs::Tags::ErrorDetail` 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::Blogs::Tags::ErrorDetail`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'code') self.code = attributes[:'code'] end if attributes.key?(:'_in') self._in = attributes[:'_in'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'message') self.message = attributes[:'message'] 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 @message.nil? invalid_properties.push('invalid value for "message", message 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 @message.nil? true 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 && sub_category == o.sub_category && code == o.code && _in == o._in && context == o.context && message == o.message 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 [sub_category, code, _in, context, message].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/set_new_language_primary_request_v_next.rb
lib/hubspot/codegen/cms/blogs/tags/models/set_new_language_primary_request_v_next.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Request body object for setting a new primary language. class SetNewLanguagePrimaryRequestVNext # ID of object to set as primary in multi-language group. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'id' => :'String' } 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::Blogs::Tags::SetNewLanguagePrimaryRequestVNext` 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::Blogs::Tags::SetNewLanguagePrimaryRequestVNext`. 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?(:'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 @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 @id.nil? true 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 && 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 [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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/forward_paging.rb
lib/hubspot/codegen/cms/blogs/tags/models/forward_paging.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Model definition for forward paging. class ForwardPaging attr_accessor :_next # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'_next' => :'next' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'_next' => :'NextPage' } 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::Blogs::Tags::ForwardPaging` 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::Blogs::Tags::ForwardPaging`. 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?(:'_next') self._next = attributes[:'_next'] 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 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? true 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 && _next == o._next 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 [_next].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/tag_clone_request_v_next.rb
lib/hubspot/codegen/cms/blogs/tags/models/tag_clone_request_v_next.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Request body object for cloning blog tags. class TagCloneRequestVNext # Name of newly cloned blog tag. attr_accessor :name # Target language of new variant. attr_accessor :language # ID of the object to be cloned. attr_accessor :id # Language of primary blog tag to clone. attr_accessor :primary_language # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'name' => :'name', :'language' => :'language', :'id' => :'id', :'primary_language' => :'primaryLanguage' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'name' => :'String', :'language' => :'String', :'id' => :'String', :'primary_language' => :'String' } 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::Blogs::Tags::TagCloneRequestVNext` 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::Blogs::Tags::TagCloneRequestVNext`. 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?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'primary_language') self.primary_language = attributes[:'primary_language'] 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 @name.nil? invalid_properties.push('invalid value for "name", name 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 @name.nil? return false if @id.nil? true 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 && name == o.name && language == o.language && id == o.id && primary_language == o.primary_language 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 [name, language, id, primary_language].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/update_languages_request_v_next.rb
lib/hubspot/codegen/cms/blogs/tags/models/update_languages_request_v_next.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Request object for updating languages within a multi-language group. class UpdateLanguagesRequestVNext # Map of object IDs to associated languages of object in the multi-language group. attr_accessor :languages # ID of the primary object in the multi-language group. attr_accessor :primary_id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'languages' => :'languages', :'primary_id' => :'primaryId' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'languages' => :'Hash<String, String>', :'primary_id' => :'String' } 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::Blogs::Tags::UpdateLanguagesRequestVNext` 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::Blogs::Tags::UpdateLanguagesRequestVNext`. 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?(:'languages') if (value = attributes[:'languages']).is_a?(Hash) self.languages = value end end if attributes.key?(:'primary_id') self.primary_id = attributes[:'primary_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 @languages.nil? invalid_properties.push('invalid value for "languages", languages cannot be nil.') end if @primary_id.nil? invalid_properties.push('invalid value for "primary_id", primary_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 @languages.nil? return false if @primary_id.nil? true 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 && languages == o.languages && primary_id == o.primary_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 [languages, primary_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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/error.rb
lib/hubspot/codegen/cms/blogs/tags/models/error.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags class Error # A specific category that contains more specific detail about the error attr_accessor :sub_category # Context about the error condition attr_accessor :context # A unique identifier for the request. Include this value with any error reports or support tickets attr_accessor :correlation_id # A map of link names to associated URIs containing documentation about the error or recommended remediation steps attr_accessor :links # A human readable message describing the error along with remediation steps where appropriate attr_accessor :message # The error category attr_accessor :category # further information about the error attr_accessor :errors # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'context' => :'context', :'correlation_id' => :'correlationId', :'links' => :'links', :'message' => :'message', :'category' => :'category', :'errors' => :'errors' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'String', :'context' => :'Hash<String, Array<String>>', :'correlation_id' => :'String', :'links' => :'Hash<String, String>', :'message' => :'String', :'category' => :'String', :'errors' => :'Array<ErrorDetail>' } 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::Blogs::Tags::Error` 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::Blogs::Tags::Error`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'correlation_id') self.correlation_id = attributes[:'correlation_id'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end 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 @correlation_id.nil? invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.') end if @message.nil? invalid_properties.push('invalid value for "message", message cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category 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 @correlation_id.nil? return false if @message.nil? return false if @category.nil? true 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 && sub_category == o.sub_category && context == o.context && correlation_id == o.correlation_id && links == o.links && message == o.message && category == o.category && errors == o.errors 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 [sub_category, context, correlation_id, links, message, category, errors].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/models/batch_input_tag.rb
lib/hubspot/codegen/cms/blogs/tags/models/batch_input_tag.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Blogs module Tags # Wrapper for providing an array of blog tags as inputs. class BatchInputTag # Blog tags to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<Tag>' } 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::Blogs::Tags::BatchInputTag` 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::Blogs::Tags::BatchInputTag`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Blogs::Tags.const_get(type) 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 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 end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/blogs/tags/api/blog_tags_api.rb
lib/hubspot/codegen/cms/blogs/tags/api/blog_tags_api.rb
=begin #Tags #Use these endpoints for interacting with Blog Posts, Blog Authors, and Blog Tags The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Cms module Blogs module Tags class BlogTagsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete a Blog Tag # Delete the Blog Tag object identified by the id in the path. # @param object_id [String] The Blog Tag id. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Whether to return only results that have been archived. # @return [nil] def archive(object_id, opts = {}) archive_with_http_info(object_id, opts) nil end # Delete a Blog Tag # Delete the Blog Tag object identified by the id in the path. # @param object_id [String] The Blog Tag id. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Whether to return only results that have been archived. # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.archive ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BlogTagsApi.archive" end # resource path local_var_path = '/cms/v3/blogs/tags/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.archive", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a batch of Blog Tags # Delete the Blog Tag objects identified in the request body. # @param batch_input_string [BatchInputString] The JSON array of Blog Tag ids. # @param [Hash] opts the optional parameters # @return [nil] def archive_batch(batch_input_string, opts = {}) archive_batch_with_http_info(batch_input_string, opts) nil end # Delete a batch of Blog Tags # Delete the Blog Tag objects identified in the request body. # @param batch_input_string [BatchInputString] The JSON array of Blog Tag ids. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_batch_with_http_info(batch_input_string, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.archive_batch ...' end # verify the required parameter 'batch_input_string' is set if @api_client.config.client_side_validation && batch_input_string.nil? fail ArgumentError, "Missing the required parameter 'batch_input_string' when calling BlogTagsApi.archive_batch" end # resource path local_var_path = '/cms/v3/blogs/tags/batch/archive' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_string) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.archive_batch", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#archive_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Attach a Blog Tag to a multi-language group # Attach a Blog Tag to a multi-language group. # @param attach_to_lang_primary_request_v_next [AttachToLangPrimaryRequestVNext] The JSON representation of the AttachToLangPrimaryRequest object. # @param [Hash] opts the optional parameters # @return [nil] def attach_to_lang_group(attach_to_lang_primary_request_v_next, opts = {}) attach_to_lang_group_with_http_info(attach_to_lang_primary_request_v_next, opts) nil end # Attach a Blog Tag to a multi-language group # Attach a Blog Tag to a multi-language group. # @param attach_to_lang_primary_request_v_next [AttachToLangPrimaryRequestVNext] The JSON representation of the AttachToLangPrimaryRequest object. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def attach_to_lang_group_with_http_info(attach_to_lang_primary_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.attach_to_lang_group ...' end # verify the required parameter 'attach_to_lang_primary_request_v_next' is set if @api_client.config.client_side_validation && attach_to_lang_primary_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'attach_to_lang_primary_request_v_next' when calling BlogTagsApi.attach_to_lang_group" end # resource path local_var_path = '/cms/v3/blogs/tags/multi-language/attach-to-lang-group' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(attach_to_lang_primary_request_v_next) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.attach_to_lang_group", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#attach_to_lang_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new Blog Tag # Create a new Blog Tag. # @param tag [Tag] The JSON representation of a new Blog Tag. # @param [Hash] opts the optional parameters # @return [Tag] def create(tag, opts = {}) data, _status_code, _headers = create_with_http_info(tag, opts) data end # Create a new Blog Tag # Create a new Blog Tag. # @param tag [Tag] The JSON representation of a new Blog Tag. # @param [Hash] opts the optional parameters # @return [Array<(Tag, Integer, Hash)>] Tag data, response status code and response headers def create_with_http_info(tag, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.create ...' end # verify the required parameter 'tag' is set if @api_client.config.client_side_validation && tag.nil? fail ArgumentError, "Missing the required parameter 'tag' when calling BlogTagsApi.create" end # resource path local_var_path = '/cms/v3/blogs/tags' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(tag) # return_type return_type = opts[:debug_return_type] || 'Tag' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.create", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a batch of Blog Tags # Create the Blog Tag objects detailed in the request body. # @param batch_input_tag [BatchInputTag] The JSON array of new Blog Tags to create. # @param [Hash] opts the optional parameters # @return [BatchResponseTag] def create_batch(batch_input_tag, opts = {}) data, _status_code, _headers = create_batch_with_http_info(batch_input_tag, opts) data end # Create a batch of Blog Tags # Create the Blog Tag objects detailed in the request body. # @param batch_input_tag [BatchInputTag] The JSON array of new Blog Tags to create. # @param [Hash] opts the optional parameters # @return [Array<(BatchResponseTag, Integer, Hash)>] BatchResponseTag data, response status code and response headers def create_batch_with_http_info(batch_input_tag, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.create_batch ...' end # verify the required parameter 'batch_input_tag' is set if @api_client.config.client_side_validation && batch_input_tag.nil? fail ArgumentError, "Missing the required parameter 'batch_input_tag' when calling BlogTagsApi.create_batch" end # resource path local_var_path = '/cms/v3/blogs/tags/batch/create' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_tag) # return_type return_type = opts[:debug_return_type] || 'BatchResponseTag' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.create_batch", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#create_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new language variation # Create a new language variation from an existing Blog Tag # @param tag_clone_request_v_next [TagCloneRequestVNext] The JSON representation of the ContentLanguageCloneRequest object. # @param [Hash] opts the optional parameters # @return [Tag] def create_lang_variation(tag_clone_request_v_next, opts = {}) data, _status_code, _headers = create_lang_variation_with_http_info(tag_clone_request_v_next, opts) data end # Create a new language variation # Create a new language variation from an existing Blog Tag # @param tag_clone_request_v_next [TagCloneRequestVNext] The JSON representation of the ContentLanguageCloneRequest object. # @param [Hash] opts the optional parameters # @return [Array<(Tag, Integer, Hash)>] Tag data, response status code and response headers def create_lang_variation_with_http_info(tag_clone_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.create_lang_variation ...' end # verify the required parameter 'tag_clone_request_v_next' is set if @api_client.config.client_side_validation && tag_clone_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'tag_clone_request_v_next' when calling BlogTagsApi.create_lang_variation" end # resource path local_var_path = '/cms/v3/blogs/tags/multi-language/create-language-variation' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(tag_clone_request_v_next) # return_type return_type = opts[:debug_return_type] || 'Tag' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.create_lang_variation", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#create_lang_variation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Detach a Blog Tag from a multi-language group # Detach a Blog Tag from a multi-language group. # @param detach_from_lang_group_request_v_next [DetachFromLangGroupRequestVNext] The JSON representation of the DetachFromLangGroupRequest object. # @param [Hash] opts the optional parameters # @return [nil] def detach_from_lang_group(detach_from_lang_group_request_v_next, opts = {}) detach_from_lang_group_with_http_info(detach_from_lang_group_request_v_next, opts) nil end # Detach a Blog Tag from a multi-language group # Detach a Blog Tag from a multi-language group. # @param detach_from_lang_group_request_v_next [DetachFromLangGroupRequestVNext] The JSON representation of the DetachFromLangGroupRequest object. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def detach_from_lang_group_with_http_info(detach_from_lang_group_request_v_next, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.detach_from_lang_group ...' end # verify the required parameter 'detach_from_lang_group_request_v_next' is set if @api_client.config.client_side_validation && detach_from_lang_group_request_v_next.nil? fail ArgumentError, "Missing the required parameter 'detach_from_lang_group_request_v_next' when calling BlogTagsApi.detach_from_lang_group" end # resource path local_var_path = '/cms/v3/blogs/tags/multi-language/detach-from-lang-group' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(detach_from_lang_group_request_v_next) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.detach_from_lang_group", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#detach_from_lang_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a Blog Tag # Retrieve the Blog Tag object identified by the id in the path. # @param object_id [String] The Blog Tag id. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted Blog Tags. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [Tag] def get_by_id(object_id, opts = {}) data, _status_code, _headers = get_by_id_with_http_info(object_id, opts) data end # Retrieve a Blog Tag # Retrieve the Blog Tag object identified by the id in the path. # @param object_id [String] The Blog Tag id. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted Blog Tags. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [Array<(Tag, Integer, Hash)>] Tag data, response status code and response headers def get_by_id_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.get_by_id ...' end # verify the required parameter 'object_id' is set if @api_client.config.client_side_validation && object_id.nil? fail ArgumentError, "Missing the required parameter 'object_id' when calling BlogTagsApi.get_by_id" end # resource path local_var_path = '/cms/v3/blogs/tags/{objectId}'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? query_params[:'property'] = opts[:'property'] if !opts[:'property'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Tag' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.get_by_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all Blog Tags # Get the list of blog tags. Supports paging and filtering. This method would be useful for an integration that examined these models and used an external service to suggest edits. # @param [Hash] opts the optional parameters # @option opts [Time] :created_at Only return Blog Tags created at exactly the specified time. # @option opts [Time] :created_after Only return Blog Tags created after the specified time. # @option opts [Time] :created_before Only return Blog Tags created before the specified time. # @option opts [Time] :updated_at Only return Blog Tags last updated at exactly the specified time. # @option opts [Time] :updated_after Only return Blog Tags last updated after the specified time. # @option opts [Time] :updated_before Only return Blog Tags last updated before the specified time. # @option opts [Array<String>] :sort Specifies which fields to use for sorting results. Valid fields are &#x60;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [Integer] :limit The maximum number of results to return. Default is 100. # @option opts [Boolean] :archived Specifies whether to return deleted Blog Tags. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [CollectionResponseWithTotalTagForwardPaging] def get_page(opts = {}) data, _status_code, _headers = get_page_with_http_info(opts) data end # Get all Blog Tags # Get the list of blog tags. Supports paging and filtering. This method would be useful for an integration that examined these models and used an external service to suggest edits. # @param [Hash] opts the optional parameters # @option opts [Time] :created_at Only return Blog Tags created at exactly the specified time. # @option opts [Time] :created_after Only return Blog Tags created after the specified time. # @option opts [Time] :created_before Only return Blog Tags created before the specified time. # @option opts [Time] :updated_at Only return Blog Tags last updated at exactly the specified time. # @option opts [Time] :updated_after Only return Blog Tags last updated after the specified time. # @option opts [Time] :updated_before Only return Blog Tags last updated before the specified time. # @option opts [Array<String>] :sort Specifies which fields to use for sorting results. Valid fields are &#x60;name&#x60;, &#x60;createdAt&#x60;, &#x60;updatedAt&#x60;, &#x60;createdBy&#x60;, &#x60;updatedBy&#x60;. &#x60;createdAt&#x60; will be used by default. # @option opts [String] :after The cursor token value to get the next set of results. You can get this from the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [Integer] :limit The maximum number of results to return. Default is 100. # @option opts [Boolean] :archived Specifies whether to return deleted Blog Tags. Defaults to &#x60;false&#x60;. # @option opts [String] :property # @return [Array<(CollectionResponseWithTotalTagForwardPaging, Integer, Hash)>] CollectionResponseWithTotalTagForwardPaging data, response status code and response headers def get_page_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BlogTagsApi.get_page ...' end # resource path local_var_path = '/cms/v3/blogs/tags' # query parameters query_params = opts[:query_params] || {} query_params[:'createdAt'] = opts[:'created_at'] if !opts[:'created_at'].nil? query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil? query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil? query_params[:'updatedAt'] = opts[:'updated_at'] if !opts[:'updated_at'].nil? query_params[:'updatedAfter'] = opts[:'updated_after'] if !opts[:'updated_after'].nil? query_params[:'updatedBefore'] = opts[:'updated_before'] if !opts[:'updated_before'].nil? query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil? query_params[:'property'] = opts[:'property'] if !opts[:'property'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CollectionResponseWithTotalTagForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BlogTagsApi.get_page", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BlogTagsApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a batch of Blog Tags # Retrieve the Blog Tag objects identified in the request body. # @param batch_input_string [BatchInputString] The JSON array of Blog Tag ids. # @param [Hash] opts the optional parameters # @option opts [Boolean] :archived Specifies whether to return deleted Blog Tags. Defaults to &#x60;false&#x60;.
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
true
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/api_error.rb
lib/hubspot/codegen/cms/pages/api_error.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end module Hubspot module Cms module Pages class ApiError < ::StandardError attr_reader :code, :response_headers, :response_body # Usage examples: # ApiError.new # ApiError.new("message") # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") # ApiError.new(:code => 404, :message => "Not Found") def initialize(arg = nil) if arg.is_a? Hash if arg.key?(:message) || arg.key?('message') super(arg[:message] || arg['message']) else super arg end arg.each do |k, v| instance_variable_set "@#{k}", v end else super arg end end # Override to_s to display a friendly error message def to_s message end def message if @message.nil? msg = "Error message: the server returns an error" else msg = @message end msg += "\nHTTP status code: #{code}" if code msg += "\nResponse headers: #{response_headers}" if response_headers msg += "\nResponse body: #{response_body}" if response_body msg end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/configuration.rb
lib/hubspot/codegen/cms/pages/configuration.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end module Hubspot module Cms module Pages class Configuration # Defines url scheme attr_accessor :scheme # Defines url host attr_accessor :host # Defines url base path attr_accessor :base_path # Define server configuration index attr_accessor :server_index # Define server operation configuration index attr_accessor :server_operation_index # Default server variables attr_accessor :server_variables # Default server operation variables attr_accessor :server_operation_variables # Defines API keys used with API Key authentications. # # @return [Hash] key: parameter name, value: parameter value (API key) # # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) # config.api_key['api_key'] = 'xxx' attr_accessor :api_key # Defines API key prefixes used with API Key authentications. # # @return [Hash] key: parameter name, value: API key prefix # # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) # config.api_key_prefix['api_key'] = 'Token' attr_accessor :api_key_prefix # Defines the username used with HTTP basic authentication. # # @return [String] attr_accessor :username # Defines the password used with HTTP basic authentication. # # @return [String] attr_accessor :password # Defines the access token (Bearer) used with OAuth2. attr_accessor :access_token # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response # details will be logged with `logger.debug` (see the `logger` attribute). # Default to false. # # @return [true, false] attr_accessor :debugging # Defines the logger used for debugging. # Default to `Rails.logger` (when in Rails) or logging to STDOUT. # # @return [#debug] attr_accessor :logger # Defines the temporary folder to store downloaded files # (for API endpoints that have file response). # Default to use `Tempfile`. # # @return [String] attr_accessor :temp_folder_path # The time limit for HTTP request in seconds. # Default to 0 (never times out). attr_accessor :timeout # Set this to false to skip client side validation in the operation. # Default to true. # @return [true, false] attr_accessor :client_side_validation ### TLS/SSL setting # Set this to false to skip verifying SSL certificate when calling API from https server. # Default to true. # # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. # # @return [true, false] attr_accessor :verify_ssl ### TLS/SSL setting # Set this to false to skip verifying SSL host name # Default to true. # # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. # # @return [true, false] attr_accessor :verify_ssl_host ### TLS/SSL setting # Set this to customize the certificate file to verify the peer. # # @return [String] the path to the certificate file # # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 attr_accessor :ssl_ca_cert ### TLS/SSL setting # Client certificate file (for client certificate) attr_accessor :cert_file ### TLS/SSL setting # Client private key file (for client certificate) attr_accessor :key_file # Set this to customize parameters encoding of array parameter with multi collectionFormat. # Default to nil. # # @see The params_encoding option of Ethon. Related source code: # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding attr_accessor :inject_format attr_accessor :force_ending_format attr_accessor :error_handler def initialize @scheme = 'https' @host = 'api.hubapi.com' @base_path = '' @server_index = 0 @server_operation_index = {} @server_variables = {} @server_operation_variables = {} @api_key = {} @api_key_prefix = {} @client_side_validation = true @verify_ssl = true @verify_ssl_host = true @cert_file = nil @key_file = nil @timeout = 0 @params_encoding = nil @debugging = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) # error_handler params: { 'status_code': { max_retries: ..., seconds_delay: ... }, ... } @error_handler = {} yield(self) if block_given? end # The default Configuration object. def self.default @@default ||= Configuration.new end def configure yield(self) if block_given? end def scheme=(scheme) # remove :// from scheme @scheme = scheme.sub(/:\/\//, '') end def host=(host) # remove http(s):// and anything after a slash @host = host.sub(/https?:\/\//, '').split('/').first end def base_path=(base_path) # Add leading and trailing slashes to base_path @base_path = "/#{base_path}".gsub(/\/+/, '/') @base_path = '' if @base_path == '/' end # Returns base URL for specified operation based on server settings def base_url(operation = nil) index = server_operation_index.fetch(operation, server_index) return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) end # Gets API key (with prefix if set). # @param [String] param_name the parameter name of API key auth def api_key_with_prefix(param_name, param_alias = nil) key = @api_key[param_name] key = @api_key.fetch(param_alias, key) unless param_alias.nil? if @api_key_prefix[param_name] "#{@api_key_prefix[param_name]} #{key}" else key end end # Gets Basic Auth token string def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") end # Returns Auth Settings hash for api client. def auth_settings { 'oauth2' => { type: 'oauth2', in: 'header', key: 'Authorization', value: "Bearer #{access_token}" }, } end # Returns an array of Server setting def server_settings [ { url: "https://api.hubapi.com", description: "No description provided", } ] end def operation_server_settings { } end # Returns URL based on server settings # # @param index array index of the server settings # @param variables hash of variable and the corresponding value def server_url(index, variables = {}, servers = nil) servers = server_settings if servers == nil # check array index out of bound if (index < 0 || index >= servers.size) fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" end server = servers[index] url = server[:url] return url unless server.key? :variables # go through variable and assign a value server[:variables].each do |name, variable| if variables.key?(name) if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) url.gsub! "{" + name.to_s + "}", variables[name] else fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." end else # use default value url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] end end url end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/api_client.rb
lib/hubspot/codegen/cms/pages/api_client.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'json' require 'logger' require 'tempfile' require 'time' require 'typhoeus' module Hubspot module Cms module Pages class ApiClient # The Configuration object holding settings to be used in the API client. attr_accessor :config # Defines the headers to be used in HTTP requests of all API calls by default. # # @return [Hash] attr_accessor :default_headers # Initializes the ApiClient # @option config [Configuration] Configuration for initializing the object, default to Configuration.default def initialize(config = Configuration.default) @config = config @user_agent = "hubspot-api-client-ruby; #{VERSION}" @default_headers = { 'Content-Type' => 'application/json', 'User-Agent' => @user_agent } end def self.default @@default ||= ApiClient.new end # Call an API with given options. # # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: # the data deserialized from response body (could be nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) response = request.run if @config.debugging @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" end if !response.success? && config.error_handler.any? config.error_handler.each do |statuses, opts| statuses = statuses.is_a?(Integer) ? [statuses] : statuses retries = opts[:max_retries] || 5 while retries > 0 && statuses.include?(response.code) sleep opts[:seconds_delay] if opts[:seconds_delay] response = request.run opts[:retry_block].call if opts[:retry_block] retries -= 1 end end end unless response.success? if response.timed_out? fail ApiError.new('Connection timed out') elsif response.code == 0 # Errors from libcurl will be made visible here fail ApiError.new(:code => 0, :message => response.return_message) else fail ApiError.new(:code => response.code, :response_headers => response.headers, :response_body => response.body), response.status_message end end if opts[:return_type] data = deserialize(response, opts[:return_type]) else data = nil end return data, response.code, response.headers end # Builds the HTTP request # # @param [String] http_method HTTP method/verb (e.g. POST) # @param [String] path URL path (e.g. /account/new) # @option opts [Hash] :header_params Header parameters # @option opts [Hash] :query_params Query parameters # @option opts [Hash] :form_params Query parameters # @option opts [Object] :body HTTP body (JSON/XML) # @return [Typhoeus::Request] A Typhoeus Request def build_request(http_method, path, opts = {}) url = build_request_url(path, opts) http_method = http_method.to_sym.downcase header_params = @default_headers.merge(opts[:header_params] || {}) query_params = opts[:query_params] || {} form_params = opts[:form_params] || {} follow_location = opts[:follow_location] || true update_params_for_auth! header_params, query_params, opts[:auth_names] # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 req_opts = { :method => http_method, :headers => header_params, :params => query_params, :params_encoding => @config.params_encoding, :timeout => @config.timeout, :ssl_verifypeer => @config.verify_ssl, :ssl_verifyhost => _verify_ssl_host, :sslcert => @config.cert_file, :sslkey => @config.key_file, :verbose => @config.debugging, :followlocation => follow_location } # set custom cert, if provided req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert if [:post, :patch, :put, :delete].include?(http_method) req_body = build_request_body(header_params, form_params, opts[:body]) req_opts.update :body => req_body if @config.debugging @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" end end request = Typhoeus::Request.new(url, req_opts) download_file(request) if opts[:return_type] == 'File' request end # Builds the HTTP request body # # @param [Hash] header_params Header parameters # @param [Hash] form_params Query parameters # @param [Object] body HTTP body (JSON/XML) # @return [String] HTTP body data in the form of string def build_request_body(header_params, form_params, body) # http form if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || header_params['Content-Type'] == 'multipart/form-data' data = {} form_params.each do |key, value| case value when ::File, ::Array, nil # let typhoeus handle File, Array and nil parameters data[key] = value else data[key] = value.to_s end end elsif body data = body.is_a?(String) ? body : body.to_json else data = nil end data end # Save response body into a file in (the defined) temporary folder, using the filename # from the "Content-Disposition" header if provided, otherwise a random filename. # The response body is written to the file in chunks in order to handle files which # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby # process can use. # # @see Configuration#temp_folder_path def download_file(request) tempfile = nil encoding = nil request.on_headers do |response| content_disposition = response.headers['Content-Disposition'] if content_disposition && content_disposition =~ /filename=/i filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] prefix = sanitize_filename(filename) else prefix = 'download-' end prefix = prefix + '-' unless prefix.end_with?('-') encoding = response.body.encoding tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) @tempfile = tempfile end request.on_body do |chunk| chunk.force_encoding(encoding) tempfile.write(chunk) end request.on_complete do |response| if tempfile tempfile.close @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ "will be deleted automatically with GC. It's also recommended to delete the temp file "\ "explicitly with `tempfile.delete`" end end end # Check if the given MIME is a JSON MIME. # JSON MIME examples: # application/json # application/json; charset=UTF8 # APPLICATION/JSON # */* # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. # # @param [Response] response HTTP response # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>" def deserialize(response, return_type) body = response.body # handle file downloading - return the File instance processed in request callbacks # note that response body is empty when the file is written in chunks in request on_body callback return @tempfile if return_type == 'File' return nil if body.nil? || body.empty? # return response body directly for String return type return body if return_type == 'String' # ensuring a default content type content_type = response.headers['Content-Type'] || 'application/json' fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) begin data = JSON.parse("[#{body}]", :symbolize_names => true)[0] rescue JSON::ParserError => e if %w(String Date Time).include?(return_type) data = body else raise e end end convert_to_type data, return_type end # Convert data to the given return type. # @param [Object] data Data to be converted # @param [String] return_type Return type # @return [Mixed] Data in a particular type def convert_to_type(data, return_type) return nil if data.nil? case return_type when 'String' data.to_s when 'Integer' data.to_i when 'Float' data.to_f when 'Boolean' data == true when 'Time' # parse date time (expecting ISO 8601 format) Time.parse data when 'Date' # parse date time (expecting ISO 8601 format) Date.parse data when 'Object' # generic object (usually a Hash), return directly data when /\AArray<(.+)>\z/ # e.g. Array<Pet> sub_type = $1 data.map { |item| convert_to_type(item, sub_type) } when /\AHash\<String, (.+)\>\z/ # e.g. Hash<String, Integer> sub_type = $1 {}.tap do |hash| data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(return_type) klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) end end # Sanitize filename by removing path. # e.g. ../../sun.gif becomes sun.gif # # @param [String] filename the filename to be sanitized # @return [String] the sanitized filename def sanitize_filename(filename) filename.gsub(/.*[\/\\]/, '') end def build_request_url(path, opts = {}) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') @config.base_url(opts[:operation]) + path end # Update header and query params based on authentication settings. # # @param [Hash] header_params Header parameters # @param [Hash] query_params Query parameters # @param [String] auth_names Authentication scheme name def update_params_for_auth!(header_params, query_params, auth_names) Array(auth_names).each do |auth_name| auth_setting = @config.auth_settings[auth_name] next unless auth_setting case auth_setting[:in] when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] else fail ArgumentError, 'Authentication token must be in `query` or `header`' end end end # Sets user agent in HTTP header # # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) def user_agent=(user_agent) @user_agent = user_agent @default_headers['User-Agent'] = @user_agent end # Return Accept header based on an array of accepts provided. # @param [Array] accepts array for Accept # @return [String] the Accept header (e.g. application/json) def select_header_accept(accepts) return nil if accepts.nil? || accepts.empty? # use JSON when present, otherwise use all of the provided json_accept = accepts.find { |s| json_mime?(s) } json_accept || accepts.join(',') end # Return Content-Type header based on an array of content types provided. # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) # return nil by default return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first end # Convert object (array, hash, object, etc) to JSON string. # @param [Object] model object to be converted into JSON string # @return [String] JSON string representation of the object def object_to_http_body(model) return model if model.nil? || model.is_a?(String) local_body = nil if model.is_a?(Array) local_body = model.map { |m| object_to_hash(m) } else local_body = object_to_hash(model) end local_body.to_json end # Convert object(non-array) to hash. # @param [Object] obj object to be converted into JSON string # @return [String] JSON string representation of the object def object_to_hash(obj) if obj.respond_to?(:to_hash) obj.to_hash else obj end end # Build parameter value according to the given collection format. # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi def build_collection_param(param, collection_format) case collection_format when :csv param.join(',') when :ssv param.join(' ') when :tsv param.join("\t") when :pipes param.join('|') when :multi # return the array directly as typhoeus will handle it as expected param else fail "unknown collection format: #{collection_format.inspect}" end end end end end end
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/batch_input_string.rb
lib/hubspot/codegen/cms/pages/models/batch_input_string.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class BatchInputString # Strings to input. attr_accessor :inputs # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'inputs' => :'inputs' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'inputs' => :'Array<String>' } 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::Pages::BatchInputString` 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::Pages::BatchInputString`. 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?(:'inputs') if (value = attributes[:'inputs']).is_a?(Array) self.inputs = value end 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 @inputs.nil? invalid_properties.push('invalid value for "inputs", inputs 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 @inputs.nil? true 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 && inputs == o.inputs 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 [inputs].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/gradient.rb
lib/hubspot/codegen/cms/pages/models/gradient.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class Gradient attr_accessor :angle attr_accessor :side_or_corner # attr_accessor :colors # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'angle' => :'angle', :'side_or_corner' => :'sideOrCorner', :'colors' => :'colors' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'angle' => :'Angle', :'side_or_corner' => :'SideOrCorner', :'colors' => :'Array<ColorStop>' } 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::Pages::Gradient` 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::Pages::Gradient`. 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?(:'angle') self.angle = attributes[:'angle'] end if attributes.key?(:'side_or_corner') self.side_or_corner = attributes[:'side_or_corner'] end if attributes.key?(:'colors') if (value = attributes[:'colors']).is_a?(Array) self.colors = value end 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 @angle.nil? invalid_properties.push('invalid value for "angle", angle cannot be nil.') end if @side_or_corner.nil? invalid_properties.push('invalid value for "side_or_corner", side_or_corner cannot be nil.') end if @colors.nil? invalid_properties.push('invalid value for "colors", colors 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 @angle.nil? return false if @side_or_corner.nil? return false if @colors.nil? true 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 && angle == o.angle && side_or_corner == o.side_or_corner && colors == o.colors 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 [angle, side_or_corner, colors].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/styles.rb
lib/hubspot/codegen/cms/pages/models/styles.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class Styles attr_accessor :background_color # attr_accessor :flexbox_positioning attr_accessor :background_image # attr_accessor :force_full_width_section # attr_accessor :vertical_alignment # attr_accessor :max_width_section_centering attr_accessor :background_gradient # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'background_color' => :'backgroundColor', :'flexbox_positioning' => :'flexboxPositioning', :'background_image' => :'backgroundImage', :'force_full_width_section' => :'forceFullWidthSection', :'vertical_alignment' => :'verticalAlignment', :'max_width_section_centering' => :'maxWidthSectionCentering', :'background_gradient' => :'backgroundGradient' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'background_color' => :'RGBAColor', :'flexbox_positioning' => :'String', :'background_image' => :'BackgroundImage', :'force_full_width_section' => :'Boolean', :'vertical_alignment' => :'String', :'max_width_section_centering' => :'Integer', :'background_gradient' => :'Gradient' } 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::Pages::Styles` 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::Pages::Styles`. 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?(:'background_color') self.background_color = attributes[:'background_color'] end if attributes.key?(:'flexbox_positioning') self.flexbox_positioning = attributes[:'flexbox_positioning'] end if attributes.key?(:'background_image') self.background_image = attributes[:'background_image'] end if attributes.key?(:'force_full_width_section') self.force_full_width_section = attributes[:'force_full_width_section'] end if attributes.key?(:'vertical_alignment') self.vertical_alignment = attributes[:'vertical_alignment'] end if attributes.key?(:'max_width_section_centering') self.max_width_section_centering = attributes[:'max_width_section_centering'] end if attributes.key?(:'background_gradient') self.background_gradient = attributes[:'background_gradient'] 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 @background_color.nil? invalid_properties.push('invalid value for "background_color", background_color cannot be nil.') end if @flexbox_positioning.nil? invalid_properties.push('invalid value for "flexbox_positioning", flexbox_positioning cannot be nil.') end if @background_image.nil? invalid_properties.push('invalid value for "background_image", background_image cannot be nil.') end if @force_full_width_section.nil? invalid_properties.push('invalid value for "force_full_width_section", force_full_width_section cannot be nil.') end if @vertical_alignment.nil? invalid_properties.push('invalid value for "vertical_alignment", vertical_alignment cannot be nil.') end if @max_width_section_centering.nil? invalid_properties.push('invalid value for "max_width_section_centering", max_width_section_centering cannot be nil.') end if @background_gradient.nil? invalid_properties.push('invalid value for "background_gradient", background_gradient 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 @background_color.nil? return false if @flexbox_positioning.nil? return false if @background_image.nil? return false if @force_full_width_section.nil? return false if @vertical_alignment.nil? return false if @max_width_section_centering.nil? return false if @background_gradient.nil? true 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 && background_color == o.background_color && flexbox_positioning == o.flexbox_positioning && background_image == o.background_image && force_full_width_section == o.force_full_width_section && vertical_alignment == o.vertical_alignment && max_width_section_centering == o.max_width_section_centering && background_gradient == o.background_gradient 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 [background_color, flexbox_positioning, background_image, force_full_width_section, vertical_alignment, max_width_section_centering, background_gradient].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/standard_error.rb
lib/hubspot/codegen/cms/pages/models/standard_error.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class StandardError # Error subcategory. attr_accessor :sub_category # Error context. attr_accessor :context # Error links. attr_accessor :links # Error ID. attr_accessor :id # Error category. attr_accessor :category # Error message. attr_accessor :message # List of error details. attr_accessor :errors # Error status. attr_accessor :status # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'sub_category' => :'subCategory', :'context' => :'context', :'links' => :'links', :'id' => :'id', :'category' => :'category', :'message' => :'message', :'errors' => :'errors', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'sub_category' => :'Object', :'context' => :'Hash<String, Array<String>>', :'links' => :'Hash<String, String>', :'id' => :'String', :'category' => :'String', :'message' => :'String', :'errors' => :'Array<ErrorDetail>', :'status' => :'String' } 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::Pages::StandardError` 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::Pages::StandardError`. 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?(:'sub_category') self.sub_category = attributes[:'sub_category'] end if attributes.key?(:'context') if (value = attributes[:'context']).is_a?(Hash) self.context = value end end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @context.nil? invalid_properties.push('invalid value for "context", context cannot be nil.') end if @links.nil? invalid_properties.push('invalid value for "links", links cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category cannot be nil.') end if @message.nil? invalid_properties.push('invalid value for "message", message cannot be nil.') end if @errors.nil? invalid_properties.push('invalid value for "errors", errors cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @context.nil? return false if @links.nil? return false if @category.nil? return false if @message.nil? return false if @errors.nil? return false if @status.nil? true 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 && sub_category == o.sub_category && context == o.context && links == o.links && id == o.id && category == o.category && message == o.message && errors == o.errors && status == o.status 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 [sub_category, context, links, id, category, message, errors, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/collection_response_with_total_version_content_folder.rb
lib/hubspot/codegen/cms/pages/models/collection_response_with_total_version_content_folder.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class CollectionResponseWithTotalVersionContentFolder # Total number of content folder versions. attr_accessor :total attr_accessor :paging # Collection of content folder versions. attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'total' => :'total', :'paging' => :'paging', :'results' => :'results' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'total' => :'Integer', :'paging' => :'Paging', :'results' => :'Array<VersionContentFolder>' } 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::Pages::CollectionResponseWithTotalVersionContentFolder` 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::Pages::CollectionResponseWithTotalVersionContentFolder`. 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?(:'total') self.total = attributes[:'total'] end if attributes.key?(:'paging') self.paging = attributes[:'paging'] end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end 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 @total.nil? invalid_properties.push('invalid value for "total", total cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results 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 @total.nil? return false if @results.nil? true 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 && total == o.total && paging == o.paging && results == o.results 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 [total, paging, results].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/version_user.rb
lib/hubspot/codegen/cms/pages/models/version_user.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class VersionUser # First and last name of the user. attr_accessor :full_name # ID of the user. attr_accessor :id # Email address of the user. attr_accessor :email # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'full_name' => :'fullName', :'id' => :'id', :'email' => :'email' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'full_name' => :'String', :'id' => :'String', :'email' => :'String' } 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::Pages::VersionUser` 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::Pages::VersionUser`. 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?(:'full_name') self.full_name = attributes[:'full_name'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'email') self.email = attributes[:'email'] 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 @full_name.nil? invalid_properties.push('invalid value for "full_name", full_name cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @email.nil? invalid_properties.push('invalid value for "email", email 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 @full_name.nil? return false if @id.nil? return false if @email.nil? true 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 && full_name == o.full_name && id == o.id && email == o.email 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 [full_name, id, email].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/content_folder.rb
lib/hubspot/codegen/cms/pages/models/content_folder.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class ContentFolder # The timestamp (ISO8601 format) when this content folder was deleted. attr_accessor :deleted_at # The ID of the content folder this folder is nested under attr_accessor :parent_folder_id attr_accessor :created # The name of the folder which will show up in the app dashboard attr_accessor :name # The unique ID of the content folder. attr_accessor :id # The type of object this folder applies to. Should always be LANDING_PAGE. attr_accessor :category attr_accessor :updated # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'deleted_at' => :'deletedAt', :'parent_folder_id' => :'parentFolderId', :'created' => :'created', :'name' => :'name', :'id' => :'id', :'category' => :'category', :'updated' => :'updated' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'deleted_at' => :'Time', :'parent_folder_id' => :'Integer', :'created' => :'Time', :'name' => :'String', :'id' => :'String', :'category' => :'Integer', :'updated' => :'Time' } 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::Pages::ContentFolder` 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::Pages::ContentFolder`. 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?(:'deleted_at') self.deleted_at = attributes[:'deleted_at'] end if attributes.key?(:'parent_folder_id') self.parent_folder_id = attributes[:'parent_folder_id'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'updated') self.updated = attributes[:'updated'] 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 @deleted_at.nil? invalid_properties.push('invalid value for "deleted_at", deleted_at cannot be nil.') end if @parent_folder_id.nil? invalid_properties.push('invalid value for "parent_folder_id", parent_folder_id cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category cannot be nil.') end if @updated.nil? invalid_properties.push('invalid value for "updated", updated 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 @deleted_at.nil? return false if @parent_folder_id.nil? return false if @created.nil? return false if @name.nil? return false if @id.nil? return false if @category.nil? return false if @updated.nil? true 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 && deleted_at == o.deleted_at && parent_folder_id == o.parent_folder_id && created == o.created && name == o.name && id == o.id && category == o.category && updated == o.updated 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 [deleted_at, parent_folder_id, created, name, id, category, updated].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/side_or_corner.rb
lib/hubspot/codegen/cms/pages/models/side_or_corner.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class SideOrCorner # attr_accessor :horizontal_side # attr_accessor :vertical_side # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'horizontal_side' => :'horizontalSide', :'vertical_side' => :'verticalSide' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'horizontal_side' => :'String', :'vertical_side' => :'String' } 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::Pages::SideOrCorner` 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::Pages::SideOrCorner`. 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?(:'horizontal_side') self.horizontal_side = attributes[:'horizontal_side'] end if attributes.key?(:'vertical_side') self.vertical_side = attributes[:'vertical_side'] 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 @horizontal_side.nil? invalid_properties.push('invalid value for "horizontal_side", horizontal_side cannot be nil.') end if @vertical_side.nil? invalid_properties.push('invalid value for "vertical_side", vertical_side 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 @horizontal_side.nil? return false if @vertical_side.nil? true 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 && horizontal_side == o.horizontal_side && vertical_side == o.vertical_side 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 [horizontal_side, vertical_side].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/version_page.rb
lib/hubspot/codegen/cms/pages/models/version_page.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class VersionPage # ID of this page version. attr_accessor :id attr_accessor :user attr_accessor :object attr_accessor :updated_at # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'user' => :'user', :'object' => :'object', :'updated_at' => :'updatedAt' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'id' => :'String', :'user' => :'VersionUser', :'object' => :'Page', :'updated_at' => :'Time' } 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::Pages::VersionPage` 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::Pages::VersionPage`. 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?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'user') self.user = attributes[:'user'] end if attributes.key?(:'object') self.object = attributes[:'object'] end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] 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 @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @user.nil? invalid_properties.push('invalid value for "user", user cannot be nil.') end if @object.nil? invalid_properties.push('invalid value for "object", object cannot be nil.') end if @updated_at.nil? invalid_properties.push('invalid value for "updated_at", updated_at 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 @id.nil? return false if @user.nil? return false if @object.nil? return false if @updated_at.nil? true 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 && id == o.id && user == o.user && object == o.object && updated_at == o.updated_at 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 [id, user, object, updated_at].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/background_image.rb
lib/hubspot/codegen/cms/pages/models/background_image.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class BackgroundImage # attr_accessor :image_url # attr_accessor :background_size # attr_accessor :background_position # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'image_url' => :'imageUrl', :'background_size' => :'backgroundSize', :'background_position' => :'backgroundPosition' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'image_url' => :'String', :'background_size' => :'String', :'background_position' => :'String' } 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::Pages::BackgroundImage` 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::Pages::BackgroundImage`. 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?(:'image_url') self.image_url = attributes[:'image_url'] end if attributes.key?(:'background_size') self.background_size = attributes[:'background_size'] end if attributes.key?(:'background_position') self.background_position = attributes[:'background_position'] 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 @image_url.nil? invalid_properties.push('invalid value for "image_url", image_url cannot be nil.') end if @background_size.nil? invalid_properties.push('invalid value for "background_size", background_size cannot be nil.') end if @background_position.nil? invalid_properties.push('invalid value for "background_position", background_position 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 @image_url.nil? return false if @background_size.nil? return false if @background_position.nil? true 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 && image_url == o.image_url && background_size == o.background_size && background_position == o.background_position 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 [image_url, background_size, background_position].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/attach_to_lang_primary_request_v_next.rb
lib/hubspot/codegen/cms/pages/models/attach_to_lang_primary_request_v_next.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class AttachToLangPrimaryRequestVNext # Designated language of the object to add to a multi-language group. attr_accessor :language # ID of the object to add to a multi-language group. attr_accessor :id # ID of primary language object in multi-language group. attr_accessor :primary_id # Primary language of the multi-language group. attr_accessor :primary_language # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'language' => :'language', :'id' => :'id', :'primary_id' => :'primaryId', :'primary_language' => :'primaryLanguage' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'language' => :'String', :'id' => :'String', :'primary_id' => :'String', :'primary_language' => :'String' } 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::Pages::AttachToLangPrimaryRequestVNext` 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::Pages::AttachToLangPrimaryRequestVNext`. 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?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'primary_id') self.primary_id = attributes[:'primary_id'] end if attributes.key?(:'primary_language') self.primary_language = attributes[:'primary_language'] 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 @language.nil? invalid_properties.push('invalid value for "language", language cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @primary_id.nil? invalid_properties.push('invalid value for "primary_id", primary_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 @language.nil? return false if @id.nil? return false if @primary_id.nil? true 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 && language == o.language && id == o.id && primary_id == o.primary_id && primary_language == o.primary_language 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 [language, id, primary_id, primary_language].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/previous_page.rb
lib/hubspot/codegen/cms/pages/models/previous_page.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class PreviousPage # attr_accessor :before # attr_accessor :link # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'before' => :'before', :'link' => :'link' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'before' => :'String', :'link' => :'String' } 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::Pages::PreviousPage` 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::Pages::PreviousPage`. 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?(:'before') self.before = attributes[:'before'] end if attributes.key?(:'link') self.link = attributes[:'link'] 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 @before.nil? invalid_properties.push('invalid value for "before", before 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 @before.nil? true 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 && before == o.before && link == o.link 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 [before, link].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/next_page.rb
lib/hubspot/codegen/cms/pages/models/next_page.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class NextPage # attr_accessor :link # attr_accessor :after # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'link' => :'link', :'after' => :'after' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'link' => :'String', :'after' => :'String' } 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::Pages::NextPage` 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::Pages::NextPage`. 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?(:'link') self.link = attributes[:'link'] end if attributes.key?(:'after') self.after = attributes[:'after'] 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 @after.nil? invalid_properties.push('invalid value for "after", after 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 @after.nil? true 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 && link == o.link && after == o.after 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 [link, after].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/rgba_color.rb
lib/hubspot/codegen/cms/pages/models/rgba_color.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class RGBAColor # Alpha. attr_accessor :a # Red. attr_accessor :r # Blue. attr_accessor :b # Green. attr_accessor :g # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'a' => :'a', :'r' => :'r', :'b' => :'b', :'g' => :'g' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'a' => :'Float', :'r' => :'Integer', :'b' => :'Integer', :'g' => :'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::Pages::RGBAColor` 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::Pages::RGBAColor`. 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?(:'a') self.a = attributes[:'a'] end if attributes.key?(:'r') self.r = attributes[:'r'] end if attributes.key?(:'b') self.b = attributes[:'b'] end if attributes.key?(:'g') self.g = attributes[:'g'] 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 @a.nil? invalid_properties.push('invalid value for "a", a cannot be nil.') end if @r.nil? invalid_properties.push('invalid value for "r", r cannot be nil.') end if @b.nil? invalid_properties.push('invalid value for "b", b cannot be nil.') end if @g.nil? invalid_properties.push('invalid value for "g", g 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 @a.nil? return false if @r.nil? return false if @b.nil? return false if @g.nil? true 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 && a == o.a && r == o.r && b == o.b && g == o.g 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 [a, r, b, g].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/batch_response_content_folder_with_errors.rb
lib/hubspot/codegen/cms/pages/models/batch_response_content_folder_with_errors.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class BatchResponseContentFolderWithErrors # Time of batch operation completion. attr_accessor :completed_at # Number of errors. attr_accessor :num_errors # Time of batch operation request. attr_accessor :requested_at # Time of batch operation start. attr_accessor :started_at # Links associated with batch operation. attr_accessor :links # Results of batch operation. attr_accessor :results # Errors in batch operation. attr_accessor :errors # Status of batch operation. attr_accessor :status 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 { :'completed_at' => :'completedAt', :'num_errors' => :'numErrors', :'requested_at' => :'requestedAt', :'started_at' => :'startedAt', :'links' => :'links', :'results' => :'results', :'errors' => :'errors', :'status' => :'status' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'completed_at' => :'Time', :'num_errors' => :'Integer', :'requested_at' => :'Time', :'started_at' => :'Time', :'links' => :'Hash<String, String>', :'results' => :'Array<ContentFolder>', :'errors' => :'Array<StandardError>', :'status' => :'String' } 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::Pages::BatchResponseContentFolderWithErrors` 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::Pages::BatchResponseContentFolderWithErrors`. 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?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'num_errors') self.num_errors = attributes[:'num_errors'] end if attributes.key?(:'requested_at') self.requested_at = attributes[:'requested_at'] end if attributes.key?(:'started_at') self.started_at = attributes[:'started_at'] end if attributes.key?(:'links') if (value = attributes[:'links']).is_a?(Hash) self.links = value end end if attributes.key?(:'results') if (value = attributes[:'results']).is_a?(Array) self.results = value end end if attributes.key?(:'errors') if (value = attributes[:'errors']).is_a?(Array) self.errors = value end end if attributes.key?(:'status') self.status = attributes[:'status'] 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 @completed_at.nil? invalid_properties.push('invalid value for "completed_at", completed_at cannot be nil.') end if @started_at.nil? invalid_properties.push('invalid value for "started_at", started_at cannot be nil.') end if @results.nil? invalid_properties.push('invalid value for "results", results cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status 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 @completed_at.nil? return false if @started_at.nil? return false if @results.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) return false unless status_validator.valid?(@status) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] status Object to be assigned def status=(status) validator = EnumAttributeValidator.new('String', ["PENDING", "PROCESSING", "CANCELED", "COMPLETE"]) unless validator.valid?(status) fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." end @status = status 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 && completed_at == o.completed_at && num_errors == o.num_errors && requested_at == o.requested_at && started_at == o.started_at && links == o.links && results == o.results && errors == o.errors && status == o.status 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 [completed_at, num_errors, requested_at, started_at, links, results, errors, status].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) 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) 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) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = Hubspot::Cms::Pages.const_get(type) 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 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
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
false
HubSpot/hubspot-api-ruby
https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/lib/hubspot/codegen/cms/pages/models/page.rb
lib/hubspot/codegen/cms/pages/models/page.rb
=begin #Pages #Use these endpoints for interacting with Landing Pages and Site Pages The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Cms module Pages class Page # The date (ISO8601 format) the page is to be published at. attr_accessor :publish_date # The explicitly defined ISO 639 language code of the page. If null, the page will default to the language of the Domain. attr_accessor :language # Boolean to determine whether or not the styles from the template should be applied. attr_accessor :enable_layout_stylesheets # A description that goes in <meta> tag on the page. attr_accessor :meta_description # List of stylesheets to attach to this page. These stylesheets are attached to just this page. Order of precedence is bottom to top, just like in the HTML. attr_accessor :attached_stylesheets # Set this to create a password protected page. Entering the password will be required to view the page. attr_accessor :password # Set this to true if you want to be published immediately when the schedule publish endpoint is called, and to ignore the publish_date setting. attr_accessor :publish_immediately # The html title of this page. attr_accessor :html_title attr_accessor :translations # The unique ID of the page. attr_accessor :id # An ENUM descibing the current state of this page. attr_accessor :state # The path of the this page. This field is appended to the domain to construct the url of this page. attr_accessor :slug # The ID of the user that created this page. attr_accessor :created_by_id attr_accessor :currently_published # If True, the page will not show up in your dashboard, although the page could still be live. attr_accessor :archived_in_dashboard attr_accessor :created # An ENUM descibing the type of this object. Should be either LANDING_PAGE or SITE_PAGE. attr_accessor :content_type_category # The ID of the MAB test (or dynamic test) associated with this page, if applicable attr_accessor :mab_experiment_id # The ID of the user that updated this page. attr_accessor :updated_by_id # ID of the primary page this object was translated from. attr_accessor :translated_from_id # The ID of the associated folder this landing page is organized under in the app dashboard. attr_accessor :folder_id # A data structure containing the data for all the modules inside the containers for this page. This will only be populated if the page has widget containers. attr_accessor :widget_containers # The ID of another page this page's url should redirect to once this page expires. Should only set this or pageExpiryRedirectUrl. attr_accessor :page_expiry_redirect_id attr_accessor :dynamic_page_data_source_type # The featuredImage of this page. attr_accessor :featured_image # The name of the user that updated this page. attr_accessor :author_name # The domain this page will resolve to. If null, the page will default to the primary domain for this content type. attr_accessor :domain # The internal name of the page. attr_accessor :name # The ID of the HubDB table this page references, if applicable attr_accessor :dynamic_page_hub_db_table_id # The GUID of the marketing campaign this page is a part of. attr_accessor :campaign attr_accessor :dynamic_page_data_source_id # Boolean to determine whether or not the styles from the template should be applied. attr_accessor :enable_domain_stylesheets # Boolean to determine whether or not the Primary CSS Files should be applied. attr_accessor :include_default_custom_css # Details the type of page this is. Should always be landing_page or site_page attr_accessor :subcategory # attr_accessor :layout_sections attr_accessor :updated # Custom HTML for embed codes, javascript that should be placed before the </body> tag of the page. attr_accessor :footer_html # A data structure containing the data for all the modules for this page. attr_accessor :widgets # Custom HTML for embed codes, javascript, etc. that goes in the <head> tag of the page. attr_accessor :head_html # The URL this page's url should redirect to once this page expires. Should only set this or pageExpiryRedirectId. attr_accessor :page_expiry_redirect_url # The status of the AB test associated with this page, if applicable attr_accessor :ab_status # Boolean to determine if this page should use a featuredImage. attr_accessor :use_featured_image # The ID of the AB test associated with this page, if applicable attr_accessor :ab_test_id # Alt Text of the featuredImage. attr_accessor :featured_image_alt_text attr_accessor :content_group_id # Boolean describing if the page expiration feature is enabled for this page attr_accessor :page_expiry_enabled # String detailing the path of the template used for this page. attr_accessor :template_path # A generated field representing the URL of this page. attr_accessor :url # Rules for require member registration to access private content. attr_accessor :public_access_rules # The timestamp (ISO8601 format) when this page was deleted. attr_accessor :archived_at # attr_accessor :theme_settings_values # The date at which this page should expire and begin redirecting to another url or page. attr_accessor :page_expiry_date # Boolean to determine whether or not to respect publicAccessRules. attr_accessor :public_access_rules_enabled # A generated Boolean describing whether or not this page is currently expired and being redirected. attr_accessor :page_redirected # A generated ENUM descibing the current state of this page. attr_accessor :current_state # ID of the type of object this is. Should always . attr_accessor :category_id # Optional override to set the URL to be used in the rel=canonical link tag on the page. attr_accessor :link_rel_canonical_url 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 { :'publish_date' => :'publishDate', :'language' => :'language', :'enable_layout_stylesheets' => :'enableLayoutStylesheets', :'meta_description' => :'metaDescription', :'attached_stylesheets' => :'attachedStylesheets', :'password' => :'password', :'publish_immediately' => :'publishImmediately', :'html_title' => :'htmlTitle', :'translations' => :'translations', :'id' => :'id', :'state' => :'state', :'slug' => :'slug', :'created_by_id' => :'createdById', :'currently_published' => :'currentlyPublished', :'archived_in_dashboard' => :'archivedInDashboard', :'created' => :'created', :'content_type_category' => :'contentTypeCategory', :'mab_experiment_id' => :'mabExperimentId', :'updated_by_id' => :'updatedById', :'translated_from_id' => :'translatedFromId', :'folder_id' => :'folderId', :'widget_containers' => :'widgetContainers', :'page_expiry_redirect_id' => :'pageExpiryRedirectId', :'dynamic_page_data_source_type' => :'dynamicPageDataSourceType', :'featured_image' => :'featuredImage', :'author_name' => :'authorName', :'domain' => :'domain', :'name' => :'name', :'dynamic_page_hub_db_table_id' => :'dynamicPageHubDbTableId', :'campaign' => :'campaign', :'dynamic_page_data_source_id' => :'dynamicPageDataSourceId', :'enable_domain_stylesheets' => :'enableDomainStylesheets', :'include_default_custom_css' => :'includeDefaultCustomCss', :'subcategory' => :'subcategory', :'layout_sections' => :'layoutSections', :'updated' => :'updated', :'footer_html' => :'footerHtml', :'widgets' => :'widgets', :'head_html' => :'headHtml', :'page_expiry_redirect_url' => :'pageExpiryRedirectUrl', :'ab_status' => :'abStatus', :'use_featured_image' => :'useFeaturedImage', :'ab_test_id' => :'abTestId', :'featured_image_alt_text' => :'featuredImageAltText', :'content_group_id' => :'contentGroupId', :'page_expiry_enabled' => :'pageExpiryEnabled', :'template_path' => :'templatePath', :'url' => :'url', :'public_access_rules' => :'publicAccessRules', :'archived_at' => :'archivedAt', :'theme_settings_values' => :'themeSettingsValues', :'page_expiry_date' => :'pageExpiryDate', :'public_access_rules_enabled' => :'publicAccessRulesEnabled', :'page_redirected' => :'pageRedirected', :'current_state' => :'currentState', :'category_id' => :'categoryId', :'link_rel_canonical_url' => :'linkRelCanonicalUrl' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'publish_date' => :'Time', :'language' => :'String', :'enable_layout_stylesheets' => :'Boolean', :'meta_description' => :'String', :'attached_stylesheets' => :'Array<Hash<String, Object>>', :'password' => :'String', :'publish_immediately' => :'Boolean', :'html_title' => :'String', :'translations' => :'Hash<String, ContentLanguageVariation>', :'id' => :'String', :'state' => :'String', :'slug' => :'String', :'created_by_id' => :'String', :'currently_published' => :'Boolean', :'archived_in_dashboard' => :'Boolean', :'created' => :'Time', :'content_type_category' => :'String', :'mab_experiment_id' => :'String', :'updated_by_id' => :'String', :'translated_from_id' => :'String', :'folder_id' => :'String', :'widget_containers' => :'Hash<String, Object>', :'page_expiry_redirect_id' => :'Integer', :'dynamic_page_data_source_type' => :'Integer', :'featured_image' => :'String', :'author_name' => :'String', :'domain' => :'String', :'name' => :'String', :'dynamic_page_hub_db_table_id' => :'String', :'campaign' => :'String', :'dynamic_page_data_source_id' => :'String', :'enable_domain_stylesheets' => :'Boolean', :'include_default_custom_css' => :'Boolean', :'subcategory' => :'String', :'layout_sections' => :'Hash<String, LayoutSection>', :'updated' => :'Time', :'footer_html' => :'String', :'widgets' => :'Hash<String, Object>', :'head_html' => :'String', :'page_expiry_redirect_url' => :'String', :'ab_status' => :'String', :'use_featured_image' => :'Boolean', :'ab_test_id' => :'String', :'featured_image_alt_text' => :'String', :'content_group_id' => :'String', :'page_expiry_enabled' => :'Boolean', :'template_path' => :'String', :'url' => :'String', :'public_access_rules' => :'Array<Object>', :'archived_at' => :'Time', :'theme_settings_values' => :'Hash<String, Object>', :'page_expiry_date' => :'Integer', :'public_access_rules_enabled' => :'Boolean', :'page_redirected' => :'Boolean', :'current_state' => :'String', :'category_id' => :'Integer', :'link_rel_canonical_url' => :'String' } 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::Pages::Page` 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::Pages::Page`. 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?(:'publish_date') self.publish_date = attributes[:'publish_date'] end if attributes.key?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'enable_layout_stylesheets') self.enable_layout_stylesheets = attributes[:'enable_layout_stylesheets'] end if attributes.key?(:'meta_description') self.meta_description = attributes[:'meta_description'] end if attributes.key?(:'attached_stylesheets') if (value = attributes[:'attached_stylesheets']).is_a?(Array) self.attached_stylesheets = value end end if attributes.key?(:'password') self.password = attributes[:'password'] end if attributes.key?(:'publish_immediately') self.publish_immediately = attributes[:'publish_immediately'] end if attributes.key?(:'html_title') self.html_title = attributes[:'html_title'] end if attributes.key?(:'translations') if (value = attributes[:'translations']).is_a?(Hash) self.translations = value end end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'state') self.state = attributes[:'state'] end if attributes.key?(:'slug') self.slug = attributes[:'slug'] end if attributes.key?(:'created_by_id') self.created_by_id = attributes[:'created_by_id'] end if attributes.key?(:'currently_published') self.currently_published = attributes[:'currently_published'] end if attributes.key?(:'archived_in_dashboard') self.archived_in_dashboard = attributes[:'archived_in_dashboard'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'content_type_category') self.content_type_category = attributes[:'content_type_category'] end if attributes.key?(:'mab_experiment_id') self.mab_experiment_id = attributes[:'mab_experiment_id'] end if attributes.key?(:'updated_by_id') self.updated_by_id = attributes[:'updated_by_id'] end if attributes.key?(:'translated_from_id') self.translated_from_id = attributes[:'translated_from_id'] end if attributes.key?(:'folder_id') self.folder_id = attributes[:'folder_id'] end if attributes.key?(:'widget_containers') if (value = attributes[:'widget_containers']).is_a?(Hash) self.widget_containers = value end end if attributes.key?(:'page_expiry_redirect_id') self.page_expiry_redirect_id = attributes[:'page_expiry_redirect_id'] end if attributes.key?(:'dynamic_page_data_source_type') self.dynamic_page_data_source_type = attributes[:'dynamic_page_data_source_type'] end if attributes.key?(:'featured_image') self.featured_image = attributes[:'featured_image'] end if attributes.key?(:'author_name') self.author_name = attributes[:'author_name'] end if attributes.key?(:'domain') self.domain = attributes[:'domain'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'dynamic_page_hub_db_table_id') self.dynamic_page_hub_db_table_id = attributes[:'dynamic_page_hub_db_table_id'] end if attributes.key?(:'campaign') self.campaign = attributes[:'campaign'] end if attributes.key?(:'dynamic_page_data_source_id') self.dynamic_page_data_source_id = attributes[:'dynamic_page_data_source_id'] end if attributes.key?(:'enable_domain_stylesheets') self.enable_domain_stylesheets = attributes[:'enable_domain_stylesheets'] end if attributes.key?(:'include_default_custom_css') self.include_default_custom_css = attributes[:'include_default_custom_css'] end if attributes.key?(:'subcategory') self.subcategory = attributes[:'subcategory'] end if attributes.key?(:'layout_sections') if (value = attributes[:'layout_sections']).is_a?(Hash) self.layout_sections = value end end if attributes.key?(:'updated') self.updated = attributes[:'updated'] end if attributes.key?(:'footer_html') self.footer_html = attributes[:'footer_html'] end if attributes.key?(:'widgets') if (value = attributes[:'widgets']).is_a?(Hash) self.widgets = value end end if attributes.key?(:'head_html') self.head_html = attributes[:'head_html'] end if attributes.key?(:'page_expiry_redirect_url') self.page_expiry_redirect_url = attributes[:'page_expiry_redirect_url'] end if attributes.key?(:'ab_status') self.ab_status = attributes[:'ab_status'] end if attributes.key?(:'use_featured_image') self.use_featured_image = attributes[:'use_featured_image'] end if attributes.key?(:'ab_test_id') self.ab_test_id = attributes[:'ab_test_id'] end if attributes.key?(:'featured_image_alt_text') self.featured_image_alt_text = attributes[:'featured_image_alt_text'] end if attributes.key?(:'content_group_id') self.content_group_id = attributes[:'content_group_id'] end if attributes.key?(:'page_expiry_enabled') self.page_expiry_enabled = attributes[:'page_expiry_enabled'] end if attributes.key?(:'template_path') self.template_path = attributes[:'template_path'] end if attributes.key?(:'url') self.url = attributes[:'url'] end if attributes.key?(:'public_access_rules') if (value = attributes[:'public_access_rules']).is_a?(Array) self.public_access_rules = value end end if attributes.key?(:'archived_at') self.archived_at = attributes[:'archived_at'] end if attributes.key?(:'theme_settings_values') if (value = attributes[:'theme_settings_values']).is_a?(Hash) self.theme_settings_values = value end end if attributes.key?(:'page_expiry_date') self.page_expiry_date = attributes[:'page_expiry_date'] end if attributes.key?(:'public_access_rules_enabled') self.public_access_rules_enabled = attributes[:'public_access_rules_enabled'] end if attributes.key?(:'page_redirected') self.page_redirected = attributes[:'page_redirected'] end if attributes.key?(:'current_state') self.current_state = attributes[:'current_state'] end if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] end if attributes.key?(:'link_rel_canonical_url') self.link_rel_canonical_url = attributes[:'link_rel_canonical_url'] 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 @publish_date.nil? invalid_properties.push('invalid value for "publish_date", publish_date cannot be nil.') end if @language.nil? invalid_properties.push('invalid value for "language", language cannot be nil.') end if @enable_layout_stylesheets.nil? invalid_properties.push('invalid value for "enable_layout_stylesheets", enable_layout_stylesheets cannot be nil.') end if @meta_description.nil? invalid_properties.push('invalid value for "meta_description", meta_description cannot be nil.') end if @attached_stylesheets.nil? invalid_properties.push('invalid value for "attached_stylesheets", attached_stylesheets cannot be nil.') end if @password.nil? invalid_properties.push('invalid value for "password", password cannot be nil.') end if @publish_immediately.nil? invalid_properties.push('invalid value for "publish_immediately", publish_immediately cannot be nil.') end if @html_title.nil? invalid_properties.push('invalid value for "html_title", html_title cannot be nil.') end if @translations.nil? invalid_properties.push('invalid value for "translations", translations cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @state.nil? invalid_properties.push('invalid value for "state", state cannot be nil.') end if @state.to_s.length > 25 invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 25.') end if @slug.nil? invalid_properties.push('invalid value for "slug", slug cannot be nil.') end if @created_by_id.nil? invalid_properties.push('invalid value for "created_by_id", created_by_id cannot be nil.') end if @currently_published.nil? invalid_properties.push('invalid value for "currently_published", currently_published cannot be nil.') end if @archived_in_dashboard.nil? invalid_properties.push('invalid value for "archived_in_dashboard", archived_in_dashboard cannot be nil.') end if @created.nil? invalid_properties.push('invalid value for "created", created cannot be nil.') end if @content_type_category.nil? invalid_properties.push('invalid value for "content_type_category", content_type_category cannot be nil.') end if @mab_experiment_id.nil? invalid_properties.push('invalid value for "mab_experiment_id", mab_experiment_id cannot be nil.') end if @updated_by_id.nil? invalid_properties.push('invalid value for "updated_by_id", updated_by_id cannot be nil.') end if @translated_from_id.nil? invalid_properties.push('invalid value for "translated_from_id", translated_from_id cannot be nil.') end if @folder_id.nil? invalid_properties.push('invalid value for "folder_id", folder_id cannot be nil.') end if @widget_containers.nil? invalid_properties.push('invalid value for "widget_containers", widget_containers cannot be nil.') end if @page_expiry_redirect_id.nil? invalid_properties.push('invalid value for "page_expiry_redirect_id", page_expiry_redirect_id cannot be nil.') end if @dynamic_page_data_source_type.nil? invalid_properties.push('invalid value for "dynamic_page_data_source_type", dynamic_page_data_source_type cannot be nil.') end if @featured_image.nil? invalid_properties.push('invalid value for "featured_image", featured_image cannot be nil.') end if @author_name.nil? invalid_properties.push('invalid value for "author_name", author_name cannot be nil.') end if @domain.nil? invalid_properties.push('invalid value for "domain", domain cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @dynamic_page_hub_db_table_id.nil? invalid_properties.push('invalid value for "dynamic_page_hub_db_table_id", dynamic_page_hub_db_table_id cannot be nil.') end if @campaign.nil? invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') end if @dynamic_page_data_source_id.nil? invalid_properties.push('invalid value for "dynamic_page_data_source_id", dynamic_page_data_source_id cannot be nil.') end if @enable_domain_stylesheets.nil? invalid_properties.push('invalid value for "enable_domain_stylesheets", enable_domain_stylesheets cannot be nil.') end if @include_default_custom_css.nil? invalid_properties.push('invalid value for "include_default_custom_css", include_default_custom_css cannot be nil.') end if @subcategory.nil? invalid_properties.push('invalid value for "subcategory", subcategory cannot be nil.') end if @layout_sections.nil? invalid_properties.push('invalid value for "layout_sections", layout_sections cannot be nil.') end if @updated.nil? invalid_properties.push('invalid value for "updated", updated cannot be nil.') end if @footer_html.nil? invalid_properties.push('invalid value for "footer_html", footer_html cannot be nil.') end if @widgets.nil? invalid_properties.push('invalid value for "widgets", widgets cannot be nil.') end if @head_html.nil? invalid_properties.push('invalid value for "head_html", head_html cannot be nil.') end if @page_expiry_redirect_url.nil? invalid_properties.push('invalid value for "page_expiry_redirect_url", page_expiry_redirect_url cannot be nil.') end if @ab_status.nil? invalid_properties.push('invalid value for "ab_status", ab_status cannot be nil.') end if @use_featured_image.nil? invalid_properties.push('invalid value for "use_featured_image", use_featured_image cannot be nil.') end if @ab_test_id.nil? invalid_properties.push('invalid value for "ab_test_id", ab_test_id cannot be nil.') end if @featured_image_alt_text.nil? invalid_properties.push('invalid value for "featured_image_alt_text", featured_image_alt_text cannot be nil.') end if @content_group_id.nil? invalid_properties.push('invalid value for "content_group_id", content_group_id cannot be nil.') end if @page_expiry_enabled.nil? invalid_properties.push('invalid value for "page_expiry_enabled", page_expiry_enabled cannot be nil.') end if @template_path.nil? invalid_properties.push('invalid value for "template_path", template_path cannot be nil.') end if @url.nil? invalid_properties.push('invalid value for "url", url cannot be nil.') end if @public_access_rules.nil? invalid_properties.push('invalid value for "public_access_rules", public_access_rules cannot be nil.') end if @archived_at.nil? invalid_properties.push('invalid value for "archived_at", archived_at cannot be nil.') end if @theme_settings_values.nil? invalid_properties.push('invalid value for "theme_settings_values", theme_settings_values cannot be nil.') end if @page_expiry_date.nil? invalid_properties.push('invalid value for "page_expiry_date", page_expiry_date cannot be nil.') end if @public_access_rules_enabled.nil? invalid_properties.push('invalid value for "public_access_rules_enabled", public_access_rules_enabled cannot be nil.') end if @page_redirected.nil? invalid_properties.push('invalid value for "page_redirected", page_redirected cannot be nil.') end if @current_state.nil? invalid_properties.push('invalid value for "current_state", current_state cannot be nil.') end if @category_id.nil? invalid_properties.push('invalid value for "category_id", category_id cannot be nil.') end if @link_rel_canonical_url.nil? invalid_properties.push('invalid value for "link_rel_canonical_url", link_rel_canonical_url 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 @publish_date.nil? return false if @language.nil?
ruby
Apache-2.0
75a9afa65e9789fbe6ff711066d798ca0c10f432
2026-01-04T17:55:03.682567Z
true