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/marketing/events/models/public_list.rb
lib/hubspot/codegen/marketing/events/models/public_list.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class PublicList attr_accessor :processing_type attr_accessor :object_type_id attr_accessor :updated_by_id attr_accessor :filters_updated_at attr_accessor :list_id attr_accessor :created_at attr_accessor :processing_status attr_accessor :deleted_at attr_accessor :list_version attr_accessor :size attr_accessor :name attr_accessor :created_by_id attr_accessor :updated_at # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'processing_type' => :'processingType', :'object_type_id' => :'objectTypeId', :'updated_by_id' => :'updatedById', :'filters_updated_at' => :'filtersUpdatedAt', :'list_id' => :'listId', :'created_at' => :'createdAt', :'processing_status' => :'processingStatus', :'deleted_at' => :'deletedAt', :'list_version' => :'listVersion', :'size' => :'size', :'name' => :'name', :'created_by_id' => :'createdById', :'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 { :'processing_type' => :'String', :'object_type_id' => :'String', :'updated_by_id' => :'String', :'filters_updated_at' => :'Time', :'list_id' => :'String', :'created_at' => :'Time', :'processing_status' => :'String', :'deleted_at' => :'Time', :'list_version' => :'Integer', :'size' => :'Integer', :'name' => :'String', :'created_by_id' => :'String', :'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::Marketing::Events::PublicList` 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::Marketing::Events::PublicList`. 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?(:'processing_type') self.processing_type = attributes[:'processing_type'] end if attributes.key?(:'object_type_id') self.object_type_id = attributes[:'object_type_id'] end if attributes.key?(:'updated_by_id') self.updated_by_id = attributes[:'updated_by_id'] end if attributes.key?(:'filters_updated_at') self.filters_updated_at = attributes[:'filters_updated_at'] end if attributes.key?(:'list_id') self.list_id = attributes[:'list_id'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'processing_status') self.processing_status = attributes[:'processing_status'] end if attributes.key?(:'deleted_at') self.deleted_at = attributes[:'deleted_at'] end if attributes.key?(:'list_version') self.list_version = attributes[:'list_version'] end if attributes.key?(:'size') self.size = attributes[:'size'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'created_by_id') self.created_by_id = attributes[:'created_by_id'] 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 @processing_type.nil? invalid_properties.push('invalid value for "processing_type", processing_type cannot be nil.') end if @object_type_id.nil? invalid_properties.push('invalid value for "object_type_id", object_type_id cannot be nil.') end if @list_id.nil? invalid_properties.push('invalid value for "list_id", list_id cannot be nil.') end if @processing_status.nil? invalid_properties.push('invalid value for "processing_status", processing_status cannot be nil.') end if @list_version.nil? invalid_properties.push('invalid value for "list_version", list_version cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name 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 @processing_type.nil? return false if @object_type_id.nil? return false if @list_id.nil? return false if @processing_status.nil? return false if @list_version.nil? return false if @name.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 && processing_type == o.processing_type && object_type_id == o.object_type_id && updated_by_id == o.updated_by_id && filters_updated_at == o.filters_updated_at && list_id == o.list_id && created_at == o.created_at && processing_status == o.processing_status && deleted_at == o.deleted_at && list_version == o.list_version && size == o.size && name == o.name && created_by_id == o.created_by_id && 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 [processing_type, object_type_id, updated_by_id, filters_updated_at, list_id, created_at, processing_status, deleted_at, list_version, size, name, created_by_id, 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::Marketing::Events.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/marketing/events/models/batch_input_marketing_event_create_request_params.rb
lib/hubspot/codegen/marketing/events/models/batch_input_marketing_event_create_request_params.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchInputMarketingEventCreateRequestParams # 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<MarketingEventCreateRequestParams>' } 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::Marketing::Events::BatchInputMarketingEventCreateRequestParams` 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::Marketing::Events::BatchInputMarketingEventCreateRequestParams`. 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::Marketing::Events.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/marketing/events/models/next_page.rb
lib/hubspot/codegen/marketing/events/models/next_page.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events 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::Marketing::Events::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::Marketing::Events::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::Marketing::Events.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/marketing/events/models/batch_input_marketing_event_external_unique_identifier.rb
lib/hubspot/codegen/marketing/events/models/batch_input_marketing_event_external_unique_identifier.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchInputMarketingEventExternalUniqueIdentifier 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<MarketingEventExternalUniqueIdentifier>' } 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::Marketing::Events::BatchInputMarketingEventExternalUniqueIdentifier` 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::Marketing::Events::BatchInputMarketingEventExternalUniqueIdentifier`. 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::Marketing::Events.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/marketing/events/models/marketing_event_update_request_params.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_update_request_params.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventUpdateRequestParams # The start date and time of the marketing event. attr_accessor :start_date_time # A list of PropertyValues. These can be whatever kind of property names and values you want. However, they must already exist on the HubSpot account's definition of the MarketingEvent Object. If they don't they will be filtered out and not set. In order to do this you'll need to create a new PropertyGroup on the HubSpot account's MarketingEvent object for your specific app and create the Custom Property you want to track on that HubSpot account. Do not create any new default properties on the MarketingEvent object as that will apply to all HubSpot accounts. attr_accessor :custom_properties # Indicates if the marketing event has been cancelled. Defaults to `false` attr_accessor :event_cancelled # The name of the organizer of the marketing event. attr_accessor :event_organizer # A URL in the external event application where the marketing event can be managed. attr_accessor :event_url # The description of the marketing event. attr_accessor :event_description # The name of the marketing event. attr_accessor :event_name # Describes what type of event this is. For example: `WEBINAR`, `CONFERENCE`, `WORKSHOP` attr_accessor :event_type attr_accessor :event_completed # The end date and time of the marketing event. attr_accessor :end_date_time # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'start_date_time' => :'startDateTime', :'custom_properties' => :'customProperties', :'event_cancelled' => :'eventCancelled', :'event_organizer' => :'eventOrganizer', :'event_url' => :'eventUrl', :'event_description' => :'eventDescription', :'event_name' => :'eventName', :'event_type' => :'eventType', :'event_completed' => :'eventCompleted', :'end_date_time' => :'endDateTime' } 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 { :'start_date_time' => :'Time', :'custom_properties' => :'Array<PropertyValue>', :'event_cancelled' => :'Boolean', :'event_organizer' => :'String', :'event_url' => :'String', :'event_description' => :'String', :'event_name' => :'String', :'event_type' => :'String', :'event_completed' => :'Boolean', :'end_date_time' => :'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::Marketing::Events::MarketingEventUpdateRequestParams` 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::Marketing::Events::MarketingEventUpdateRequestParams`. 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?(:'start_date_time') self.start_date_time = attributes[:'start_date_time'] end if attributes.key?(:'custom_properties') if (value = attributes[:'custom_properties']).is_a?(Array) self.custom_properties = value end end if attributes.key?(:'event_cancelled') self.event_cancelled = attributes[:'event_cancelled'] end if attributes.key?(:'event_organizer') self.event_organizer = attributes[:'event_organizer'] end if attributes.key?(:'event_url') self.event_url = attributes[:'event_url'] end if attributes.key?(:'event_description') self.event_description = attributes[:'event_description'] end if attributes.key?(:'event_name') self.event_name = attributes[:'event_name'] end if attributes.key?(:'event_type') self.event_type = attributes[:'event_type'] end if attributes.key?(:'event_completed') self.event_completed = attributes[:'event_completed'] end if attributes.key?(:'end_date_time') self.end_date_time = attributes[:'end_date_time'] 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 && start_date_time == o.start_date_time && custom_properties == o.custom_properties && event_cancelled == o.event_cancelled && event_organizer == o.event_organizer && event_url == o.event_url && event_description == o.event_description && event_name == o.event_name && event_type == o.event_type && event_completed == o.event_completed && end_date_time == o.end_date_time 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 [start_date_time, custom_properties, event_cancelled, event_organizer, event_url, event_description, event_name, event_type, event_completed, end_date_time].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::Marketing::Events.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/marketing/events/models/collection_response_search_public_response_wrapper_no_paging.rb
lib/hubspot/codegen/marketing/events/models/collection_response_search_public_response_wrapper_no_paging.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class CollectionResponseSearchPublicResponseWrapperNoPaging attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'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 { :'results' => :'Array<SearchPublicResponseWrapper>' } 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::Marketing::Events::CollectionResponseSearchPublicResponseWrapperNoPaging` 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::Marketing::Events::CollectionResponseSearchPublicResponseWrapperNoPaging`. 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?(:'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 @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 @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 && 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 [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::Marketing::Events.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/marketing/events/models/batch_response_subscriber_email_response.rb
lib/hubspot/codegen/marketing/events/models/batch_response_subscriber_email_response.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchResponseSubscriberEmailResponse attr_accessor :completed_at attr_accessor :num_errors attr_accessor :requested_at attr_accessor :started_at attr_accessor :links attr_accessor :results attr_accessor :errors 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<SubscriberEmailResponse>', :'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::Marketing::Events::BatchResponseSubscriberEmailResponse` 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::Marketing::Events::BatchResponseSubscriberEmailResponse`. 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::Marketing::Events.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/marketing/events/models/event_detail_settings_url.rb
lib/hubspot/codegen/marketing/events/models/event_detail_settings_url.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class EventDetailSettingsUrl # The url that will be used to fetch marketing event details by id. Must contain a `%s` character sequence that will be substituted with the event id. For example: `https://my.event.app/events/%s` attr_accessor :event_details_url # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'event_details_url' => :'eventDetailsUrl' } 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 { :'event_details_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::Marketing::Events::EventDetailSettingsUrl` 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::Marketing::Events::EventDetailSettingsUrl`. 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?(:'event_details_url') self.event_details_url = attributes[:'event_details_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 @event_details_url.nil? invalid_properties.push('invalid value for "event_details_url", event_details_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 @event_details_url.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 && event_details_url == o.event_details_url 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 [event_details_url].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::Marketing::Events.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/marketing/events/models/batch_input_marketing_event_public_object_id_delete_request.rb
lib/hubspot/codegen/marketing/events/models/batch_input_marketing_event_public_object_id_delete_request.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchInputMarketingEventPublicObjectIdDeleteRequest 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<MarketingEventPublicObjectIdDeleteRequest>' } 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::Marketing::Events::BatchInputMarketingEventPublicObjectIdDeleteRequest` 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::Marketing::Events::BatchInputMarketingEventPublicObjectIdDeleteRequest`. 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::Marketing::Events.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/marketing/events/models/attendance_counters.rb
lib/hubspot/codegen/marketing/events/models/attendance_counters.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class AttendanceCounters attr_accessor :attended attr_accessor :registered attr_accessor :cancelled attr_accessor :no_shows # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'attended' => :'attended', :'registered' => :'registered', :'cancelled' => :'cancelled', :'no_shows' => :'noShows' } 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 { :'attended' => :'Integer', :'registered' => :'Integer', :'cancelled' => :'Integer', :'no_shows' => :'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::Marketing::Events::AttendanceCounters` 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::Marketing::Events::AttendanceCounters`. 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?(:'attended') self.attended = attributes[:'attended'] end if attributes.key?(:'registered') self.registered = attributes[:'registered'] end if attributes.key?(:'cancelled') self.cancelled = attributes[:'cancelled'] end if attributes.key?(:'no_shows') self.no_shows = attributes[:'no_shows'] 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 @attended.nil? invalid_properties.push('invalid value for "attended", attended cannot be nil.') end if @registered.nil? invalid_properties.push('invalid value for "registered", registered cannot be nil.') end if @cancelled.nil? invalid_properties.push('invalid value for "cancelled", cancelled cannot be nil.') end if @no_shows.nil? invalid_properties.push('invalid value for "no_shows", no_shows 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 @attended.nil? return false if @registered.nil? return false if @cancelled.nil? return false if @no_shows.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 && attended == o.attended && registered == o.registered && cancelled == o.cancelled && no_shows == o.no_shows 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 [attended, registered, cancelled, no_shows].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::Marketing::Events.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/marketing/events/models/batch_input_marketing_event_public_update_request_full_v2.rb
lib/hubspot/codegen/marketing/events/models/batch_input_marketing_event_public_update_request_full_v2.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchInputMarketingEventPublicUpdateRequestFullV2 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<MarketingEventPublicUpdateRequestFullV2>' } 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::Marketing::Events::BatchInputMarketingEventPublicUpdateRequestFullV2` 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::Marketing::Events::BatchInputMarketingEventPublicUpdateRequestFullV2`. 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::Marketing::Events.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/marketing/events/models/collection_response_marketing_event_public_read_response_v2_forward_paging.rb
lib/hubspot/codegen/marketing/events/models/collection_response_marketing_event_public_read_response_v2_forward_paging.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging attr_accessor :paging attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'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 { :'paging' => :'ForwardPaging', :'results' => :'Array<MarketingEventPublicReadResponseV2>' } 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::Marketing::Events::CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging` 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::Marketing::Events::CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging`. 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?(:'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 @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 @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 && 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 [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::Marketing::Events.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/marketing/events/models/collection_response_with_total_marketing_event_identifiers_response_no_paging.rb
lib/hubspot/codegen/marketing/events/models/collection_response_with_total_marketing_event_identifiers_response_no_paging.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging attr_accessor :total attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'total' => :'total', :'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', :'results' => :'Array<MarketingEventIdentifiersResponse>' } 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::Marketing::Events::CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging` 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::Marketing::Events::CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging`. 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?(:'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 && 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, 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::Marketing::Events.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/marketing/events/models/marketing_event_identifiers_response.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_identifiers_response.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventIdentifiersResponse attr_accessor :external_account_id attr_accessor :external_event_id attr_accessor :app_info attr_accessor :object_id attr_accessor :marketing_event_name # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'external_account_id' => :'externalAccountId', :'external_event_id' => :'externalEventId', :'app_info' => :'appInfo', :'object_id' => :'objectId', :'marketing_event_name' => :'marketingEventName' } 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 { :'external_account_id' => :'String', :'external_event_id' => :'String', :'app_info' => :'AppInfo', :'object_id' => :'String', :'marketing_event_name' => :'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::Marketing::Events::MarketingEventIdentifiersResponse` 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::Marketing::Events::MarketingEventIdentifiersResponse`. 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?(:'external_account_id') self.external_account_id = attributes[:'external_account_id'] end if attributes.key?(:'external_event_id') self.external_event_id = attributes[:'external_event_id'] end if attributes.key?(:'app_info') self.app_info = attributes[:'app_info'] end if attributes.key?(:'object_id') self.object_id = attributes[:'object_id'] end if attributes.key?(:'marketing_event_name') self.marketing_event_name = attributes[:'marketing_event_name'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new if @external_event_id.nil? invalid_properties.push('invalid value for "external_event_id", external_event_id cannot be nil.') end if @object_id.nil? invalid_properties.push('invalid value for "object_id", object_id cannot be nil.') end if @marketing_event_name.nil? invalid_properties.push('invalid value for "marketing_event_name", marketing_event_name 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 @external_event_id.nil? return false if @object_id.nil? return false if @marketing_event_name.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 && external_account_id == o.external_account_id && external_event_id == o.external_event_id && app_info == o.app_info && object_id == o.object_id && marketing_event_name == o.marketing_event_name 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 [external_account_id, external_event_id, app_info, object_id, marketing_event_name].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::Marketing::Events.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/marketing/events/models/marketing_event_association.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_association.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventAssociation attr_accessor :external_account_id attr_accessor :marketing_event_id attr_accessor :external_event_id attr_accessor :name # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'external_account_id' => :'externalAccountId', :'marketing_event_id' => :'marketingEventId', :'external_event_id' => :'externalEventId', :'name' => :'name' } 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 { :'external_account_id' => :'String', :'marketing_event_id' => :'String', :'external_event_id' => :'String', :'name' => :'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::Marketing::Events::MarketingEventAssociation` 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::Marketing::Events::MarketingEventAssociation`. 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?(:'external_account_id') self.external_account_id = attributes[:'external_account_id'] end if attributes.key?(:'marketing_event_id') self.marketing_event_id = attributes[:'marketing_event_id'] end if attributes.key?(:'external_event_id') self.external_event_id = attributes[:'external_event_id'] end if attributes.key?(:'name') self.name = attributes[:'name'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new if @marketing_event_id.nil? invalid_properties.push('invalid value for "marketing_event_id", marketing_event_id cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name 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 @marketing_event_id.nil? return false if @name.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 && external_account_id == o.external_account_id && marketing_event_id == o.marketing_event_id && external_event_id == o.external_event_id && name == o.name 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 [external_account_id, marketing_event_id, external_event_id, name].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::Marketing::Events.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/marketing/events/models/batch_response_subscriber_vid_response.rb
lib/hubspot/codegen/marketing/events/models/batch_response_subscriber_vid_response.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchResponseSubscriberVidResponse attr_accessor :completed_at attr_accessor :num_errors attr_accessor :requested_at attr_accessor :started_at attr_accessor :links attr_accessor :results attr_accessor :errors 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<SubscriberVidResponse>', :'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::Marketing::Events::BatchResponseSubscriberVidResponse` 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::Marketing::Events::BatchResponseSubscriberVidResponse`. 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::Marketing::Events.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/marketing/events/models/subscriber_email_response.rb
lib/hubspot/codegen/marketing/events/models/subscriber_email_response.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class SubscriberEmailResponse attr_accessor :vid attr_accessor :email # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'vid' => :'vid', :'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 { :'vid' => :'Integer', :'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::Marketing::Events::SubscriberEmailResponse` 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::Marketing::Events::SubscriberEmailResponse`. 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?(:'vid') self.vid = attributes[:'vid'] 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 @vid.nil? invalid_properties.push('invalid value for "vid", vid 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 @vid.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 && vid == o.vid && 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 [vid, 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::Marketing::Events.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/marketing/events/models/marketing_event_public_read_response.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_public_read_response.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventPublicReadResponse # The number of HubSpot contacts that registered for this marketing event. attr_accessor :registrants # The name of the organizer of the marketing event. attr_accessor :event_organizer # A URL in the external event application where the marketing event can be managed. attr_accessor :event_url # The number of HubSpot contacts that attended this marketing event. attr_accessor :attendees # The type of the marketing event. attr_accessor :event_type attr_accessor :event_completed # The end date and time of the marketing event. attr_accessor :end_date_time # The number of HubSpot contacts that registered for this marketing event, but did not attend. This field only had a value when the event is over. attr_accessor :no_shows # The number of HubSpot contacts that registered for this marketing event, but later cancelled their registration. attr_accessor :cancellations # attr_accessor :created_at # The start date and time of the marketing event. attr_accessor :start_date_time # A list of PropertyValues. These can be whatever kind of property names and values you want. However, they must already exist on the HubSpot account's definition of the MarketingEvent Object. If they don't they will be filtered out and not set. In order to do this you'll need to create a new PropertyGroup on the HubSpot account's MarketingEvent object for your specific app and create the Custom Property you want to track on that HubSpot account. Do not create any new default properties on the MarketingEvent object as that will apply to all HubSpot accounts. attr_accessor :custom_properties # Indicates if the marketing event has been cancelled. attr_accessor :event_cancelled # The id of the marketing event in the external event application. attr_accessor :external_event_id # The description of the marketing event. attr_accessor :event_description # The name of the marketing event. attr_accessor :event_name # attr_accessor :id attr_accessor :object_id # attr_accessor :updated_at # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'registrants' => :'registrants', :'event_organizer' => :'eventOrganizer', :'event_url' => :'eventUrl', :'attendees' => :'attendees', :'event_type' => :'eventType', :'event_completed' => :'eventCompleted', :'end_date_time' => :'endDateTime', :'no_shows' => :'noShows', :'cancellations' => :'cancellations', :'created_at' => :'createdAt', :'start_date_time' => :'startDateTime', :'custom_properties' => :'customProperties', :'event_cancelled' => :'eventCancelled', :'external_event_id' => :'externalEventId', :'event_description' => :'eventDescription', :'event_name' => :'eventName', :'id' => :'id', :'object_id' => :'objectId', :'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 { :'registrants' => :'Integer', :'event_organizer' => :'String', :'event_url' => :'String', :'attendees' => :'Integer', :'event_type' => :'String', :'event_completed' => :'Boolean', :'end_date_time' => :'Time', :'no_shows' => :'Integer', :'cancellations' => :'Integer', :'created_at' => :'Time', :'start_date_time' => :'Time', :'custom_properties' => :'Array<PropertyValue>', :'event_cancelled' => :'Boolean', :'external_event_id' => :'String', :'event_description' => :'String', :'event_name' => :'String', :'id' => :'String', :'object_id' => :'String', :'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::Marketing::Events::MarketingEventPublicReadResponse` 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::Marketing::Events::MarketingEventPublicReadResponse`. 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?(:'registrants') self.registrants = attributes[:'registrants'] end if attributes.key?(:'event_organizer') self.event_organizer = attributes[:'event_organizer'] end if attributes.key?(:'event_url') self.event_url = attributes[:'event_url'] end if attributes.key?(:'attendees') self.attendees = attributes[:'attendees'] end if attributes.key?(:'event_type') self.event_type = attributes[:'event_type'] end if attributes.key?(:'event_completed') self.event_completed = attributes[:'event_completed'] end if attributes.key?(:'end_date_time') self.end_date_time = attributes[:'end_date_time'] end if attributes.key?(:'no_shows') self.no_shows = attributes[:'no_shows'] end if attributes.key?(:'cancellations') self.cancellations = attributes[:'cancellations'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'start_date_time') self.start_date_time = attributes[:'start_date_time'] end if attributes.key?(:'custom_properties') if (value = attributes[:'custom_properties']).is_a?(Array) self.custom_properties = value end end if attributes.key?(:'event_cancelled') self.event_cancelled = attributes[:'event_cancelled'] end if attributes.key?(:'external_event_id') self.external_event_id = attributes[:'external_event_id'] end if attributes.key?(:'event_description') self.event_description = attributes[:'event_description'] end if attributes.key?(:'event_name') self.event_name = attributes[:'event_name'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'object_id') self.object_id = attributes[:'object_id'] 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 @registrants.nil? invalid_properties.push('invalid value for "registrants", registrants cannot be nil.') end if @event_organizer.nil? invalid_properties.push('invalid value for "event_organizer", event_organizer cannot be nil.') end if @attendees.nil? invalid_properties.push('invalid value for "attendees", attendees cannot be nil.') end if @no_shows.nil? invalid_properties.push('invalid value for "no_shows", no_shows cannot be nil.') end if @cancellations.nil? invalid_properties.push('invalid value for "cancellations", cancellations cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @external_event_id.nil? invalid_properties.push('invalid value for "external_event_id", external_event_id cannot be nil.') end if @event_name.nil? invalid_properties.push('invalid value for "event_name", event_name cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id 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 @registrants.nil? return false if @event_organizer.nil? return false if @attendees.nil? return false if @no_shows.nil? return false if @cancellations.nil? return false if @created_at.nil? return false if @external_event_id.nil? return false if @event_name.nil? return false if @id.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 && registrants == o.registrants && event_organizer == o.event_organizer && event_url == o.event_url && attendees == o.attendees && event_type == o.event_type && event_completed == o.event_completed && end_date_time == o.end_date_time && no_shows == o.no_shows && cancellations == o.cancellations && created_at == o.created_at && start_date_time == o.start_date_time && custom_properties == o.custom_properties && event_cancelled == o.event_cancelled && external_event_id == o.external_event_id && event_description == o.event_description && event_name == o.event_name && id == o.id && object_id == o.object_id && 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 [registrants, event_organizer, event_url, attendees, event_type, event_completed, end_date_time, no_shows, cancellations, created_at, start_date_time, custom_properties, event_cancelled, external_event_id, event_description, event_name, id, object_id, 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::Marketing::Events.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/marketing/events/models/marketing_event_public_default_response_v2.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_public_default_response_v2.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventPublicDefaultResponseV2 attr_accessor :event_organizer attr_accessor :event_url attr_accessor :app_info attr_accessor :event_type attr_accessor :event_completed attr_accessor :end_date_time attr_accessor :created_at attr_accessor :start_date_time attr_accessor :custom_properties attr_accessor :event_cancelled attr_accessor :event_description attr_accessor :event_name attr_accessor :object_id attr_accessor :updated_at # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'event_organizer' => :'eventOrganizer', :'event_url' => :'eventUrl', :'app_info' => :'appInfo', :'event_type' => :'eventType', :'event_completed' => :'eventCompleted', :'end_date_time' => :'endDateTime', :'created_at' => :'createdAt', :'start_date_time' => :'startDateTime', :'custom_properties' => :'customProperties', :'event_cancelled' => :'eventCancelled', :'event_description' => :'eventDescription', :'event_name' => :'eventName', :'object_id' => :'objectId', :'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 { :'event_organizer' => :'String', :'event_url' => :'String', :'app_info' => :'AppInfo', :'event_type' => :'String', :'event_completed' => :'Boolean', :'end_date_time' => :'Time', :'created_at' => :'Time', :'start_date_time' => :'Time', :'custom_properties' => :'Array<CrmPropertyWrapper>', :'event_cancelled' => :'Boolean', :'event_description' => :'String', :'event_name' => :'String', :'object_id' => :'String', :'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::Marketing::Events::MarketingEventPublicDefaultResponseV2` 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::Marketing::Events::MarketingEventPublicDefaultResponseV2`. 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?(:'event_organizer') self.event_organizer = attributes[:'event_organizer'] end if attributes.key?(:'event_url') self.event_url = attributes[:'event_url'] end if attributes.key?(:'app_info') self.app_info = attributes[:'app_info'] end if attributes.key?(:'event_type') self.event_type = attributes[:'event_type'] end if attributes.key?(:'event_completed') self.event_completed = attributes[:'event_completed'] end if attributes.key?(:'end_date_time') self.end_date_time = attributes[:'end_date_time'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'start_date_time') self.start_date_time = attributes[:'start_date_time'] end if attributes.key?(:'custom_properties') if (value = attributes[:'custom_properties']).is_a?(Array) self.custom_properties = value end end if attributes.key?(:'event_cancelled') self.event_cancelled = attributes[:'event_cancelled'] end if attributes.key?(:'event_description') self.event_description = attributes[:'event_description'] end if attributes.key?(:'event_name') self.event_name = attributes[:'event_name'] end if attributes.key?(:'object_id') self.object_id = attributes[:'object_id'] 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 @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @custom_properties.nil? invalid_properties.push('invalid value for "custom_properties", custom_properties cannot be nil.') end if @event_name.nil? invalid_properties.push('invalid value for "event_name", event_name cannot be nil.') end if @object_id.nil? invalid_properties.push('invalid value for "object_id", object_id 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 @created_at.nil? return false if @custom_properties.nil? return false if @event_name.nil? return false if @object_id.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 && event_organizer == o.event_organizer && event_url == o.event_url && app_info == o.app_info && event_type == o.event_type && event_completed == o.event_completed && end_date_time == o.end_date_time && created_at == o.created_at && start_date_time == o.start_date_time && custom_properties == o.custom_properties && event_cancelled == o.event_cancelled && event_description == o.event_description && event_name == o.event_name && object_id == o.object_id && 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 [event_organizer, event_url, app_info, event_type, event_completed, end_date_time, created_at, start_date_time, custom_properties, event_cancelled, event_description, event_name, object_id, 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::Marketing::Events.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/marketing/events/models/error_detail.rb
lib/hubspot/codegen/marketing/events/models/error_detail.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events 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::Marketing::Events::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::Marketing::Events::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::Marketing::Events.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/marketing/events/models/batch_input_marketing_event_subscriber.rb
lib/hubspot/codegen/marketing/events/models/batch_input_marketing_event_subscriber.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchInputMarketingEventSubscriber # List of HubSpot contacts to subscribe to the marketing event 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<MarketingEventSubscriber>' } 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::Marketing::Events::BatchInputMarketingEventSubscriber` 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::Marketing::Events::BatchInputMarketingEventSubscriber`. 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::Marketing::Events.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/marketing/events/models/forward_paging.rb
lib/hubspot/codegen/marketing/events/models/forward_paging.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events 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::Marketing::Events::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::Marketing::Events::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::Marketing::Events.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/marketing/events/models/batch_input_marketing_event_email_subscriber.rb
lib/hubspot/codegen/marketing/events/models/batch_input_marketing_event_email_subscriber.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchInputMarketingEventEmailSubscriber # List of marketing event details to create or update 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<MarketingEventEmailSubscriber>' } 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::Marketing::Events::BatchInputMarketingEventEmailSubscriber` 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::Marketing::Events::BatchInputMarketingEventEmailSubscriber`. 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::Marketing::Events.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/marketing/events/models/participation_properties.rb
lib/hubspot/codegen/marketing/events/models/participation_properties.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class ParticipationProperties attr_accessor :occurred_at attr_accessor :attendance_percentage attr_accessor :attendance_state attr_accessor :attendance_duration_seconds 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 { :'occurred_at' => :'occurredAt', :'attendance_percentage' => :'attendancePercentage', :'attendance_state' => :'attendanceState', :'attendance_duration_seconds' => :'attendanceDurationSeconds' } 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 { :'occurred_at' => :'Integer', :'attendance_percentage' => :'String', :'attendance_state' => :'String', :'attendance_duration_seconds' => :'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::Marketing::Events::ParticipationProperties` 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::Marketing::Events::ParticipationProperties`. 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?(:'occurred_at') self.occurred_at = attributes[:'occurred_at'] end if attributes.key?(:'attendance_percentage') self.attendance_percentage = attributes[:'attendance_percentage'] end if attributes.key?(:'attendance_state') self.attendance_state = attributes[:'attendance_state'] end if attributes.key?(:'attendance_duration_seconds') self.attendance_duration_seconds = attributes[:'attendance_duration_seconds'] 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 @occurred_at.nil? invalid_properties.push('invalid value for "occurred_at", occurred_at cannot be nil.') end if @attendance_state.nil? invalid_properties.push('invalid value for "attendance_state", attendance_state 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 @occurred_at.nil? return false if @attendance_state.nil? attendance_state_validator = EnumAttributeValidator.new('String', ["REGISTERED", "ATTENDED", "CANCELLED", "EMPTY", "NO_SHOW"]) return false unless attendance_state_validator.valid?(@attendance_state) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] attendance_state Object to be assigned def attendance_state=(attendance_state) validator = EnumAttributeValidator.new('String', ["REGISTERED", "ATTENDED", "CANCELLED", "EMPTY", "NO_SHOW"]) unless validator.valid?(attendance_state) fail ArgumentError, "invalid value for \"attendance_state\", must be one of #{validator.allowable_values}." end @attendance_state = attendance_state 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 && occurred_at == o.occurred_at && attendance_percentage == o.attendance_percentage && attendance_state == o.attendance_state && attendance_duration_seconds == o.attendance_duration_seconds 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 [occurred_at, attendance_percentage, attendance_state, attendance_duration_seconds].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::Marketing::Events.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/marketing/events/models/participation_breakdown.rb
lib/hubspot/codegen/marketing/events/models/participation_breakdown.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class ParticipationBreakdown attr_accessor :associations attr_accessor :created_at attr_accessor :id attr_accessor :properties # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'associations' => :'associations', :'created_at' => :'createdAt', :'id' => :'id', :'properties' => :'properties' } 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 { :'associations' => :'ParticipationAssociations', :'created_at' => :'Time', :'id' => :'String', :'properties' => :'ParticipationProperties' } 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::Marketing::Events::ParticipationBreakdown` 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::Marketing::Events::ParticipationBreakdown`. 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?(:'associations') self.associations = attributes[:'associations'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'properties') self.properties = attributes[:'properties'] 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 @associations.nil? invalid_properties.push('invalid value for "associations", associations cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @properties.nil? invalid_properties.push('invalid value for "properties", properties 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 @associations.nil? return false if @created_at.nil? return false if @id.nil? return false if @properties.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 && associations == o.associations && created_at == o.created_at && id == o.id && properties == o.properties 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 [associations, created_at, id, properties].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::Marketing::Events.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/marketing/events/models/marketing_event_subscriber.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_subscriber.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventSubscriber attr_accessor :vid attr_accessor :properties # Timestamp in milliseconds at which the contact subscribed to the event. attr_accessor :interaction_date_time # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'vid' => :'vid', :'properties' => :'properties', :'interaction_date_time' => :'interactionDateTime' } 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 { :'vid' => :'Integer', :'properties' => :'Hash<String, String>', :'interaction_date_time' => :'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::Marketing::Events::MarketingEventSubscriber` 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::Marketing::Events::MarketingEventSubscriber`. 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?(:'vid') self.vid = attributes[:'vid'] end if attributes.key?(:'properties') if (value = attributes[:'properties']).is_a?(Hash) self.properties = value end end if attributes.key?(:'interaction_date_time') self.interaction_date_time = attributes[:'interaction_date_time'] 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 @interaction_date_time.nil? invalid_properties.push('invalid value for "interaction_date_time", interaction_date_time 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 @interaction_date_time.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 && vid == o.vid && properties == o.properties && interaction_date_time == o.interaction_date_time 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 [vid, properties, interaction_date_time].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::Marketing::Events.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/marketing/events/models/batch_response_marketing_event_public_default_response_v2_with_errors.rb
lib/hubspot/codegen/marketing/events/models/batch_response_marketing_event_public_default_response_v2_with_errors.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchResponseMarketingEventPublicDefaultResponseV2WithErrors attr_accessor :completed_at attr_accessor :num_errors attr_accessor :requested_at attr_accessor :started_at attr_accessor :links attr_accessor :results attr_accessor :errors 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<MarketingEventPublicDefaultResponseV2>', :'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::Marketing::Events::BatchResponseMarketingEventPublicDefaultResponseV2WithErrors` 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::Marketing::Events::BatchResponseMarketingEventPublicDefaultResponseV2WithErrors`. 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::Marketing::Events.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/marketing/events/models/marketing_event_public_update_request_v2.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_public_update_request_v2.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventPublicUpdateRequestV2 attr_accessor :start_date_time attr_accessor :custom_properties attr_accessor :event_cancelled attr_accessor :event_organizer attr_accessor :event_url attr_accessor :event_description attr_accessor :event_name attr_accessor :event_type attr_accessor :end_date_time # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'start_date_time' => :'startDateTime', :'custom_properties' => :'customProperties', :'event_cancelled' => :'eventCancelled', :'event_organizer' => :'eventOrganizer', :'event_url' => :'eventUrl', :'event_description' => :'eventDescription', :'event_name' => :'eventName', :'event_type' => :'eventType', :'end_date_time' => :'endDateTime' } 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 { :'start_date_time' => :'Time', :'custom_properties' => :'Array<PropertyValue>', :'event_cancelled' => :'Boolean', :'event_organizer' => :'String', :'event_url' => :'String', :'event_description' => :'String', :'event_name' => :'String', :'event_type' => :'String', :'end_date_time' => :'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::Marketing::Events::MarketingEventPublicUpdateRequestV2` 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::Marketing::Events::MarketingEventPublicUpdateRequestV2`. 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?(:'start_date_time') self.start_date_time = attributes[:'start_date_time'] end if attributes.key?(:'custom_properties') if (value = attributes[:'custom_properties']).is_a?(Array) self.custom_properties = value end end if attributes.key?(:'event_cancelled') self.event_cancelled = attributes[:'event_cancelled'] end if attributes.key?(:'event_organizer') self.event_organizer = attributes[:'event_organizer'] end if attributes.key?(:'event_url') self.event_url = attributes[:'event_url'] end if attributes.key?(:'event_description') self.event_description = attributes[:'event_description'] end if attributes.key?(:'event_name') self.event_name = attributes[:'event_name'] end if attributes.key?(:'event_type') self.event_type = attributes[:'event_type'] end if attributes.key?(:'end_date_time') self.end_date_time = attributes[:'end_date_time'] 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 @custom_properties.nil? invalid_properties.push('invalid value for "custom_properties", custom_properties 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 @custom_properties.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 && start_date_time == o.start_date_time && custom_properties == o.custom_properties && event_cancelled == o.event_cancelled && event_organizer == o.event_organizer && event_url == o.event_url && event_description == o.event_description && event_name == o.event_name && event_type == o.event_type && end_date_time == o.end_date_time 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 [start_date_time, custom_properties, event_cancelled, event_organizer, event_url, event_description, event_name, event_type, end_date_time].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::Marketing::Events.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/marketing/events/models/event_detail_settings.rb
lib/hubspot/codegen/marketing/events/models/event_detail_settings.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class EventDetailSettings # The id of the application the settings are for attr_accessor :app_id # The url that will be used to fetch marketing event details by id attr_accessor :event_details_url # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'app_id' => :'appId', :'event_details_url' => :'eventDetailsUrl' } 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 { :'app_id' => :'Integer', :'event_details_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::Marketing::Events::EventDetailSettings` 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::Marketing::Events::EventDetailSettings`. 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?(:'app_id') self.app_id = attributes[:'app_id'] end if attributes.key?(:'event_details_url') self.event_details_url = attributes[:'event_details_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 @app_id.nil? invalid_properties.push('invalid value for "app_id", app_id cannot be nil.') end if @event_details_url.nil? invalid_properties.push('invalid value for "event_details_url", event_details_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 @app_id.nil? return false if @event_details_url.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 && app_id == o.app_id && event_details_url == o.event_details_url 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 [app_id, event_details_url].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::Marketing::Events.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/marketing/events/models/crm_property_wrapper.rb
lib/hubspot/codegen/marketing/events/models/crm_property_wrapper.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class CrmPropertyWrapper attr_accessor :name attr_accessor :value # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'name' => :'name', :'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 { :'name' => :'String', :'value' => :'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::Marketing::Events::CrmPropertyWrapper` 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::Marketing::Events::CrmPropertyWrapper`. 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?(:'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 @name.nil? invalid_properties.push('invalid value for "name", name 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 @name.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 && name == o.name && 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 [name, 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::Marketing::Events.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/marketing/events/models/property_value.rb
lib/hubspot/codegen/marketing/events/models/property_value.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class PropertyValue # attr_accessor :source_id # attr_accessor :selected_by_user # attr_accessor :source_label # attr_accessor :source attr_accessor :updated_by_user_id attr_accessor :persistence_timestamp # Source metadata encoded as a base64 string. For example: `ZXhhbXBsZSBzdHJpbmc=` attr_accessor :source_metadata attr_accessor :data_sensitivity # attr_accessor :source_vid attr_accessor :unit # attr_accessor :request_id attr_accessor :is_encrypted # attr_accessor :name attr_accessor :use_timestamp_as_persistence_timestamp # attr_accessor :value # attr_accessor :selected_by_user_timestamp # attr_accessor :timestamp attr_accessor :is_large_value 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 { :'source_id' => :'sourceId', :'selected_by_user' => :'selectedByUser', :'source_label' => :'sourceLabel', :'source' => :'source', :'updated_by_user_id' => :'updatedByUserId', :'persistence_timestamp' => :'persistenceTimestamp', :'source_metadata' => :'sourceMetadata', :'data_sensitivity' => :'dataSensitivity', :'source_vid' => :'sourceVid', :'unit' => :'unit', :'request_id' => :'requestId', :'is_encrypted' => :'isEncrypted', :'name' => :'name', :'use_timestamp_as_persistence_timestamp' => :'useTimestampAsPersistenceTimestamp', :'value' => :'value', :'selected_by_user_timestamp' => :'selectedByUserTimestamp', :'timestamp' => :'timestamp', :'is_large_value' => :'isLargeValue' } 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 { :'source_id' => :'String', :'selected_by_user' => :'Boolean', :'source_label' => :'String', :'source' => :'String', :'updated_by_user_id' => :'Integer', :'persistence_timestamp' => :'Integer', :'source_metadata' => :'String', :'data_sensitivity' => :'String', :'source_vid' => :'Array<Integer>', :'unit' => :'String', :'request_id' => :'String', :'is_encrypted' => :'Boolean', :'name' => :'String', :'use_timestamp_as_persistence_timestamp' => :'Boolean', :'value' => :'String', :'selected_by_user_timestamp' => :'Integer', :'timestamp' => :'Integer', :'is_large_value' => :'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::Marketing::Events::PropertyValue` 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::Marketing::Events::PropertyValue`. 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?(:'source_id') self.source_id = attributes[:'source_id'] end if attributes.key?(:'selected_by_user') self.selected_by_user = attributes[:'selected_by_user'] end if attributes.key?(:'source_label') self.source_label = attributes[:'source_label'] end if attributes.key?(:'source') self.source = attributes[:'source'] end if attributes.key?(:'updated_by_user_id') self.updated_by_user_id = attributes[:'updated_by_user_id'] end if attributes.key?(:'persistence_timestamp') self.persistence_timestamp = attributes[:'persistence_timestamp'] end if attributes.key?(:'source_metadata') self.source_metadata = attributes[:'source_metadata'] end if attributes.key?(:'data_sensitivity') self.data_sensitivity = attributes[:'data_sensitivity'] end if attributes.key?(:'source_vid') if (value = attributes[:'source_vid']).is_a?(Array) self.source_vid = value end end if attributes.key?(:'unit') self.unit = attributes[:'unit'] end if attributes.key?(:'request_id') self.request_id = attributes[:'request_id'] end if attributes.key?(:'is_encrypted') self.is_encrypted = attributes[:'is_encrypted'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'use_timestamp_as_persistence_timestamp') self.use_timestamp_as_persistence_timestamp = attributes[:'use_timestamp_as_persistence_timestamp'] end if attributes.key?(:'value') self.value = attributes[:'value'] end if attributes.key?(:'selected_by_user_timestamp') self.selected_by_user_timestamp = attributes[:'selected_by_user_timestamp'] end if attributes.key?(:'timestamp') self.timestamp = attributes[:'timestamp'] end if attributes.key?(:'is_large_value') self.is_large_value = attributes[:'is_large_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 @source_id.nil? invalid_properties.push('invalid value for "source_id", source_id cannot be nil.') end if @selected_by_user.nil? invalid_properties.push('invalid value for "selected_by_user", selected_by_user cannot be nil.') end if @source_label.nil? invalid_properties.push('invalid value for "source_label", source_label cannot be nil.') end if @source.nil? invalid_properties.push('invalid value for "source", source cannot be nil.') end if @source_metadata.nil? invalid_properties.push('invalid value for "source_metadata", source_metadata cannot be nil.') end if @data_sensitivity.nil? invalid_properties.push('invalid value for "data_sensitivity", data_sensitivity cannot be nil.') end if @source_vid.nil? invalid_properties.push('invalid value for "source_vid", source_vid cannot be nil.') end if @unit.nil? invalid_properties.push('invalid value for "unit", unit cannot be nil.') end if @request_id.nil? invalid_properties.push('invalid value for "request_id", request_id cannot be nil.') end if @is_encrypted.nil? invalid_properties.push('invalid value for "is_encrypted", is_encrypted cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @value.nil? invalid_properties.push('invalid value for "value", value cannot be nil.') end if @selected_by_user_timestamp.nil? invalid_properties.push('invalid value for "selected_by_user_timestamp", selected_by_user_timestamp cannot be nil.') end if @timestamp.nil? invalid_properties.push('invalid value for "timestamp", timestamp 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 @source_id.nil? return false if @selected_by_user.nil? return false if @source_label.nil? return false if @source.nil? source_validator = EnumAttributeValidator.new('String', ["UNKNOWN", "IMPORT", "API", "FORM", "ANALYTICS", "MIGRATION", "SALESFORCE", "INTEGRATION", "CONTACTS_WEB", "WAL_INCREMENTAL", "TASK", "EMAIL", "WORKFLOWS", "CALCULATED", "SOCIAL", "BATCH_UPDATE", "SIGNALS", "BIDEN", "DEFAULT", "COMPANIES", "DEALS", "ASSISTS", "PRESENTATIONS", "TALLY", "SIDEKICK", "CRM_UI", "MERGE_CONTACTS", "PORTAL_USER_ASSOCIATOR", "INTEGRATIONS_PLATFORM", "BCC_TO_CRM", "FORWARD_TO_CRM", "ENGAGEMENTS", "SALES", "HEISENBERG", "LEADIN", "GMAIL_INTEGRATION", "ACADEMY", "SALES_MESSAGES", "AVATARS_SERVICE", "MERGE_COMPANIES", "SEQUENCES", "COMPANY_FAMILIES", "MOBILE_IOS", "MOBILE_ANDROID", "CONTACTS", "ASSOCIATIONS", "EXTENSION", "SUCCESS", "BOT", "INTEGRATIONS_SYNC", "AUTOMATION_PLATFORM", "CONVERSATIONS", "EMAIL_INTEGRATION", "CONTENT_MEMBERSHIP", "QUOTES", "BET_ASSIGNMENT", "QUOTAS", "BET_CRM_CONNECTOR", "MEETINGS", "MERGE_OBJECTS", "RECYCLING_BIN", "ADS", "AI_GROUP", "COMMUNICATOR", "SETTINGS", "PROPERTY_SETTINGS", "PIPELINE_SETTINGS", "COMPANY_INSIGHTS", "BEHAVIORAL_EVENTS", "PAYMENTS", "GOALS", "PORTAL_OBJECT_SYNC", "APPROVALS", "FILE_MANAGER", "MARKETPLACE", "INTERNAL_PROCESSING", "FORECASTING", "SLACK_INTEGRATION", "CRM_UI_BULK_ACTION", "WORKFLOW_CONTACT_DELETE_ACTION", "ACCEPTANCE_TEST", "PLAYBOOKS", "CHATSPOT", "FLYWHEEL_PRODUCT_DATA_SYNC", "HELP_DESK", "BILLING", "DATA_ENRICHMENT", "AUTOMATION_JOURNEY", "MICROAPPS", "INTENT", "PROSPECTING_AGENT", "CENTRAL_EXCHANGE_RATES"]) return false unless source_validator.valid?(@source) return false if @source_metadata.nil? return false if @data_sensitivity.nil? data_sensitivity_validator = EnumAttributeValidator.new('String', ["none", "standard", "high"]) return false unless data_sensitivity_validator.valid?(@data_sensitivity) return false if @source_vid.nil? return false if @unit.nil? return false if @request_id.nil? return false if @is_encrypted.nil? return false if @name.nil? return false if @value.nil? return false if @selected_by_user_timestamp.nil? return false if @timestamp.nil? true end # Custom attribute writer method checking allowed values (enum). # @param [Object] source Object to be assigned def source=(source) validator = EnumAttributeValidator.new('String', ["UNKNOWN", "IMPORT", "API", "FORM", "ANALYTICS", "MIGRATION", "SALESFORCE", "INTEGRATION", "CONTACTS_WEB", "WAL_INCREMENTAL", "TASK", "EMAIL", "WORKFLOWS", "CALCULATED", "SOCIAL", "BATCH_UPDATE", "SIGNALS", "BIDEN", "DEFAULT", "COMPANIES", "DEALS", "ASSISTS", "PRESENTATIONS", "TALLY", "SIDEKICK", "CRM_UI", "MERGE_CONTACTS", "PORTAL_USER_ASSOCIATOR", "INTEGRATIONS_PLATFORM", "BCC_TO_CRM", "FORWARD_TO_CRM", "ENGAGEMENTS", "SALES", "HEISENBERG", "LEADIN", "GMAIL_INTEGRATION", "ACADEMY", "SALES_MESSAGES", "AVATARS_SERVICE", "MERGE_COMPANIES", "SEQUENCES", "COMPANY_FAMILIES", "MOBILE_IOS", "MOBILE_ANDROID", "CONTACTS", "ASSOCIATIONS", "EXTENSION", "SUCCESS", "BOT", "INTEGRATIONS_SYNC", "AUTOMATION_PLATFORM", "CONVERSATIONS", "EMAIL_INTEGRATION", "CONTENT_MEMBERSHIP", "QUOTES", "BET_ASSIGNMENT", "QUOTAS", "BET_CRM_CONNECTOR", "MEETINGS", "MERGE_OBJECTS", "RECYCLING_BIN", "ADS", "AI_GROUP", "COMMUNICATOR", "SETTINGS", "PROPERTY_SETTINGS", "PIPELINE_SETTINGS", "COMPANY_INSIGHTS", "BEHAVIORAL_EVENTS", "PAYMENTS", "GOALS", "PORTAL_OBJECT_SYNC", "APPROVALS", "FILE_MANAGER", "MARKETPLACE", "INTERNAL_PROCESSING", "FORECASTING", "SLACK_INTEGRATION", "CRM_UI_BULK_ACTION", "WORKFLOW_CONTACT_DELETE_ACTION", "ACCEPTANCE_TEST", "PLAYBOOKS", "CHATSPOT", "FLYWHEEL_PRODUCT_DATA_SYNC", "HELP_DESK", "BILLING", "DATA_ENRICHMENT", "AUTOMATION_JOURNEY", "MICROAPPS", "INTENT", "PROSPECTING_AGENT", "CENTRAL_EXCHANGE_RATES"]) unless validator.valid?(source) fail ArgumentError, "invalid value for \"source\", must be one of #{validator.allowable_values}." end @source = source end # Custom attribute writer method checking allowed values (enum). # @param [Object] data_sensitivity Object to be assigned def data_sensitivity=(data_sensitivity) validator = EnumAttributeValidator.new('String', ["none", "standard", "high"]) unless validator.valid?(data_sensitivity) fail ArgumentError, "invalid value for \"data_sensitivity\", must be one of #{validator.allowable_values}." end @data_sensitivity = data_sensitivity 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 && source_id == o.source_id && selected_by_user == o.selected_by_user && source_label == o.source_label && source == o.source && updated_by_user_id == o.updated_by_user_id && persistence_timestamp == o.persistence_timestamp && source_metadata == o.source_metadata && data_sensitivity == o.data_sensitivity && source_vid == o.source_vid && unit == o.unit && request_id == o.request_id && is_encrypted == o.is_encrypted && name == o.name && use_timestamp_as_persistence_timestamp == o.use_timestamp_as_persistence_timestamp && value == o.value && selected_by_user_timestamp == o.selected_by_user_timestamp && timestamp == o.timestamp && is_large_value == o.is_large_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 [source_id, selected_by_user, source_label, source, updated_by_user_id, persistence_timestamp, source_metadata, data_sensitivity, source_vid, unit, request_id, is_encrypted, name, use_timestamp_as_persistence_timestamp, value, selected_by_user_timestamp, timestamp, is_large_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::Marketing::Events.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/marketing/events/models/batch_response_marketing_event_public_default_response.rb
lib/hubspot/codegen/marketing/events/models/batch_response_marketing_event_public_default_response.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchResponseMarketingEventPublicDefaultResponse # attr_accessor :completed_at # attr_accessor :num_errors # attr_accessor :requested_at # attr_accessor :started_at # attr_accessor :links # attr_accessor :results # attr_accessor :errors # 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<MarketingEventPublicDefaultResponse>', :'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::Marketing::Events::BatchResponseMarketingEventPublicDefaultResponse` 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::Marketing::Events::BatchResponseMarketingEventPublicDefaultResponse`. 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::Marketing::Events.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/marketing/events/models/participation_associations.rb
lib/hubspot/codegen/marketing/events/models/participation_associations.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class ParticipationAssociations attr_accessor :marketing_event attr_accessor :contact # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'marketing_event' => :'marketingEvent', :'contact' => :'contact' } 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 { :'marketing_event' => :'MarketingEventAssociation', :'contact' => :'ContactAssociation' } 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::Marketing::Events::ParticipationAssociations` 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::Marketing::Events::ParticipationAssociations`. 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?(:'marketing_event') self.marketing_event = attributes[:'marketing_event'] end if attributes.key?(:'contact') self.contact = attributes[:'contact'] 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 @marketing_event.nil? invalid_properties.push('invalid value for "marketing_event", marketing_event cannot be nil.') end if @contact.nil? invalid_properties.push('invalid value for "contact", contact 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 @marketing_event.nil? return false if @contact.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 && marketing_event == o.marketing_event && contact == o.contact 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 [marketing_event, contact].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::Marketing::Events.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/marketing/events/models/batch_response_marketing_event_public_default_response_v2.rb
lib/hubspot/codegen/marketing/events/models/batch_response_marketing_event_public_default_response_v2.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class BatchResponseMarketingEventPublicDefaultResponseV2 attr_accessor :completed_at attr_accessor :requested_at attr_accessor :started_at attr_accessor :links attr_accessor :results 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<MarketingEventPublicDefaultResponseV2>', :'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::Marketing::Events::BatchResponseMarketingEventPublicDefaultResponseV2` 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::Marketing::Events::BatchResponseMarketingEventPublicDefaultResponseV2`. 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::Marketing::Events.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/marketing/events/models/app_info.rb
lib/hubspot/codegen/marketing/events/models/app_info.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class AppInfo attr_accessor :name attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'name' => :'name', :'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 { :'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::Marketing::Events::AppInfo` 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::Marketing::Events::AppInfo`. 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?(:'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 @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 && 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 [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::Marketing::Events.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/marketing/events/models/search_public_response_wrapper.rb
lib/hubspot/codegen/marketing/events/models/search_public_response_wrapper.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class SearchPublicResponseWrapper attr_accessor :external_account_id attr_accessor :external_event_id attr_accessor :app_id attr_accessor :object_id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'external_account_id' => :'externalAccountId', :'external_event_id' => :'externalEventId', :'app_id' => :'appId', :'object_id' => :'objectId' } 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 { :'external_account_id' => :'String', :'external_event_id' => :'String', :'app_id' => :'Integer', :'object_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::Marketing::Events::SearchPublicResponseWrapper` 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::Marketing::Events::SearchPublicResponseWrapper`. 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?(:'external_account_id') self.external_account_id = attributes[:'external_account_id'] end if attributes.key?(:'external_event_id') self.external_event_id = attributes[:'external_event_id'] end if attributes.key?(:'app_id') self.app_id = attributes[:'app_id'] end if attributes.key?(:'object_id') self.object_id = attributes[:'object_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 @external_account_id.nil? invalid_properties.push('invalid value for "external_account_id", external_account_id cannot be nil.') end if @external_event_id.nil? invalid_properties.push('invalid value for "external_event_id", external_event_id cannot be nil.') end if @app_id.nil? invalid_properties.push('invalid value for "app_id", app_id cannot be nil.') end if @object_id.nil? invalid_properties.push('invalid value for "object_id", object_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 @external_account_id.nil? return false if @external_event_id.nil? return false if @app_id.nil? return false if @object_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 && external_account_id == o.external_account_id && external_event_id == o.external_event_id && app_id == o.app_id && object_id == o.object_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 [external_account_id, external_event_id, app_id, object_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::Marketing::Events.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/marketing/events/models/error.rb
lib/hubspot/codegen/marketing/events/models/error.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events 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::Marketing::Events::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::Marketing::Events::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::Marketing::Events.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/marketing/events/models/collection_response_with_total_public_list_no_paging.rb
lib/hubspot/codegen/marketing/events/models/collection_response_with_total_public_list_no_paging.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class CollectionResponseWithTotalPublicListNoPaging attr_accessor :total attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'total' => :'total', :'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', :'results' => :'Array<PublicList>' } 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::Marketing::Events::CollectionResponseWithTotalPublicListNoPaging` 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::Marketing::Events::CollectionResponseWithTotalPublicListNoPaging`. 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?(:'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 && 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, 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::Marketing::Events.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/marketing/events/models/marketing_event_public_read_response_v2.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_public_read_response_v2.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventPublicReadResponseV2 attr_accessor :registrants attr_accessor :event_organizer attr_accessor :event_url attr_accessor :attendees attr_accessor :app_info attr_accessor :event_type attr_accessor :event_completed attr_accessor :end_date_time attr_accessor :no_shows attr_accessor :cancellations attr_accessor :created_at attr_accessor :start_date_time attr_accessor :custom_properties attr_accessor :event_cancelled attr_accessor :external_event_id attr_accessor :event_status attr_accessor :event_description attr_accessor :event_name attr_accessor :object_id attr_accessor :updated_at # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'registrants' => :'registrants', :'event_organizer' => :'eventOrganizer', :'event_url' => :'eventUrl', :'attendees' => :'attendees', :'app_info' => :'appInfo', :'event_type' => :'eventType', :'event_completed' => :'eventCompleted', :'end_date_time' => :'endDateTime', :'no_shows' => :'noShows', :'cancellations' => :'cancellations', :'created_at' => :'createdAt', :'start_date_time' => :'startDateTime', :'custom_properties' => :'customProperties', :'event_cancelled' => :'eventCancelled', :'external_event_id' => :'externalEventId', :'event_status' => :'eventStatus', :'event_description' => :'eventDescription', :'event_name' => :'eventName', :'object_id' => :'objectId', :'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 { :'registrants' => :'Integer', :'event_organizer' => :'String', :'event_url' => :'String', :'attendees' => :'Integer', :'app_info' => :'AppInfo', :'event_type' => :'String', :'event_completed' => :'Boolean', :'end_date_time' => :'Time', :'no_shows' => :'Integer', :'cancellations' => :'Integer', :'created_at' => :'Time', :'start_date_time' => :'Time', :'custom_properties' => :'Array<CrmPropertyWrapper>', :'event_cancelled' => :'Boolean', :'external_event_id' => :'String', :'event_status' => :'String', :'event_description' => :'String', :'event_name' => :'String', :'object_id' => :'String', :'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::Marketing::Events::MarketingEventPublicReadResponseV2` 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::Marketing::Events::MarketingEventPublicReadResponseV2`. 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?(:'registrants') self.registrants = attributes[:'registrants'] end if attributes.key?(:'event_organizer') self.event_organizer = attributes[:'event_organizer'] end if attributes.key?(:'event_url') self.event_url = attributes[:'event_url'] end if attributes.key?(:'attendees') self.attendees = attributes[:'attendees'] end if attributes.key?(:'app_info') self.app_info = attributes[:'app_info'] end if attributes.key?(:'event_type') self.event_type = attributes[:'event_type'] end if attributes.key?(:'event_completed') self.event_completed = attributes[:'event_completed'] end if attributes.key?(:'end_date_time') self.end_date_time = attributes[:'end_date_time'] end if attributes.key?(:'no_shows') self.no_shows = attributes[:'no_shows'] end if attributes.key?(:'cancellations') self.cancellations = attributes[:'cancellations'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'start_date_time') self.start_date_time = attributes[:'start_date_time'] end if attributes.key?(:'custom_properties') if (value = attributes[:'custom_properties']).is_a?(Array) self.custom_properties = value end end if attributes.key?(:'event_cancelled') self.event_cancelled = attributes[:'event_cancelled'] end if attributes.key?(:'external_event_id') self.external_event_id = attributes[:'external_event_id'] end if attributes.key?(:'event_status') self.event_status = attributes[:'event_status'] end if attributes.key?(:'event_description') self.event_description = attributes[:'event_description'] end if attributes.key?(:'event_name') self.event_name = attributes[:'event_name'] end if attributes.key?(:'object_id') self.object_id = attributes[:'object_id'] 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 @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @custom_properties.nil? invalid_properties.push('invalid value for "custom_properties", custom_properties cannot be nil.') end if @event_name.nil? invalid_properties.push('invalid value for "event_name", event_name cannot be nil.') end if @object_id.nil? invalid_properties.push('invalid value for "object_id", object_id 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 @created_at.nil? return false if @custom_properties.nil? return false if @event_name.nil? return false if @object_id.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 && registrants == o.registrants && event_organizer == o.event_organizer && event_url == o.event_url && attendees == o.attendees && app_info == o.app_info && event_type == o.event_type && event_completed == o.event_completed && end_date_time == o.end_date_time && no_shows == o.no_shows && cancellations == o.cancellations && created_at == o.created_at && start_date_time == o.start_date_time && custom_properties == o.custom_properties && event_cancelled == o.event_cancelled && external_event_id == o.external_event_id && event_status == o.event_status && event_description == o.event_description && event_name == o.event_name && object_id == o.object_id && 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 [registrants, event_organizer, event_url, attendees, app_info, event_type, event_completed, end_date_time, no_shows, cancellations, created_at, start_date_time, custom_properties, event_cancelled, external_event_id, event_status, event_description, event_name, object_id, 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::Marketing::Events.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/marketing/events/models/subscriber_vid_response.rb
lib/hubspot/codegen/marketing/events/models/subscriber_vid_response.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class SubscriberVidResponse attr_accessor :vid # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'vid' => :'vid' } 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 { :'vid' => :'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::Marketing::Events::SubscriberVidResponse` 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::Marketing::Events::SubscriberVidResponse`. 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?(:'vid') self.vid = attributes[:'vid'] 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 @vid.nil? invalid_properties.push('invalid value for "vid", vid 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 @vid.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 && vid == o.vid 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 [vid].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::Marketing::Events.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/marketing/events/models/marketing_event_external_unique_identifier.rb
lib/hubspot/codegen/marketing/events/models/marketing_event_external_unique_identifier.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Events class MarketingEventExternalUniqueIdentifier # The accountId that is associated with this marketing event in the external event application. attr_accessor :external_account_id # The id of the marketing event in the external event application. attr_accessor :external_event_id # The id of the application that created the marketing event in HubSpot. attr_accessor :app_id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'external_account_id' => :'externalAccountId', :'external_event_id' => :'externalEventId', :'app_id' => :'appId' } 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 { :'external_account_id' => :'String', :'external_event_id' => :'String', :'app_id' => :'Integer' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Marketing::Events::MarketingEventExternalUniqueIdentifier` 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::Marketing::Events::MarketingEventExternalUniqueIdentifier`. 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?(:'external_account_id') self.external_account_id = attributes[:'external_account_id'] end if attributes.key?(:'external_event_id') self.external_event_id = attributes[:'external_event_id'] end if attributes.key?(:'app_id') self.app_id = attributes[:'app_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 @external_account_id.nil? invalid_properties.push('invalid value for "external_account_id", external_account_id cannot be nil.') end if @external_event_id.nil? invalid_properties.push('invalid value for "external_event_id", external_event_id cannot be nil.') end if @app_id.nil? invalid_properties.push('invalid value for "app_id", app_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 @external_account_id.nil? return false if @external_event_id.nil? return false if @app_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 && external_account_id == o.external_account_id && external_event_id == o.external_event_id && app_id == o.app_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 [external_account_id, external_event_id, app_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::Marketing::Events.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/marketing/events/api/subscriber_state_changes_api.rb
lib/hubspot/codegen/marketing/events/api/subscriber_state_changes_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class SubscriberStateChangesApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Record a subscriber state by contact email # Record a subscriber state between multiple HubSpot contacts and a marketing event, using contact email addresses. Note that the contact must already exist in HubSpot; a contact will not be created. The contactProperties field is used only when creating a new contact. These properties will not update existing contacts. # @param external_event_id [String] The id of the marketing event in the external event application # @param subscriber_state [String] The new subscriber state for the HubSpot contacts and the specified marketing event. For example: &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39;. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param batch_input_marketing_event_email_subscriber [BatchInputMarketingEventEmailSubscriber] # @param [Hash] opts the optional parameters # @return [Error] def upsert_by_contact_email(external_event_id, subscriber_state, external_account_id, batch_input_marketing_event_email_subscriber, opts = {}) data, _status_code, _headers = upsert_by_contact_email_with_http_info(external_event_id, subscriber_state, external_account_id, batch_input_marketing_event_email_subscriber, opts) data end # Record a subscriber state by contact email # Record a subscriber state between multiple HubSpot contacts and a marketing event, using contact email addresses. Note that the contact must already exist in HubSpot; a contact will not be created. The contactProperties field is used only when creating a new contact. These properties will not update existing contacts. # @param external_event_id [String] The id of the marketing event in the external event application # @param subscriber_state [String] The new subscriber state for the HubSpot contacts and the specified marketing event. For example: &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39;. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param batch_input_marketing_event_email_subscriber [BatchInputMarketingEventEmailSubscriber] # @param [Hash] opts the optional parameters # @return [Array<(Error, Integer, Hash)>] Error data, response status code and response headers def upsert_by_contact_email_with_http_info(external_event_id, subscriber_state, external_account_id, batch_input_marketing_event_email_subscriber, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SubscriberStateChangesApi.upsert_by_contact_email ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling SubscriberStateChangesApi.upsert_by_contact_email" end # verify the required parameter 'subscriber_state' is set if @api_client.config.client_side_validation && subscriber_state.nil? fail ArgumentError, "Missing the required parameter 'subscriber_state' when calling SubscriberStateChangesApi.upsert_by_contact_email" end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling SubscriberStateChangesApi.upsert_by_contact_email" end # verify the required parameter 'batch_input_marketing_event_email_subscriber' is set if @api_client.config.client_side_validation && batch_input_marketing_event_email_subscriber.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_email_subscriber' when calling SubscriberStateChangesApi.upsert_by_contact_email" end # resource path local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}/{subscriberState}/email-upsert'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)).sub('{' + 'subscriberState' + '}', CGI.escape(subscriber_state.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = external_account_id # 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_marketing_event_email_subscriber) # return_type return_type = opts[:debug_return_type] || 'Error' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"SubscriberStateChangesApi.upsert_by_contact_email", :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: SubscriberStateChangesApi#upsert_by_contact_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Record a subscriber state by contact ID # Record a subscriber state between multiple HubSpot contacts and a marketing event, using HubSpot contact IDs. Note that the contact must already exist in HubSpot; a contact will not be created. # @param external_event_id [String] The id of the marketing event in the external event application # @param subscriber_state [String] The new subscriber state for the HubSpot contacts and the specified marketing event. For example: &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39;. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param batch_input_marketing_event_subscriber [BatchInputMarketingEventSubscriber] # @param [Hash] opts the optional parameters # @return [Error] def upsert_by_contact_id(external_event_id, subscriber_state, external_account_id, batch_input_marketing_event_subscriber, opts = {}) data, _status_code, _headers = upsert_by_contact_id_with_http_info(external_event_id, subscriber_state, external_account_id, batch_input_marketing_event_subscriber, opts) data end # Record a subscriber state by contact ID # Record a subscriber state between multiple HubSpot contacts and a marketing event, using HubSpot contact IDs. Note that the contact must already exist in HubSpot; a contact will not be created. # @param external_event_id [String] The id of the marketing event in the external event application # @param subscriber_state [String] The new subscriber state for the HubSpot contacts and the specified marketing event. For example: &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39;. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param batch_input_marketing_event_subscriber [BatchInputMarketingEventSubscriber] # @param [Hash] opts the optional parameters # @return [Array<(Error, Integer, Hash)>] Error data, response status code and response headers def upsert_by_contact_id_with_http_info(external_event_id, subscriber_state, external_account_id, batch_input_marketing_event_subscriber, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SubscriberStateChangesApi.upsert_by_contact_id ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling SubscriberStateChangesApi.upsert_by_contact_id" end # verify the required parameter 'subscriber_state' is set if @api_client.config.client_side_validation && subscriber_state.nil? fail ArgumentError, "Missing the required parameter 'subscriber_state' when calling SubscriberStateChangesApi.upsert_by_contact_id" end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling SubscriberStateChangesApi.upsert_by_contact_id" end # verify the required parameter 'batch_input_marketing_event_subscriber' is set if @api_client.config.client_side_validation && batch_input_marketing_event_subscriber.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_subscriber' when calling SubscriberStateChangesApi.upsert_by_contact_id" end # resource path local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}/{subscriberState}/upsert'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)).sub('{' + 'subscriberState' + '}', CGI.escape(subscriber_state.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = external_account_id # 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_marketing_event_subscriber) # return_type return_type = opts[:debug_return_type] || 'Error' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"SubscriberStateChangesApi.upsert_by_contact_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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SubscriberStateChangesApi#upsert_by_contact_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/events/api/change_property_api.rb
lib/hubspot/codegen/marketing/events/api/change_property_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class ChangePropertyApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Mark a marketing event as cancelled # Mark a marketing event as cancelled. # @param external_event_id [String] The id of the marketing event in the external event application # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param [Hash] opts the optional parameters # @return [MarketingEventDefaultResponse] def cancel(external_event_id, external_account_id, opts = {}) data, _status_code, _headers = cancel_with_http_info(external_event_id, external_account_id, opts) data end # Mark a marketing event as cancelled # Mark a marketing event as cancelled. # @param external_event_id [String] The id of the marketing event in the external event application # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param [Hash] opts the optional parameters # @return [Array<(MarketingEventDefaultResponse, Integer, Hash)>] MarketingEventDefaultResponse data, response status code and response headers def cancel_with_http_info(external_event_id, external_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChangePropertyApi.cancel ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling ChangePropertyApi.cancel" end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling ChangePropertyApi.cancel" end # resource path local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}/cancel'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = external_account_id # 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] || 'MarketingEventDefaultResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"ChangePropertyApi.cancel", :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: ChangePropertyApi#cancel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Mark a marketing event as completed # Mark a marketing event as completed # @param external_event_id [String] The id of the marketing event in the external event application. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param marketing_event_complete_request_params [MarketingEventCompleteRequestParams] # @param [Hash] opts the optional parameters # @return [MarketingEventDefaultResponse] def complete(external_event_id, external_account_id, marketing_event_complete_request_params, opts = {}) data, _status_code, _headers = complete_with_http_info(external_event_id, external_account_id, marketing_event_complete_request_params, opts) data end # Mark a marketing event as completed # Mark a marketing event as completed # @param external_event_id [String] The id of the marketing event in the external event application. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param marketing_event_complete_request_params [MarketingEventCompleteRequestParams] # @param [Hash] opts the optional parameters # @return [Array<(MarketingEventDefaultResponse, Integer, Hash)>] MarketingEventDefaultResponse data, response status code and response headers def complete_with_http_info(external_event_id, external_account_id, marketing_event_complete_request_params, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChangePropertyApi.complete ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling ChangePropertyApi.complete" end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling ChangePropertyApi.complete" end # verify the required parameter 'marketing_event_complete_request_params' is set if @api_client.config.client_side_validation && marketing_event_complete_request_params.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_complete_request_params' when calling ChangePropertyApi.complete" end # resource path local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}/complete'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = external_account_id # 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(marketing_event_complete_request_params) # return_type return_type = opts[:debug_return_type] || 'MarketingEventDefaultResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"ChangePropertyApi.complete", :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: ChangePropertyApi#complete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/events/api/batch_api.rb
lib/hubspot/codegen/marketing/events/api/batch_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class BatchApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete Multiple Marketing Events by External Ids # Deletes multiple Marketing Events based on externalAccountId, externalEventId, and appId. Only Marketing Events created by the same apps will be deleted; events from other apps cannot be removed by this endpoint. # @param batch_input_marketing_event_external_unique_identifier [BatchInputMarketingEventExternalUniqueIdentifier] # @param [Hash] opts the optional parameters # @return [Error] def archive(batch_input_marketing_event_external_unique_identifier, opts = {}) data, _status_code, _headers = archive_with_http_info(batch_input_marketing_event_external_unique_identifier, opts) data end # Delete Multiple Marketing Events by External Ids # Deletes multiple Marketing Events based on externalAccountId, externalEventId, and appId. Only Marketing Events created by the same apps will be deleted; events from other apps cannot be removed by this endpoint. # @param batch_input_marketing_event_external_unique_identifier [BatchInputMarketingEventExternalUniqueIdentifier] # @param [Hash] opts the optional parameters # @return [Array<(Error, Integer, Hash)>] Error data, response status code and response headers def archive_with_http_info(batch_input_marketing_event_external_unique_identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BatchApi.archive ...' end # verify the required parameter 'batch_input_marketing_event_external_unique_identifier' is set if @api_client.config.client_side_validation && batch_input_marketing_event_external_unique_identifier.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_external_unique_identifier' when calling BatchApi.archive" end # resource path local_var_path = '/marketing/v3/marketing-events/events/delete' # 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_marketing_event_external_unique_identifier) # return_type return_type = opts[:debug_return_type] || 'Error' # 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 # Delete Multiple Marketing Events by ObjectId # Deletes multiple Marketing Events from the portal based on their objectId, if they exist. Responses: 204: Returned if all specified Marketing Events were successfully deleted. 207: Returned if some objectIds did not correspond to any existing Marketing Events. # @param batch_input_marketing_event_public_object_id_delete_request [BatchInputMarketingEventPublicObjectIdDeleteRequest] # @param [Hash] opts the optional parameters # @return [nil] def archive_by_object_id(batch_input_marketing_event_public_object_id_delete_request, opts = {}) archive_by_object_id_with_http_info(batch_input_marketing_event_public_object_id_delete_request, opts) nil end # Delete Multiple Marketing Events by ObjectId # Deletes multiple Marketing Events from the portal based on their objectId, if they exist. Responses: 204: Returned if all specified Marketing Events were successfully deleted. 207: Returned if some objectIds did not correspond to any existing Marketing Events. # @param batch_input_marketing_event_public_object_id_delete_request [BatchInputMarketingEventPublicObjectIdDeleteRequest] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_by_object_id_with_http_info(batch_input_marketing_event_public_object_id_delete_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BatchApi.archive_by_object_id ...' end # verify the required parameter 'batch_input_marketing_event_public_object_id_delete_request' is set if @api_client.config.client_side_validation && batch_input_marketing_event_public_object_id_delete_request.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_public_object_id_delete_request' when calling BatchApi.archive_by_object_id" end # resource path local_var_path = '/marketing/v3/marketing-events/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_marketing_event_public_object_id_delete_request) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BatchApi.archive_by_object_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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BatchApi#archive_by_object_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update Multiple Marketing Events by ObjectId # Updates multiple Marketing Events on the portal based on their objectId, if they exist. # @param batch_input_marketing_event_public_update_request_full_v2 [BatchInputMarketingEventPublicUpdateRequestFullV2] # @param [Hash] opts the optional parameters # @return [BatchResponseMarketingEventPublicDefaultResponseV2] def update_by_object_id(batch_input_marketing_event_public_update_request_full_v2, opts = {}) data, _status_code, _headers = update_by_object_id_with_http_info(batch_input_marketing_event_public_update_request_full_v2, opts) data end # Update Multiple Marketing Events by ObjectId # Updates multiple Marketing Events on the portal based on their objectId, if they exist. # @param batch_input_marketing_event_public_update_request_full_v2 [BatchInputMarketingEventPublicUpdateRequestFullV2] # @param [Hash] opts the optional parameters # @return [Array<(BatchResponseMarketingEventPublicDefaultResponseV2, Integer, Hash)>] BatchResponseMarketingEventPublicDefaultResponseV2 data, response status code and response headers def update_by_object_id_with_http_info(batch_input_marketing_event_public_update_request_full_v2, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BatchApi.update_by_object_id ...' end # verify the required parameter 'batch_input_marketing_event_public_update_request_full_v2' is set if @api_client.config.client_side_validation && batch_input_marketing_event_public_update_request_full_v2.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_public_update_request_full_v2' when calling BatchApi.update_by_object_id" end # resource path local_var_path = '/marketing/v3/marketing-events/batch/update' # 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_marketing_event_public_update_request_full_v2) # return_type return_type = opts[:debug_return_type] || 'BatchResponseMarketingEventPublicDefaultResponseV2' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BatchApi.update_by_object_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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BatchApi#update_by_object_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create or Update Multiple Marketing Events # Upserts multiple Marketing Events. If a Marketing Event with the specified ID already exists, it will be updated; otherwise, a new event will be created. Only Marketing Events originally created by the same app can be updated. # @param batch_input_marketing_event_create_request_params [BatchInputMarketingEventCreateRequestParams] # @param [Hash] opts the optional parameters # @return [BatchResponseMarketingEventPublicDefaultResponse] def upsert(batch_input_marketing_event_create_request_params, opts = {}) data, _status_code, _headers = upsert_with_http_info(batch_input_marketing_event_create_request_params, opts) data end # Create or Update Multiple Marketing Events # Upserts multiple Marketing Events. If a Marketing Event with the specified ID already exists, it will be updated; otherwise, a new event will be created. Only Marketing Events originally created by the same app can be updated. # @param batch_input_marketing_event_create_request_params [BatchInputMarketingEventCreateRequestParams] # @param [Hash] opts the optional parameters # @return [Array<(BatchResponseMarketingEventPublicDefaultResponse, Integer, Hash)>] BatchResponseMarketingEventPublicDefaultResponse data, response status code and response headers def upsert_with_http_info(batch_input_marketing_event_create_request_params, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BatchApi.upsert ...' end # verify the required parameter 'batch_input_marketing_event_create_request_params' is set if @api_client.config.client_side_validation && batch_input_marketing_event_create_request_params.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_create_request_params' when calling BatchApi.upsert" end # resource path local_var_path = '/marketing/v3/marketing-events/events/upsert' # 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_marketing_event_create_request_params) # return_type return_type = opts[:debug_return_type] || 'BatchResponseMarketingEventPublicDefaultResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BatchApi.upsert", :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#upsert\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/events/api/basic_api.rb
lib/hubspot/codegen/marketing/events/api/basic_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class BasicApi include Hubspot::Helpers::GetAllHelper attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete Marketing Event by External Ids # Deletes the existing Marketing Event with the specified externalAccountId, externalEventId, if it exists. Only Marketing Events created by the same app can be deleted. # @param external_event_id [String] The id of the marketing event in the external event application # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param [Hash] opts the optional parameters # @return [nil] def archive(external_event_id, external_account_id, opts = {}) archive_with_http_info(external_event_id, external_account_id, opts) nil end # Delete Marketing Event by External Ids # Deletes the existing Marketing Event with the specified externalAccountId, externalEventId, if it exists. Only Marketing Events created by the same app can be deleted. # @param external_event_id [String] The id of the marketing event in the external event application # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_with_http_info(external_event_id, external_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.archive ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling BasicApi.archive" end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling BasicApi.archive" end # resource path local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = external_account_id # 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 # Delete Marketing Event by objectId # Deletes the existing Marketing Event with the specified objectId, if it exists. # @param object_id [String] The internal ID of the marketing event in HubSpot # @param [Hash] opts the optional parameters # @return [nil] def archive_by_object_id(object_id, opts = {}) archive_by_object_id_with_http_info(object_id, opts) nil end # Delete Marketing Event by objectId # Deletes the existing Marketing Event with the specified objectId, if it exists. # @param object_id [String] The internal ID of the marketing event in HubSpot # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_by_object_id_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.archive_by_object_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.archive_by_object_id" end # resource path local_var_path = '/marketing/v3/marketing-events/{objectId}'.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.archive_by_object_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(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#archive_by_object_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a marketing event # Creates a new marketing event in HubSpot # @param marketing_event_create_request_params [MarketingEventCreateRequestParams] # @param [Hash] opts the optional parameters # @return [MarketingEventDefaultResponse] def create(marketing_event_create_request_params, opts = {}) data, _status_code, _headers = create_with_http_info(marketing_event_create_request_params, opts) data end # Create a marketing event # Creates a new marketing event in HubSpot # @param marketing_event_create_request_params [MarketingEventCreateRequestParams] # @param [Hash] opts the optional parameters # @return [Array<(MarketingEventDefaultResponse, Integer, Hash)>] MarketingEventDefaultResponse data, response status code and response headers def create_with_http_info(marketing_event_create_request_params, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.create ...' end # verify the required parameter 'marketing_event_create_request_params' is set if @api_client.config.client_side_validation && marketing_event_create_request_params.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_create_request_params' when calling BasicApi.create" end # resource path local_var_path = '/marketing/v3/marketing-events/events' # 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(marketing_event_create_request_params) # return_type return_type = opts[:debug_return_type] || 'MarketingEventDefaultResponse' # 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 # Get all marketing event # Returns all Marketing Events available on the portal, along with their properties, regardless of whether they were created manually or through the application. The marketing events returned by this endpoint are sorted by objectId. # @param [Hash] opts the optional parameters # @option opts [String] :after The cursor indicating the position of the last retrieved item. # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10) # @return [CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging] def get_all(opts = {}) data, _status_code, _headers = get_all_with_http_info(opts) data end # Get all marketing event # Returns all Marketing Events available on the portal, along with their properties, regardless of whether they were created manually or through the application. The marketing events returned by this endpoint are sorted by objectId. # @param [Hash] opts the optional parameters # @option opts [String] :after The cursor indicating the position of the last retrieved item. # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10) # @return [Array<(CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging, Integer, Hash)>] CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging data, response status code and response headers def get_all_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.get_all ...' end # resource path local_var_path = '/marketing/v3/marketing-events/' # query parameters query_params = opts[:query_params] || {} query_params[:'after'] = opts[:'after'] if !opts[:'after'].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] || 'CollectionResponseMarketingEventPublicReadResponseV2ForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.get_all", :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_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Marketing Event by objectId # Returns the details of a Marketing Event with the specified objectId, if it exists. # @param object_id [String] The internal ID of the marketing event in HubSpot # @param [Hash] opts the optional parameters # @return [MarketingEventPublicReadResponseV2] def get_by_object_id(object_id, opts = {}) data, _status_code, _headers = get_by_object_id_with_http_info(object_id, opts) data end # Get Marketing Event by objectId # Returns the details of a Marketing Event with the specified objectId, if it exists. # @param object_id [String] The internal ID of the marketing event in HubSpot # @param [Hash] opts the optional parameters # @return [Array<(MarketingEventPublicReadResponseV2, Integer, Hash)>] MarketingEventPublicReadResponseV2 data, response status code and response headers def get_by_object_id_with_http_info(object_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.get_by_object_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_object_id" end # resource path local_var_path = '/marketing/v3/marketing-events/{objectId}'.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] || 'MarketingEventPublicReadResponseV2' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.get_by_object_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_object_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Marketing Event by External IDs # Returns the details of a Marketing Event with the specified externalAccountId, externalEventId, if it exists. Only Marketing Events created by the same app making the request can be retrieved. # @param external_event_id [String] The id of the marketing event in the external event application # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param [Hash] opts the optional parameters # @return [MarketingEventPublicReadResponse] def get_details(external_event_id, external_account_id, opts = {}) data, _status_code, _headers = get_details_with_http_info(external_event_id, external_account_id, opts) data end # Get Marketing Event by External IDs # Returns the details of a Marketing Event with the specified externalAccountId, externalEventId, if it exists. Only Marketing Events created by the same app making the request can be retrieved. # @param external_event_id [String] The id of the marketing event in the external event application # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param [Hash] opts the optional parameters # @return [Array<(MarketingEventPublicReadResponse, Integer, Hash)>] MarketingEventPublicReadResponse data, response status code and response headers def get_details_with_http_info(external_event_id, external_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.get_details ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling BasicApi.get_details" end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling BasicApi.get_details" end # resource path local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = external_account_id # 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] || 'MarketingEventPublicReadResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.get_details", :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_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update Marketing Event by External IDs # Updates the details of an existing Marketing Event identified by its externalAccountId, externalEventId if it exists. Only Marketing Events created by the same app can be updated. # @param external_event_id [String] The id of the marketing event in the external event application # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param marketing_event_update_request_params [MarketingEventUpdateRequestParams] # @param [Hash] opts the optional parameters # @return [MarketingEventPublicDefaultResponse] def update(external_event_id, external_account_id, marketing_event_update_request_params, opts = {}) data, _status_code, _headers = update_with_http_info(external_event_id, external_account_id, marketing_event_update_request_params, opts) data end # Update Marketing Event by External IDs # Updates the details of an existing Marketing Event identified by its externalAccountId, externalEventId if it exists. Only Marketing Events created by the same app can be updated. # @param external_event_id [String] The id of the marketing event in the external event application # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param marketing_event_update_request_params [MarketingEventUpdateRequestParams] # @param [Hash] opts the optional parameters # @return [Array<(MarketingEventPublicDefaultResponse, Integer, Hash)>] MarketingEventPublicDefaultResponse data, response status code and response headers def update_with_http_info(external_event_id, external_account_id, marketing_event_update_request_params, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.update ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling BasicApi.update" end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling BasicApi.update" end # verify the required parameter 'marketing_event_update_request_params' is set if @api_client.config.client_side_validation && marketing_event_update_request_params.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_update_request_params' when calling BasicApi.update" end # resource path local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = external_account_id # 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(marketing_event_update_request_params) # return_type return_type = opts[:debug_return_type] || 'MarketingEventPublicDefaultResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.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(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update Marketing Event by objectId # Updates the details of an existing Marketing Event identified by its objectId, if it exists. # @param object_id [String] The internal ID of the marketing event in HubSpot # @param marketing_event_public_update_request_v2 [MarketingEventPublicUpdateRequestV2] # @param [Hash] opts the optional parameters # @return [MarketingEventPublicDefaultResponseV2] def update_by_object_id(object_id, marketing_event_public_update_request_v2, opts = {}) data, _status_code, _headers = update_by_object_id_with_http_info(object_id, marketing_event_public_update_request_v2, opts) data end # Update Marketing Event by objectId # Updates the details of an existing Marketing Event identified by its objectId, if it exists. # @param object_id [String] The internal ID of the marketing event in HubSpot # @param marketing_event_public_update_request_v2 [MarketingEventPublicUpdateRequestV2] # @param [Hash] opts the optional parameters # @return [Array<(MarketingEventPublicDefaultResponseV2, Integer, Hash)>] MarketingEventPublicDefaultResponseV2 data, response status code and response headers def update_by_object_id_with_http_info(object_id, marketing_event_public_update_request_v2, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.update_by_object_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.update_by_object_id" end # verify the required parameter 'marketing_event_public_update_request_v2' is set if @api_client.config.client_side_validation && marketing_event_public_update_request_v2.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_public_update_request_v2' when calling BasicApi.update_by_object_id" end # resource path local_var_path = '/marketing/v3/marketing-events/{objectId}'.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', '*/*']) # 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(marketing_event_public_update_request_v2) # return_type return_type = opts[:debug_return_type] || 'MarketingEventPublicDefaultResponseV2' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.update_by_object_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(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BasicApi#update_by_object_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create or update a marketing event # Upserts a marketing event If there is an existing marketing event with the specified ID, it will be updated; otherwise a new event will be created. # @param external_event_id [String] The id of the marketing event in the external event application # @param marketing_event_create_request_params [MarketingEventCreateRequestParams] # @param [Hash] opts the optional parameters # @return [MarketingEventPublicDefaultResponse] def upsert(external_event_id, marketing_event_create_request_params, opts = {}) data, _status_code, _headers = upsert_with_http_info(external_event_id, marketing_event_create_request_params, opts) data end # Create or update a marketing event # Upserts a marketing event If there is an existing marketing event with the specified ID, it will be updated; otherwise a new event will be created. # @param external_event_id [String] The id of the marketing event in the external event application # @param marketing_event_create_request_params [MarketingEventCreateRequestParams] # @param [Hash] opts the optional parameters # @return [Array<(MarketingEventPublicDefaultResponse, Integer, Hash)>] MarketingEventPublicDefaultResponse data, response status code and response headers def upsert_with_http_info(external_event_id, marketing_event_create_request_params, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BasicApi.upsert ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling BasicApi.upsert" end # verify the required parameter 'marketing_event_create_request_params' is set if @api_client.config.client_side_validation && marketing_event_create_request_params.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_create_request_params' when calling BasicApi.upsert" end # resource path local_var_path = '/marketing/v3/marketing-events/events/{externalEventId}'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_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', '*/*']) # 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(marketing_event_create_request_params) # return_type return_type = opts[:debug_return_type] || 'MarketingEventPublicDefaultResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"BasicApi.upsert", :header_params => header_params, :query_params => query_params, :form_params => form_params,
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/marketing/events/api/retrieve_participant_state_api.rb
lib/hubspot/codegen/marketing/events/api/retrieve_participant_state_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class RetrieveParticipantStateApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Read participations breakdown by Contact identifier # Read Contact's participations by identifier - email or internal id. # @param contact_identifier [String] The identifier of the Contact. It may be email or internal id. # @param [Hash] opts the optional parameters # @option opts [String] :state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10) # @option opts [String] :after The cursor indicating the position of the last retrieved item. # @return [CollectionResponseWithTotalParticipationBreakdownForwardPaging] def get_participations_breakdown_by_contact_id(contact_identifier, opts = {}) data, _status_code, _headers = get_participations_breakdown_by_contact_id_with_http_info(contact_identifier, opts) data end # Read participations breakdown by Contact identifier # Read Contact&#39;s participations by identifier - email or internal id. # @param contact_identifier [String] The identifier of the Contact. It may be email or internal id. # @param [Hash] opts the optional parameters # @option opts [String] :state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10) # @option opts [String] :after The cursor indicating the position of the last retrieved item. # @return [Array<(CollectionResponseWithTotalParticipationBreakdownForwardPaging, Integer, Hash)>] CollectionResponseWithTotalParticipationBreakdownForwardPaging data, response status code and response headers def get_participations_breakdown_by_contact_id_with_http_info(contact_identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RetrieveParticipantStateApi.get_participations_breakdown_by_contact_id ...' end # verify the required parameter 'contact_identifier' is set if @api_client.config.client_side_validation && contact_identifier.nil? fail ArgumentError, "Missing the required parameter 'contact_identifier' when calling RetrieveParticipantStateApi.get_participations_breakdown_by_contact_id" end # resource path local_var_path = '/marketing/v3/marketing-events/participations/contacts/{contactIdentifier}/breakdown'.sub('{' + 'contactIdentifier' + '}', CGI.escape(contact_identifier.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].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] || 'CollectionResponseWithTotalParticipationBreakdownForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RetrieveParticipantStateApi.get_participations_breakdown_by_contact_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: RetrieveParticipantStateApi#get_participations_breakdown_by_contact_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Read participations breakdown by Marketing Event external identifier # Read Marketing event's participations breakdown with optional filters by externalAccountId and externalEventId pair. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param external_event_id [String] The id of the marketing event in the external event application. # @param [Hash] opts the optional parameters # @option opts [String] :contact_identifier The identifier of the Contact. It may be email or internal id. # @option opts [String] :state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10) # @option opts [String] :after The cursor indicating the position of the last retrieved item. # @return [CollectionResponseWithTotalParticipationBreakdownForwardPaging] def get_participations_breakdown_by_external_event_id(external_account_id, external_event_id, opts = {}) data, _status_code, _headers = get_participations_breakdown_by_external_event_id_with_http_info(external_account_id, external_event_id, opts) data end # Read participations breakdown by Marketing Event external identifier # Read Marketing event&#39;s participations breakdown with optional filters by externalAccountId and externalEventId pair. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param external_event_id [String] The id of the marketing event in the external event application. # @param [Hash] opts the optional parameters # @option opts [String] :contact_identifier The identifier of the Contact. It may be email or internal id. # @option opts [String] :state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10) # @option opts [String] :after The cursor indicating the position of the last retrieved item. # @return [Array<(CollectionResponseWithTotalParticipationBreakdownForwardPaging, Integer, Hash)>] CollectionResponseWithTotalParticipationBreakdownForwardPaging data, response status code and response headers def get_participations_breakdown_by_external_event_id_with_http_info(external_account_id, external_event_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RetrieveParticipantStateApi.get_participations_breakdown_by_external_event_id ...' end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling RetrieveParticipantStateApi.get_participations_breakdown_by_external_event_id" end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling RetrieveParticipantStateApi.get_participations_breakdown_by_external_event_id" end # resource path local_var_path = '/marketing/v3/marketing-events/participations/{externalAccountId}/{externalEventId}/breakdown'.sub('{' + 'externalAccountId' + '}', CGI.escape(external_account_id.to_s)).sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'contactIdentifier'] = opts[:'contact_identifier'] if !opts[:'contact_identifier'].nil? query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].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] || 'CollectionResponseWithTotalParticipationBreakdownForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RetrieveParticipantStateApi.get_participations_breakdown_by_external_event_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: RetrieveParticipantStateApi#get_participations_breakdown_by_external_event_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Read participations breakdown by Marketing Event internal identifier # Read Marketing event's participations breakdown with optional filters by internal identifier marketingEventId. # @param marketing_event_id [Integer] The internal id of the marketing event in HubSpot. # @param [Hash] opts the optional parameters # @option opts [String] :contact_identifier The identifier of the Contact. It may be email or internal id. # @option opts [String] :state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10) # @option opts [String] :after The cursor indicating the position of the last retrieved item. # @return [CollectionResponseWithTotalParticipationBreakdownForwardPaging] def get_participations_breakdown_by_marketing_event_id(marketing_event_id, opts = {}) data, _status_code, _headers = get_participations_breakdown_by_marketing_event_id_with_http_info(marketing_event_id, opts) data end # Read participations breakdown by Marketing Event internal identifier # Read Marketing event&#39;s participations breakdown with optional filters by internal identifier marketingEventId. # @param marketing_event_id [Integer] The internal id of the marketing event in HubSpot. # @param [Hash] opts the optional parameters # @option opts [String] :contact_identifier The identifier of the Contact. It may be email or internal id. # @option opts [String] :state The participation state value. It may be REGISTERED, CANCELLED, ATTENDED, NO_SHOW # @option opts [Integer] :limit The limit for response size. The default value is 10, the max number is 100 (default to 10) # @option opts [String] :after The cursor indicating the position of the last retrieved item. # @return [Array<(CollectionResponseWithTotalParticipationBreakdownForwardPaging, Integer, Hash)>] CollectionResponseWithTotalParticipationBreakdownForwardPaging data, response status code and response headers def get_participations_breakdown_by_marketing_event_id_with_http_info(marketing_event_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RetrieveParticipantStateApi.get_participations_breakdown_by_marketing_event_id ...' end # verify the required parameter 'marketing_event_id' is set if @api_client.config.client_side_validation && marketing_event_id.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_id' when calling RetrieveParticipantStateApi.get_participations_breakdown_by_marketing_event_id" end # resource path local_var_path = '/marketing/v3/marketing-events/participations/{marketingEventId}/breakdown'.sub('{' + 'marketingEventId' + '}', CGI.escape(marketing_event_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'contactIdentifier'] = opts[:'contact_identifier'] if !opts[:'contact_identifier'].nil? query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].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] || 'CollectionResponseWithTotalParticipationBreakdownForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RetrieveParticipantStateApi.get_participations_breakdown_by_marketing_event_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: RetrieveParticipantStateApi#get_participations_breakdown_by_marketing_event_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Read participations counters by Marketing Event external identifier # Read Marketing event's participations counters by externalAccountId and externalEventId pair. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param external_event_id [String] The id of the marketing event in the external event application. # @param [Hash] opts the optional parameters # @return [AttendanceCounters] def get_participations_counters_by_event_external_id(external_account_id, external_event_id, opts = {}) data, _status_code, _headers = get_participations_counters_by_event_external_id_with_http_info(external_account_id, external_event_id, opts) data end # Read participations counters by Marketing Event external identifier # Read Marketing event&#39;s participations counters by externalAccountId and externalEventId pair. # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param external_event_id [String] The id of the marketing event in the external event application. # @param [Hash] opts the optional parameters # @return [Array<(AttendanceCounters, Integer, Hash)>] AttendanceCounters data, response status code and response headers def get_participations_counters_by_event_external_id_with_http_info(external_account_id, external_event_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RetrieveParticipantStateApi.get_participations_counters_by_event_external_id ...' end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling RetrieveParticipantStateApi.get_participations_counters_by_event_external_id" end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling RetrieveParticipantStateApi.get_participations_counters_by_event_external_id" end # resource path local_var_path = '/marketing/v3/marketing-events/participations/{externalAccountId}/{externalEventId}'.sub('{' + 'externalAccountId' + '}', CGI.escape(external_account_id.to_s)).sub('{' + 'externalEventId' + '}', CGI.escape(external_event_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] || 'AttendanceCounters' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RetrieveParticipantStateApi.get_participations_counters_by_event_external_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: RetrieveParticipantStateApi#get_participations_counters_by_event_external_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Read participations counters by Marketing Event internal identifier # Read Marketing event's participations counters by internal identifier marketingEventId. # @param marketing_event_id [Integer] The internal id of the marketing event in HubSpot. # @param [Hash] opts the optional parameters # @return [AttendanceCounters] def get_participations_counters_by_marketing_event_id(marketing_event_id, opts = {}) data, _status_code, _headers = get_participations_counters_by_marketing_event_id_with_http_info(marketing_event_id, opts) data end # Read participations counters by Marketing Event internal identifier # Read Marketing event&#39;s participations counters by internal identifier marketingEventId. # @param marketing_event_id [Integer] The internal id of the marketing event in HubSpot. # @param [Hash] opts the optional parameters # @return [Array<(AttendanceCounters, Integer, Hash)>] AttendanceCounters data, response status code and response headers def get_participations_counters_by_marketing_event_id_with_http_info(marketing_event_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RetrieveParticipantStateApi.get_participations_counters_by_marketing_event_id ...' end # verify the required parameter 'marketing_event_id' is set if @api_client.config.client_side_validation && marketing_event_id.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_id' when calling RetrieveParticipantStateApi.get_participations_counters_by_marketing_event_id" end # resource path local_var_path = '/marketing/v3/marketing-events/participations/{marketingEventId}'.sub('{' + 'marketingEventId' + '}', CGI.escape(marketing_event_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] || 'AttendanceCounters' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RetrieveParticipantStateApi.get_participations_counters_by_marketing_event_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: RetrieveParticipantStateApi#get_participations_counters_by_marketing_event_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/events/api/add_event_attendees_api.rb
lib/hubspot/codegen/marketing/events/api/add_event_attendees_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class AddEventAttendeesApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Record Participants by Email with Marketing Event External Ids # Records the participation of multiple HubSpot contacts in a Marketing Event using their email addresses. If a contact does not exist, it will be automatically created. The contactProperties field is used exclusively for creating new contacts and will not update properties of existing contacts. Additional Functionality: - Adds a timeline event to the contacts. Allowed Properties: For the state \"attend\": - joinedAt - leftAt # @param external_event_id [String] The id of the marketing event in the external event application # @param subscriber_state [String] The new subscriber state for the HubSpot contacts and the specified marketing event. For example: &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39;. # @param batch_input_marketing_event_email_subscriber [BatchInputMarketingEventEmailSubscriber] # @param [Hash] opts the optional parameters # @option opts [String] :external_account_id The accountId that is associated with this marketing event in the external event application # @return [BatchResponseSubscriberEmailResponse] def record_by_contact_emails(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, opts = {}) data, _status_code, _headers = record_by_contact_emails_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, opts) data end # Record Participants by Email with Marketing Event External Ids # Records the participation of multiple HubSpot contacts in a Marketing Event using their email addresses. If a contact does not exist, it will be automatically created. The contactProperties field is used exclusively for creating new contacts and will not update properties of existing contacts. Additional Functionality: - Adds a timeline event to the contacts. Allowed Properties: For the state \&quot;attend\&quot;: - joinedAt - leftAt # @param external_event_id [String] The id of the marketing event in the external event application # @param subscriber_state [String] The new subscriber state for the HubSpot contacts and the specified marketing event. For example: &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39;. # @param batch_input_marketing_event_email_subscriber [BatchInputMarketingEventEmailSubscriber] # @param [Hash] opts the optional parameters # @option opts [String] :external_account_id The accountId that is associated with this marketing event in the external event application # @return [Array<(BatchResponseSubscriberEmailResponse, Integer, Hash)>] BatchResponseSubscriberEmailResponse data, response status code and response headers def record_by_contact_emails_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_email_subscriber, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddEventAttendeesApi.record_by_contact_emails ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling AddEventAttendeesApi.record_by_contact_emails" end # verify the required parameter 'subscriber_state' is set if @api_client.config.client_side_validation && subscriber_state.nil? fail ArgumentError, "Missing the required parameter 'subscriber_state' when calling AddEventAttendeesApi.record_by_contact_emails" end # verify the required parameter 'batch_input_marketing_event_email_subscriber' is set if @api_client.config.client_side_validation && batch_input_marketing_event_email_subscriber.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_email_subscriber' when calling AddEventAttendeesApi.record_by_contact_emails" end # resource path local_var_path = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/email-create'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)).sub('{' + 'subscriberState' + '}', CGI.escape(subscriber_state.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = opts[:'external_account_id'] if !opts[:'external_account_id'].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_marketing_event_email_subscriber) # return_type return_type = opts[:debug_return_type] || 'BatchResponseSubscriberEmailResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"AddEventAttendeesApi.record_by_contact_emails", :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: AddEventAttendeesApi#record_by_contact_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Record Participants by ContactId with Marketing Event Object Id # Records the participation of multiple HubSpot contacts in a Marketing Event using their HubSpot contact IDs. Additional Functionality: - Adds a timeline event to the contacts. Allowed Properties: For the state \"attend\": - joinedAt - leftAt # @param object_id [String] The internal id of the marketing event in HubSpot # @param subscriber_state [String] The attendance state value. It may be &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39; # @param batch_input_marketing_event_subscriber [BatchInputMarketingEventSubscriber] # @param [Hash] opts the optional parameters # @return [BatchResponseSubscriberVidResponse] def record_by_contact_id(object_id, subscriber_state, batch_input_marketing_event_subscriber, opts = {}) data, _status_code, _headers = record_by_contact_id_with_http_info(object_id, subscriber_state, batch_input_marketing_event_subscriber, opts) data end # Record Participants by ContactId with Marketing Event Object Id # Records the participation of multiple HubSpot contacts in a Marketing Event using their HubSpot contact IDs. Additional Functionality: - Adds a timeline event to the contacts. Allowed Properties: For the state \&quot;attend\&quot;: - joinedAt - leftAt # @param object_id [String] The internal id of the marketing event in HubSpot # @param subscriber_state [String] The attendance state value. It may be &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39; # @param batch_input_marketing_event_subscriber [BatchInputMarketingEventSubscriber] # @param [Hash] opts the optional parameters # @return [Array<(BatchResponseSubscriberVidResponse, Integer, Hash)>] BatchResponseSubscriberVidResponse data, response status code and response headers def record_by_contact_id_with_http_info(object_id, subscriber_state, batch_input_marketing_event_subscriber, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddEventAttendeesApi.record_by_contact_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 AddEventAttendeesApi.record_by_contact_id" end # verify the required parameter 'subscriber_state' is set if @api_client.config.client_side_validation && subscriber_state.nil? fail ArgumentError, "Missing the required parameter 'subscriber_state' when calling AddEventAttendeesApi.record_by_contact_id" end # verify the required parameter 'batch_input_marketing_event_subscriber' is set if @api_client.config.client_side_validation && batch_input_marketing_event_subscriber.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_subscriber' when calling AddEventAttendeesApi.record_by_contact_id" end # resource path local_var_path = '/marketing/v3/marketing-events/{objectId}/attendance/{subscriberState}/create'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'subscriberState' + '}', CGI.escape(subscriber_state.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', '*/*']) # 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_marketing_event_subscriber) # return_type return_type = opts[:debug_return_type] || 'BatchResponseSubscriberVidResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"AddEventAttendeesApi.record_by_contact_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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AddEventAttendeesApi#record_by_contact_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Record Participants by ContactId with Marketing Event External Ids # Records the participation of multiple HubSpot contacts in a Marketing Event using their HubSpot contact IDs. Additional Functionality: - Adds a timeline event to the contacts. Allowed Properties: For the state \"attend\": - joinedAt - leftAt # @param external_event_id [String] The id of the marketing event in the external event application # @param subscriber_state [String] The new subscriber state for the HubSpot contacts and the specified marketing event. For example: &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39;. # @param batch_input_marketing_event_subscriber [BatchInputMarketingEventSubscriber] # @param [Hash] opts the optional parameters # @option opts [String] :external_account_id The accountId that is associated with this marketing event in the external event application # @return [BatchResponseSubscriberVidResponse] def record_by_contact_ids(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, opts = {}) data, _status_code, _headers = record_by_contact_ids_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, opts) data end # Record Participants by ContactId with Marketing Event External Ids # Records the participation of multiple HubSpot contacts in a Marketing Event using their HubSpot contact IDs. Additional Functionality: - Adds a timeline event to the contacts. Allowed Properties: For the state \&quot;attend\&quot;: - joinedAt - leftAt # @param external_event_id [String] The id of the marketing event in the external event application # @param subscriber_state [String] The new subscriber state for the HubSpot contacts and the specified marketing event. For example: &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39;. # @param batch_input_marketing_event_subscriber [BatchInputMarketingEventSubscriber] # @param [Hash] opts the optional parameters # @option opts [String] :external_account_id The accountId that is associated with this marketing event in the external event application # @return [Array<(BatchResponseSubscriberVidResponse, Integer, Hash)>] BatchResponseSubscriberVidResponse data, response status code and response headers def record_by_contact_ids_with_http_info(external_event_id, subscriber_state, batch_input_marketing_event_subscriber, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddEventAttendeesApi.record_by_contact_ids ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling AddEventAttendeesApi.record_by_contact_ids" end # verify the required parameter 'subscriber_state' is set if @api_client.config.client_side_validation && subscriber_state.nil? fail ArgumentError, "Missing the required parameter 'subscriber_state' when calling AddEventAttendeesApi.record_by_contact_ids" end # verify the required parameter 'batch_input_marketing_event_subscriber' is set if @api_client.config.client_side_validation && batch_input_marketing_event_subscriber.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_subscriber' when calling AddEventAttendeesApi.record_by_contact_ids" end # resource path local_var_path = '/marketing/v3/marketing-events/attendance/{externalEventId}/{subscriberState}/create'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)).sub('{' + 'subscriberState' + '}', CGI.escape(subscriber_state.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'externalAccountId'] = opts[:'external_account_id'] if !opts[:'external_account_id'].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_marketing_event_subscriber) # return_type return_type = opts[:debug_return_type] || 'BatchResponseSubscriberVidResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"AddEventAttendeesApi.record_by_contact_ids", :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: AddEventAttendeesApi#record_by_contact_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Record Participants by Email with Marketing Event Object Id # Records the participation of multiple HubSpot contacts in a Marketing Event using their email addresses. If a contact does not exist, it will be automatically created. The contactProperties field is used exclusively for creating new contacts and will not update properties of existing contacts. Additional Functionality: - Adds a timeline event to the contacts. Allowed Properties: For the state \"attend\": - joinedAt - leftAt # @param object_id [String] The internal ID of the marketing event in HubSpot # @param subscriber_state [String] The attendance state value. It may be &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39; # @param batch_input_marketing_event_email_subscriber [BatchInputMarketingEventEmailSubscriber] # @param [Hash] opts the optional parameters # @return [BatchResponseSubscriberEmailResponse] def record_by_email(object_id, subscriber_state, batch_input_marketing_event_email_subscriber, opts = {}) data, _status_code, _headers = record_by_email_with_http_info(object_id, subscriber_state, batch_input_marketing_event_email_subscriber, opts) data end # Record Participants by Email with Marketing Event Object Id # Records the participation of multiple HubSpot contacts in a Marketing Event using their email addresses. If a contact does not exist, it will be automatically created. The contactProperties field is used exclusively for creating new contacts and will not update properties of existing contacts. Additional Functionality: - Adds a timeline event to the contacts. Allowed Properties: For the state \&quot;attend\&quot;: - joinedAt - leftAt # @param object_id [String] The internal ID of the marketing event in HubSpot # @param subscriber_state [String] The attendance state value. It may be &#39;register&#39;, &#39;attend&#39; or &#39;cancel&#39; # @param batch_input_marketing_event_email_subscriber [BatchInputMarketingEventEmailSubscriber] # @param [Hash] opts the optional parameters # @return [Array<(BatchResponseSubscriberEmailResponse, Integer, Hash)>] BatchResponseSubscriberEmailResponse data, response status code and response headers def record_by_email_with_http_info(object_id, subscriber_state, batch_input_marketing_event_email_subscriber, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddEventAttendeesApi.record_by_email ...' 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 AddEventAttendeesApi.record_by_email" end # verify the required parameter 'subscriber_state' is set if @api_client.config.client_side_validation && subscriber_state.nil? fail ArgumentError, "Missing the required parameter 'subscriber_state' when calling AddEventAttendeesApi.record_by_email" end # verify the required parameter 'batch_input_marketing_event_email_subscriber' is set if @api_client.config.client_side_validation && batch_input_marketing_event_email_subscriber.nil? fail ArgumentError, "Missing the required parameter 'batch_input_marketing_event_email_subscriber' when calling AddEventAttendeesApi.record_by_email" end # resource path local_var_path = '/marketing/v3/marketing-events/{objectId}/attendance/{subscriberState}/email-create'.sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'subscriberState' + '}', CGI.escape(subscriber_state.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', '*/*']) # 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_marketing_event_email_subscriber) # return_type return_type = opts[:debug_return_type] || 'BatchResponseSubscriberEmailResponse' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"AddEventAttendeesApi.record_by_email", :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: AddEventAttendeesApi#record_by_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/events/api/identifiers_api.rb
lib/hubspot/codegen/marketing/events/api/identifiers_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class IdentifiersApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Find App-Specific Marketing Events by External Event Id # Retrieves Marketing Events where the externalEventId matches the value provided in the request, limited to events created by the app making the request. Marketing Events created by other apps will not be included in the results. # @param q [String] The id of the marketing event in the external event application (externalEventId) # @param [Hash] opts the optional parameters # @return [CollectionResponseSearchPublicResponseWrapperNoPaging] def do_search(q, opts = {}) data, _status_code, _headers = do_search_with_http_info(q, opts) data end # Find App-Specific Marketing Events by External Event Id # Retrieves Marketing Events where the externalEventId matches the value provided in the request, limited to events created by the app making the request. Marketing Events created by other apps will not be included in the results. # @param q [String] The id of the marketing event in the external event application (externalEventId) # @param [Hash] opts the optional parameters # @return [Array<(CollectionResponseSearchPublicResponseWrapperNoPaging, Integer, Hash)>] CollectionResponseSearchPublicResponseWrapperNoPaging data, response status code and response headers def do_search_with_http_info(q, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IdentifiersApi.do_search ...' end # verify the required parameter 'q' is set if @api_client.config.client_side_validation && q.nil? fail ArgumentError, "Missing the required parameter 'q' when calling IdentifiersApi.do_search" end # resource path local_var_path = '/marketing/v3/marketing-events/events/search' # query parameters query_params = opts[:query_params] || {} query_params[:'q'] = q # 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] || 'CollectionResponseSearchPublicResponseWrapperNoPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"IdentifiersApi.do_search", :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: IdentifiersApi#do_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find Marketing Events by External Event Id # This endpoint searches the portal for all Marketing Events whose externalEventId matches the value provided in the request. It retrieves the objectId and additional event details for each matching Marketing Event. Since multiple Marketing Events can have the same externalEventId, the endpoint returns all matching results. Note: Marketing Events become searchable by externalEventId a few minutes after creation. # @param external_event_id [String] The id of the marketing event in the external event application. # @param [Hash] opts the optional parameters # @return [CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging] def search_portal_events(external_event_id, opts = {}) data, _status_code, _headers = search_portal_events_with_http_info(external_event_id, opts) data end # Find Marketing Events by External Event Id # This endpoint searches the portal for all Marketing Events whose externalEventId matches the value provided in the request. It retrieves the objectId and additional event details for each matching Marketing Event. Since multiple Marketing Events can have the same externalEventId, the endpoint returns all matching results. Note: Marketing Events become searchable by externalEventId a few minutes after creation. # @param external_event_id [String] The id of the marketing event in the external event application. # @param [Hash] opts the optional parameters # @return [Array<(CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging, Integer, Hash)>] CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging data, response status code and response headers def search_portal_events_with_http_info(external_event_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IdentifiersApi.search_portal_events ...' end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling IdentifiersApi.search_portal_events" end # resource path local_var_path = '/marketing/v3/marketing-events/{externalEventId}/identifiers'.sub('{' + 'externalEventId' + '}', CGI.escape(external_event_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] || 'CollectionResponseWithTotalMarketingEventIdentifiersResponseNoPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"IdentifiersApi.search_portal_events", :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: IdentifiersApi#search_portal_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/events/api/settings_api.rb
lib/hubspot/codegen/marketing/events/api/settings_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class SettingsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Retrieve the application settings # Retrieve the current settings for the application. # @param app_id [Integer] The id of the application to retrieve the settings for. # @param [Hash] opts the optional parameters # @return [EventDetailSettings] def get_all(app_id, opts = {}) data, _status_code, _headers = get_all_with_http_info(app_id, opts) data end # Retrieve the application settings # Retrieve the current settings for the application. # @param app_id [Integer] The id of the application to retrieve the settings for. # @param [Hash] opts the optional parameters # @return [Array<(EventDetailSettings, Integer, Hash)>] EventDetailSettings data, response status code and response headers def get_all_with_http_info(app_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SettingsApi.get_all ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling SettingsApi.get_all" end # resource path local_var_path = '/marketing/v3/marketing-events/{appId}/settings'.sub('{' + 'appId' + '}', CGI.escape(app_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] || 'EventDetailSettings' # auth_names auth_names = opts[:debug_auth_names] || ['developer_hapikey'] new_options = opts.merge( :operation => :"SettingsApi.get_all", :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: SettingsApi#get_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update the application settings # Create or update the current settings for the application. # @param app_id [Integer] The id of the application to update the settings for. # @param event_detail_settings_url [EventDetailSettingsUrl] # @param [Hash] opts the optional parameters # @return [EventDetailSettings] def update(app_id, event_detail_settings_url, opts = {}) data, _status_code, _headers = update_with_http_info(app_id, event_detail_settings_url, opts) data end # Update the application settings # Create or update the current settings for the application. # @param app_id [Integer] The id of the application to update the settings for. # @param event_detail_settings_url [EventDetailSettingsUrl] # @param [Hash] opts the optional parameters # @return [Array<(EventDetailSettings, Integer, Hash)>] EventDetailSettings data, response status code and response headers def update_with_http_info(app_id, event_detail_settings_url, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SettingsApi.update ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling SettingsApi.update" end # verify the required parameter 'event_detail_settings_url' is set if @api_client.config.client_side_validation && event_detail_settings_url.nil? fail ArgumentError, "Missing the required parameter 'event_detail_settings_url' when calling SettingsApi.update" end # resource path local_var_path = '/marketing/v3/marketing-events/{appId}/settings'.sub('{' + 'appId' + '}', CGI.escape(app_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', '*/*']) # 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(event_detail_settings_url) # return_type return_type = opts[:debug_return_type] || 'EventDetailSettings' # auth_names auth_names = opts[:debug_auth_names] || ['developer_hapikey'] new_options = opts.merge( :operation => :"SettingsApi.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: SettingsApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/events/api/list_associations_api.rb
lib/hubspot/codegen/marketing/events/api/list_associations_api.rb
=begin #Marketing Events #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Events class ListAssociationsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Associate a list with a marketing event # Associates a list with a marketing event by external account id, external event id, and ILS list id # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param external_event_id [String] The id of the marketing event in the external event application. # @param list_id [String] The ILS ID of the list. # @param [Hash] opts the optional parameters # @return [nil] def associate_by_external_account_and_event_ids(external_account_id, external_event_id, list_id, opts = {}) associate_by_external_account_and_event_ids_with_http_info(external_account_id, external_event_id, list_id, opts) nil end # Associate a list with a marketing event # Associates a list with a marketing event by external account id, external event id, and ILS list id # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param external_event_id [String] The id of the marketing event in the external event application. # @param list_id [String] The ILS ID of the list. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def associate_by_external_account_and_event_ids_with_http_info(external_account_id, external_event_id, list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListAssociationsApi.associate_by_external_account_and_event_ids ...' end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling ListAssociationsApi.associate_by_external_account_and_event_ids" end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling ListAssociationsApi.associate_by_external_account_and_event_ids" end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ListAssociationsApi.associate_by_external_account_and_event_ids" end # resource path local_var_path = '/marketing/v3/marketing-events/associations/{externalAccountId}/{externalEventId}/lists/{listId}'.sub('{' + 'externalAccountId' + '}', CGI.escape(external_account_id.to_s)).sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)).sub('{' + 'listId' + '}', CGI.escape(list_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 => :"ListAssociationsApi.associate_by_external_account_and_event_ids", :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: ListAssociationsApi#associate_by_external_account_and_event_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Associate a list with a marketing event # Associates a list with a marketing event by marketing event id and ILS list id # @param marketing_event_id [String] The internal id of the marketing event in HubSpot. # @param list_id [String] The ILS ID of the list. # @param [Hash] opts the optional parameters # @return [nil] def associate_by_marketing_event_id(marketing_event_id, list_id, opts = {}) associate_by_marketing_event_id_with_http_info(marketing_event_id, list_id, opts) nil end # Associate a list with a marketing event # Associates a list with a marketing event by marketing event id and ILS list id # @param marketing_event_id [String] The internal id of the marketing event in HubSpot. # @param list_id [String] The ILS ID of the list. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def associate_by_marketing_event_id_with_http_info(marketing_event_id, list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListAssociationsApi.associate_by_marketing_event_id ...' end # verify the required parameter 'marketing_event_id' is set if @api_client.config.client_side_validation && marketing_event_id.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_id' when calling ListAssociationsApi.associate_by_marketing_event_id" end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ListAssociationsApi.associate_by_marketing_event_id" end # resource path local_var_path = '/marketing/v3/marketing-events/associations/{marketingEventId}/lists/{listId}'.sub('{' + 'marketingEventId' + '}', CGI.escape(marketing_event_id.to_s)).sub('{' + 'listId' + '}', CGI.escape(list_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 => :"ListAssociationsApi.associate_by_marketing_event_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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ListAssociationsApi#associate_by_marketing_event_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Disassociate a list from a marketing event # Disassociates a list from a marketing event by external account id, external event id, and ILS list id # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param external_event_id [String] The id of the marketing event in the external event application. # @param list_id [String] The ILS ID of the list. # @param [Hash] opts the optional parameters # @return [nil] def disassociate_by_external_account_and_event_ids(external_account_id, external_event_id, list_id, opts = {}) disassociate_by_external_account_and_event_ids_with_http_info(external_account_id, external_event_id, list_id, opts) nil end # Disassociate a list from a marketing event # Disassociates a list from a marketing event by external account id, external event id, and ILS list id # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application. # @param external_event_id [String] The id of the marketing event in the external event application. # @param list_id [String] The ILS ID of the list. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def disassociate_by_external_account_and_event_ids_with_http_info(external_account_id, external_event_id, list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListAssociationsApi.disassociate_by_external_account_and_event_ids ...' end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling ListAssociationsApi.disassociate_by_external_account_and_event_ids" end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling ListAssociationsApi.disassociate_by_external_account_and_event_ids" end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ListAssociationsApi.disassociate_by_external_account_and_event_ids" end # resource path local_var_path = '/marketing/v3/marketing-events/associations/{externalAccountId}/{externalEventId}/lists/{listId}'.sub('{' + 'externalAccountId' + '}', CGI.escape(external_account_id.to_s)).sub('{' + 'externalEventId' + '}', CGI.escape(external_event_id.to_s)).sub('{' + 'listId' + '}', CGI.escape(list_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 => :"ListAssociationsApi.disassociate_by_external_account_and_event_ids", :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: ListAssociationsApi#disassociate_by_external_account_and_event_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Disassociate a list from a marketing event # Disassociates a list from a marketing event by marketing event id and ILS list id # @param marketing_event_id [String] The internal id of the marketing event in HubSpot. # @param list_id [String] The ILS ID of the list. # @param [Hash] opts the optional parameters # @return [nil] def disassociate_by_marketing_event_id(marketing_event_id, list_id, opts = {}) disassociate_by_marketing_event_id_with_http_info(marketing_event_id, list_id, opts) nil end # Disassociate a list from a marketing event # Disassociates a list from a marketing event by marketing event id and ILS list id # @param marketing_event_id [String] The internal id of the marketing event in HubSpot. # @param list_id [String] The ILS ID of the list. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def disassociate_by_marketing_event_id_with_http_info(marketing_event_id, list_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListAssociationsApi.disassociate_by_marketing_event_id ...' end # verify the required parameter 'marketing_event_id' is set if @api_client.config.client_side_validation && marketing_event_id.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_id' when calling ListAssociationsApi.disassociate_by_marketing_event_id" end # verify the required parameter 'list_id' is set if @api_client.config.client_side_validation && list_id.nil? fail ArgumentError, "Missing the required parameter 'list_id' when calling ListAssociationsApi.disassociate_by_marketing_event_id" end # resource path local_var_path = '/marketing/v3/marketing-events/associations/{marketingEventId}/lists/{listId}'.sub('{' + 'marketingEventId' + '}', CGI.escape(marketing_event_id.to_s)).sub('{' + 'listId' + '}', CGI.escape(list_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 => :"ListAssociationsApi.disassociate_by_marketing_event_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(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ListAssociationsApi#disassociate_by_marketing_event_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get lists associated with a marketing event # Gets lists associated with a marketing event by external account id and external event id # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param external_event_id [String] The id of the marketing event in the external event application. # @param [Hash] opts the optional parameters # @return [CollectionResponseWithTotalPublicListNoPaging] def get_all_by_external_account_and_event_ids(external_account_id, external_event_id, opts = {}) data, _status_code, _headers = get_all_by_external_account_and_event_ids_with_http_info(external_account_id, external_event_id, opts) data end # Get lists associated with a marketing event # Gets lists associated with a marketing event by external account id and external event id # @param external_account_id [String] The accountId that is associated with this marketing event in the external event application # @param external_event_id [String] The id of the marketing event in the external event application. # @param [Hash] opts the optional parameters # @return [Array<(CollectionResponseWithTotalPublicListNoPaging, Integer, Hash)>] CollectionResponseWithTotalPublicListNoPaging data, response status code and response headers def get_all_by_external_account_and_event_ids_with_http_info(external_account_id, external_event_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListAssociationsApi.get_all_by_external_account_and_event_ids ...' end # verify the required parameter 'external_account_id' is set if @api_client.config.client_side_validation && external_account_id.nil? fail ArgumentError, "Missing the required parameter 'external_account_id' when calling ListAssociationsApi.get_all_by_external_account_and_event_ids" end # verify the required parameter 'external_event_id' is set if @api_client.config.client_side_validation && external_event_id.nil? fail ArgumentError, "Missing the required parameter 'external_event_id' when calling ListAssociationsApi.get_all_by_external_account_and_event_ids" end # resource path local_var_path = '/marketing/v3/marketing-events/associations/{externalAccountId}/{externalEventId}/lists'.sub('{' + 'externalAccountId' + '}', CGI.escape(external_account_id.to_s)).sub('{' + 'externalEventId' + '}', CGI.escape(external_event_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] || 'CollectionResponseWithTotalPublicListNoPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"ListAssociationsApi.get_all_by_external_account_and_event_ids", :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: ListAssociationsApi#get_all_by_external_account_and_event_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get lists associated with a marketing event # Gets lists associated with a marketing event by marketing event id # @param marketing_event_id [String] The internal id of the marketing event in HubSpot. # @param [Hash] opts the optional parameters # @return [CollectionResponseWithTotalPublicListNoPaging] def get_all_by_marketing_event_id(marketing_event_id, opts = {}) data, _status_code, _headers = get_all_by_marketing_event_id_with_http_info(marketing_event_id, opts) data end # Get lists associated with a marketing event # Gets lists associated with a marketing event by marketing event id # @param marketing_event_id [String] The internal id of the marketing event in HubSpot. # @param [Hash] opts the optional parameters # @return [Array<(CollectionResponseWithTotalPublicListNoPaging, Integer, Hash)>] CollectionResponseWithTotalPublicListNoPaging data, response status code and response headers def get_all_by_marketing_event_id_with_http_info(marketing_event_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ListAssociationsApi.get_all_by_marketing_event_id ...' end # verify the required parameter 'marketing_event_id' is set if @api_client.config.client_side_validation && marketing_event_id.nil? fail ArgumentError, "Missing the required parameter 'marketing_event_id' when calling ListAssociationsApi.get_all_by_marketing_event_id" end # resource path local_var_path = '/marketing/v3/marketing-events/associations/{marketingEventId}/lists'.sub('{' + 'marketingEventId' + '}', CGI.escape(marketing_event_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] || 'CollectionResponseWithTotalPublicListNoPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"ListAssociationsApi.get_all_by_marketing_event_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: ListAssociationsApi#get_all_by_marketing_event_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/transactional/api_error.rb
lib/hubspot/codegen/marketing/transactional/api_error.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end module Hubspot module Marketing module Transactional 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/marketing/transactional/configuration.rb
lib/hubspot/codegen/marketing/transactional/configuration.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end module Hubspot module Marketing module Transactional 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/marketing/transactional/api_client.rb
lib/hubspot/codegen/marketing/transactional/api_client.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'json' require 'logger' require 'tempfile' require 'time' require 'typhoeus' module Hubspot module Marketing module Transactional 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::Marketing::Transactional.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/marketing/transactional/models/public_single_send_email.rb
lib/hubspot/codegen/marketing/transactional/models/public_single_send_email.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional # A JSON object containing anything you want to override. class PublicSingleSendEmail # List of email addresses to send as Cc. attr_accessor :cc # ID for a particular send. No more than one email will be sent per sendId. attr_accessor :send_id # List of email addresses to send as Bcc. attr_accessor :bcc # List of Reply-To header values for the email. attr_accessor :reply_to # The From header for the email. attr_accessor :from # The recipient of the email. attr_accessor :to # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'cc' => :'cc', :'send_id' => :'sendId', :'bcc' => :'bcc', :'reply_to' => :'replyTo', :'from' => :'from', :'to' => :'to' } 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 { :'cc' => :'Array<String>', :'send_id' => :'String', :'bcc' => :'Array<String>', :'reply_to' => :'Array<String>', :'from' => :'String', :'to' => :'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::Marketing::Transactional::PublicSingleSendEmail` 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::Marketing::Transactional::PublicSingleSendEmail`. 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?(:'cc') if (value = attributes[:'cc']).is_a?(Array) self.cc = value end end if attributes.key?(:'send_id') self.send_id = attributes[:'send_id'] end if attributes.key?(:'bcc') if (value = attributes[:'bcc']).is_a?(Array) self.bcc = value end end if attributes.key?(:'reply_to') if (value = attributes[:'reply_to']).is_a?(Array) self.reply_to = value end end if attributes.key?(:'from') self.from = attributes[:'from'] end if attributes.key?(:'to') self.to = attributes[:'to'] 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 @to.nil? invalid_properties.push('invalid value for "to", to 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 @to.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 && cc == o.cc && send_id == o.send_id && bcc == o.bcc && reply_to == o.reply_to && from == o.from && to == o.to 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 [cc, send_id, bcc, reply_to, from, to].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::Marketing::Transactional.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/marketing/transactional/models/smtp_api_token_view.rb
lib/hubspot/codegen/marketing/transactional/models/smtp_api_token_view.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional # A SMTP API token provides both an ID and password that can be used to send email through the HubSpot SMTP API. class SmtpApiTokenView # Timestamp generated when a token is created. attr_accessor :created_at # Password used to log into the HubSpot SMTP server. attr_accessor :password # Email address of the user that sent the token creation request. attr_accessor :created_by # Indicates whether a contact should be created for email recipients. attr_accessor :create_contact # User name to log into the HubSpot SMTP server. attr_accessor :id # Identifier assigned to the campaign provided in the token creation request. attr_accessor :email_campaign_id # A name for the campaign tied to the token. attr_accessor :campaign_name # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'created_at' => :'createdAt', :'password' => :'password', :'created_by' => :'createdBy', :'create_contact' => :'createContact', :'id' => :'id', :'email_campaign_id' => :'emailCampaignId', :'campaign_name' => :'campaignName' } 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 { :'created_at' => :'Time', :'password' => :'String', :'created_by' => :'String', :'create_contact' => :'Boolean', :'id' => :'String', :'email_campaign_id' => :'String', :'campaign_name' => :'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::Marketing::Transactional::SmtpApiTokenView` 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::Marketing::Transactional::SmtpApiTokenView`. 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?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'password') self.password = attributes[:'password'] end if attributes.key?(:'created_by') self.created_by = attributes[:'created_by'] end if attributes.key?(:'create_contact') self.create_contact = attributes[:'create_contact'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'email_campaign_id') self.email_campaign_id = attributes[:'email_campaign_id'] end if attributes.key?(:'campaign_name') self.campaign_name = attributes[:'campaign_name'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end if @created_by.nil? invalid_properties.push('invalid value for "created_by", created_by cannot be nil.') end if @create_contact.nil? invalid_properties.push('invalid value for "create_contact", create_contact cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @email_campaign_id.nil? invalid_properties.push('invalid value for "email_campaign_id", email_campaign_id cannot be nil.') end if @campaign_name.nil? invalid_properties.push('invalid value for "campaign_name", campaign_name 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 @created_at.nil? return false if @created_by.nil? return false if @create_contact.nil? return false if @id.nil? return false if @email_campaign_id.nil? return false if @campaign_name.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 && created_at == o.created_at && password == o.password && created_by == o.created_by && create_contact == o.create_contact && id == o.id && email_campaign_id == o.email_campaign_id && campaign_name == o.campaign_name 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 [created_at, password, created_by, create_contact, id, email_campaign_id, campaign_name].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::Marketing::Transactional.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/marketing/transactional/models/public_single_send_request_egg.rb
lib/hubspot/codegen/marketing/transactional/models/public_single_send_request_egg.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional # A request to send a single transactional email asynchronously. class PublicSingleSendRequestEgg # The customProperties field is a map of property values. Each property value contains a name and value property. Each property will be visible in the template under {{ custom.NAME }}. Note: Custom properties do not currently support arrays. To provide a listing in an email, one workaround is to build an HTML list (either with tables or ul) and specify it as a custom property. attr_accessor :custom_properties # The content ID for the transactional email, which can be found in email tool UI. attr_accessor :email_id attr_accessor :message # The contactProperties field is a map of contact property values. Each contact property value contains a name and value property. Each property will get set on the contact record and will be visible in the template under {{ contact.NAME }}. Use these properties when you want to set a contact property while you’re sending the email. For example, when sending a reciept you may want to set a last_paid_date property, as the sending of the receipt will have information about the last payment. attr_accessor :contact_properties # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'custom_properties' => :'customProperties', :'email_id' => :'emailId', :'message' => :'message', :'contact_properties' => :'contactProperties' } 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 { :'custom_properties' => :'Hash<String, Object>', :'email_id' => :'Integer', :'message' => :'PublicSingleSendEmail', :'contact_properties' => :'Hash<String, 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::Marketing::Transactional::PublicSingleSendRequestEgg` 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::Marketing::Transactional::PublicSingleSendRequestEgg`. 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?(:'custom_properties') if (value = attributes[:'custom_properties']).is_a?(Hash) self.custom_properties = value end end if attributes.key?(:'email_id') self.email_id = attributes[:'email_id'] end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'contact_properties') if (value = attributes[:'contact_properties']).is_a?(Hash) self.contact_properties = 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 @email_id.nil? invalid_properties.push('invalid value for "email_id", email_id cannot be nil.') end 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 @email_id.nil? 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 && custom_properties == o.custom_properties && email_id == o.email_id && message == o.message && contact_properties == o.contact_properties 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 [custom_properties, email_id, message, contact_properties].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::Marketing::Transactional.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/marketing/transactional/models/smtp_api_token_request_egg.rb
lib/hubspot/codegen/marketing/transactional/models/smtp_api_token_request_egg.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional # A request object to create a SMTP API token class SmtpApiTokenRequestEgg # Indicates whether a contact should be created for email recipients. attr_accessor :create_contact # A name for the campaign tied to the SMTP API token. attr_accessor :campaign_name # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'create_contact' => :'createContact', :'campaign_name' => :'campaignName' } 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 { :'create_contact' => :'Boolean', :'campaign_name' => :'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::Marketing::Transactional::SmtpApiTokenRequestEgg` 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::Marketing::Transactional::SmtpApiTokenRequestEgg`. 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?(:'create_contact') self.create_contact = attributes[:'create_contact'] end if attributes.key?(:'campaign_name') self.campaign_name = attributes[:'campaign_name'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new if @create_contact.nil? invalid_properties.push('invalid value for "create_contact", create_contact cannot be nil.') end if @campaign_name.nil? invalid_properties.push('invalid value for "campaign_name", campaign_name 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 @create_contact.nil? return false if @campaign_name.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 && create_contact == o.create_contact && campaign_name == o.campaign_name 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 [create_contact, campaign_name].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::Marketing::Transactional.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/marketing/transactional/models/next_page.rb
lib/hubspot/codegen/marketing/transactional/models/next_page.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional 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::Marketing::Transactional::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::Marketing::Transactional::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::Marketing::Transactional.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/marketing/transactional/models/collection_response_smtp_api_token_view_forward_paging.rb
lib/hubspot/codegen/marketing/transactional/models/collection_response_smtp_api_token_view_forward_paging.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional class CollectionResponseSmtpApiTokenViewForwardPaging attr_accessor :paging attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'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 { :'paging' => :'ForwardPaging', :'results' => :'Array<SmtpApiTokenView>' } 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::Marketing::Transactional::CollectionResponseSmtpApiTokenViewForwardPaging` 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::Marketing::Transactional::CollectionResponseSmtpApiTokenViewForwardPaging`. 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?(:'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 @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 @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 && 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 [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::Marketing::Transactional.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/marketing/transactional/models/event_id_view.rb
lib/hubspot/codegen/marketing/transactional/models/event_id_view.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional # The ID of a send event. class EventIdView # Time of event creation. attr_accessor :created # Identifier of event. attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'created' => :'created', :'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 { :'created' => :'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::Marketing::Transactional::EventIdView` 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::Marketing::Transactional::EventIdView`. 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?(:'created') self.created = attributes[:'created'] 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 @created.nil? invalid_properties.push('invalid value for "created", created 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 @created.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 && created == o.created && 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 [created, 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::Marketing::Transactional.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/marketing/transactional/models/error_detail.rb
lib/hubspot/codegen/marketing/transactional/models/error_detail.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional 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::Marketing::Transactional::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::Marketing::Transactional::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::Marketing::Transactional.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/marketing/transactional/models/forward_paging.rb
lib/hubspot/codegen/marketing/transactional/models/forward_paging.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional 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::Marketing::Transactional::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::Marketing::Transactional::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::Marketing::Transactional.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/marketing/transactional/models/email_send_status_view.rb
lib/hubspot/codegen/marketing/transactional/models/email_send_status_view.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional # Describes the status of an email send request. class EmailSendStatusView attr_accessor :event_id # Time when the send was completed. attr_accessor :completed_at # Identifier used to query the status of the send. attr_accessor :status_id # Result of the send. attr_accessor :send_result # Time when the send was requested. attr_accessor :requested_at # Time when the send began processing. attr_accessor :started_at # Status of the send request. 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 { :'event_id' => :'eventId', :'completed_at' => :'completedAt', :'status_id' => :'statusId', :'send_result' => :'sendResult', :'requested_at' => :'requestedAt', :'started_at' => :'startedAt', :'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 { :'event_id' => :'EventIdView', :'completed_at' => :'Time', :'status_id' => :'String', :'send_result' => :'String', :'requested_at' => :'Time', :'started_at' => :'Time', :'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::Marketing::Transactional::EmailSendStatusView` 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::Marketing::Transactional::EmailSendStatusView`. 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?(:'event_id') self.event_id = attributes[:'event_id'] end if attributes.key?(:'completed_at') self.completed_at = attributes[:'completed_at'] end if attributes.key?(:'status_id') self.status_id = attributes[:'status_id'] end if attributes.key?(:'send_result') self.send_result = attributes[:'send_result'] 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?(:'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 @status_id.nil? invalid_properties.push('invalid value for "status_id", status_id 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 @status_id.nil? send_result_validator = EnumAttributeValidator.new('String', ["SENT", "IDEMPOTENT_IGNORE", "QUEUED", "IDEMPOTENT_FAIL", "THROTTLED", "EMAIL_DISABLED", "PORTAL_SUSPENDED", "INVALID_TO_ADDRESS", "BLOCKED_DOMAIN", "PREVIOUSLY_BOUNCED", "EMAIL_UNCONFIRMED", "PREVIOUS_SPAM", "PREVIOUSLY_UNSUBSCRIBED_MESSAGE", "PREVIOUSLY_UNSUBSCRIBED_PORTAL", "INVALID_FROM_ADDRESS", "CAMPAIGN_CANCELLED", "VALIDATION_FAILED", "MTA_IGNORE", "BLOCKED_ADDRESS", "PORTAL_OVER_LIMIT", "PORTAL_EXPIRED", "PORTAL_MISSING_MARKETING_SCOPE", "MISSING_TEMPLATE_PROPERTIES", "MISSING_REQUIRED_PARAMETER", "PORTAL_AUTHENTICATION_FAILURE", "MISSING_CONTENT", "CORRUPT_INPUT", "TEMPLATE_RENDER_EXCEPTION", "GRAYMAIL_SUPPRESSED", "UNCONFIGURED_SENDING_DOMAIN", "UNDELIVERABLE", "CANCELLED_ABUSE", "QUARANTINED_ADDRESS", "ADDRESS_ONLY_ACCEPTED_ON_PROD", "PORTAL_NOT_AUTHORIZED_FOR_APPLICATION", "ADDRESS_LIST_BOMBED", "ADDRESS_OPTED_OUT", "RECIPIENT_FATIGUE_SUPPRESSED", "TOO_MANY_RECIPIENTS", "PREVIOUSLY_UNSUBSCRIBED_BRAND", "NON_MARKETABLE_CONTACT", "PREVIOUSLY_UNSUBSCRIBED_BUSINESS_UNIT", "GDPR_DOI_ENABLED"]) return false unless send_result_validator.valid?(@send_result) 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] send_result Object to be assigned def send_result=(send_result) validator = EnumAttributeValidator.new('String', ["SENT", "IDEMPOTENT_IGNORE", "QUEUED", "IDEMPOTENT_FAIL", "THROTTLED", "EMAIL_DISABLED", "PORTAL_SUSPENDED", "INVALID_TO_ADDRESS", "BLOCKED_DOMAIN", "PREVIOUSLY_BOUNCED", "EMAIL_UNCONFIRMED", "PREVIOUS_SPAM", "PREVIOUSLY_UNSUBSCRIBED_MESSAGE", "PREVIOUSLY_UNSUBSCRIBED_PORTAL", "INVALID_FROM_ADDRESS", "CAMPAIGN_CANCELLED", "VALIDATION_FAILED", "MTA_IGNORE", "BLOCKED_ADDRESS", "PORTAL_OVER_LIMIT", "PORTAL_EXPIRED", "PORTAL_MISSING_MARKETING_SCOPE", "MISSING_TEMPLATE_PROPERTIES", "MISSING_REQUIRED_PARAMETER", "PORTAL_AUTHENTICATION_FAILURE", "MISSING_CONTENT", "CORRUPT_INPUT", "TEMPLATE_RENDER_EXCEPTION", "GRAYMAIL_SUPPRESSED", "UNCONFIGURED_SENDING_DOMAIN", "UNDELIVERABLE", "CANCELLED_ABUSE", "QUARANTINED_ADDRESS", "ADDRESS_ONLY_ACCEPTED_ON_PROD", "PORTAL_NOT_AUTHORIZED_FOR_APPLICATION", "ADDRESS_LIST_BOMBED", "ADDRESS_OPTED_OUT", "RECIPIENT_FATIGUE_SUPPRESSED", "TOO_MANY_RECIPIENTS", "PREVIOUSLY_UNSUBSCRIBED_BRAND", "NON_MARKETABLE_CONTACT", "PREVIOUSLY_UNSUBSCRIBED_BUSINESS_UNIT", "GDPR_DOI_ENABLED"]) unless validator.valid?(send_result) fail ArgumentError, "invalid value for \"send_result\", must be one of #{validator.allowable_values}." end @send_result = send_result 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 && event_id == o.event_id && completed_at == o.completed_at && status_id == o.status_id && send_result == o.send_result && requested_at == o.requested_at && started_at == o.started_at && 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 [event_id, completed_at, status_id, send_result, requested_at, started_at, 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::Marketing::Transactional.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/marketing/transactional/models/error.rb
lib/hubspot/codegen/marketing/transactional/models/error.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'date' require 'time' module Hubspot module Marketing module Transactional 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::Marketing::Transactional::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::Marketing::Transactional::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::Marketing::Transactional.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/marketing/transactional/api/public_smtp_tokens_api.rb
lib/hubspot/codegen/marketing/transactional/api/public_smtp_tokens_api.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Transactional class PublicSMTPTokensApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete a single token by ID. # Delete a single token by ID. # @param token_id [String] Identifier generated when a token is created. # @param [Hash] opts the optional parameters # @return [nil] def archive_token(token_id, opts = {}) archive_token_with_http_info(token_id, opts) nil end # Delete a single token by ID. # Delete a single token by ID. # @param token_id [String] Identifier generated when a token is created. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_token_with_http_info(token_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicSMTPTokensApi.archive_token ...' end # verify the required parameter 'token_id' is set if @api_client.config.client_side_validation && token_id.nil? fail ArgumentError, "Missing the required parameter 'token_id' when calling PublicSMTPTokensApi.archive_token" end # resource path local_var_path = '/marketing/v3/transactional/smtp-tokens/{tokenId}'.sub('{' + 'tokenId' + '}', CGI.escape(token_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 => :"PublicSMTPTokensApi.archive_token", :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: PublicSMTPTokensApi#archive_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a SMTP API token. # Create a SMTP API token. # @param smtp_api_token_request_egg [SmtpApiTokenRequestEgg] A request object that includes the campaign name tied to the token and whether contacts should be created for email recipients. # @param [Hash] opts the optional parameters # @return [SmtpApiTokenView] def create_token(smtp_api_token_request_egg, opts = {}) data, _status_code, _headers = create_token_with_http_info(smtp_api_token_request_egg, opts) data end # Create a SMTP API token. # Create a SMTP API token. # @param smtp_api_token_request_egg [SmtpApiTokenRequestEgg] A request object that includes the campaign name tied to the token and whether contacts should be created for email recipients. # @param [Hash] opts the optional parameters # @return [Array<(SmtpApiTokenView, Integer, Hash)>] SmtpApiTokenView data, response status code and response headers def create_token_with_http_info(smtp_api_token_request_egg, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicSMTPTokensApi.create_token ...' end # verify the required parameter 'smtp_api_token_request_egg' is set if @api_client.config.client_side_validation && smtp_api_token_request_egg.nil? fail ArgumentError, "Missing the required parameter 'smtp_api_token_request_egg' when calling PublicSMTPTokensApi.create_token" end # resource path local_var_path = '/marketing/v3/transactional/smtp-tokens' # 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(smtp_api_token_request_egg) # return_type return_type = opts[:debug_return_type] || 'SmtpApiTokenView' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"PublicSMTPTokensApi.create_token", :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: PublicSMTPTokensApi#create_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Query a single token by ID. # Query a single token by ID. # @param token_id [String] Identifier generated when a token is created. # @param [Hash] opts the optional parameters # @return [SmtpApiTokenView] def get_token_by_id(token_id, opts = {}) data, _status_code, _headers = get_token_by_id_with_http_info(token_id, opts) data end # Query a single token by ID. # Query a single token by ID. # @param token_id [String] Identifier generated when a token is created. # @param [Hash] opts the optional parameters # @return [Array<(SmtpApiTokenView, Integer, Hash)>] SmtpApiTokenView data, response status code and response headers def get_token_by_id_with_http_info(token_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicSMTPTokensApi.get_token_by_id ...' end # verify the required parameter 'token_id' is set if @api_client.config.client_side_validation && token_id.nil? fail ArgumentError, "Missing the required parameter 'token_id' when calling PublicSMTPTokensApi.get_token_by_id" end # resource path local_var_path = '/marketing/v3/transactional/smtp-tokens/{tokenId}'.sub('{' + 'tokenId' + '}', CGI.escape(token_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] || 'SmtpApiTokenView' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"PublicSMTPTokensApi.get_token_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: PublicSMTPTokensApi#get_token_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Query SMTP API tokens by campaign name or an emailCampaignId. # Query multiple SMTP API tokens by campaign name or a single token by emailCampaignId. # @param [Hash] opts the optional parameters # @option opts [String] :campaign_name A name for the campaign tied to the SMTP API token. # @option opts [String] :email_campaign_id Identifier assigned to the campaign provided during the token creation. # @option opts [String] :after Starting point to get the next set of results. # @option opts [Integer] :limit Maximum number of tokens to return. # @return [CollectionResponseSmtpApiTokenViewForwardPaging] def get_tokens_page(opts = {}) data, _status_code, _headers = get_tokens_page_with_http_info(opts) data end # Query SMTP API tokens by campaign name or an emailCampaignId. # Query multiple SMTP API tokens by campaign name or a single token by emailCampaignId. # @param [Hash] opts the optional parameters # @option opts [String] :campaign_name A name for the campaign tied to the SMTP API token. # @option opts [String] :email_campaign_id Identifier assigned to the campaign provided during the token creation. # @option opts [String] :after Starting point to get the next set of results. # @option opts [Integer] :limit Maximum number of tokens to return. # @return [Array<(CollectionResponseSmtpApiTokenViewForwardPaging, Integer, Hash)>] CollectionResponseSmtpApiTokenViewForwardPaging data, response status code and response headers def get_tokens_page_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicSMTPTokensApi.get_tokens_page ...' end # resource path local_var_path = '/marketing/v3/transactional/smtp-tokens' # query parameters query_params = opts[:query_params] || {} query_params[:'campaignName'] = opts[:'campaign_name'] if !opts[:'campaign_name'].nil? query_params[:'emailCampaignId'] = opts[:'email_campaign_id'] if !opts[:'email_campaign_id'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].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] || 'CollectionResponseSmtpApiTokenViewForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"PublicSMTPTokensApi.get_tokens_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: PublicSMTPTokensApi#get_tokens_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Reset the password of an existing token. # Allows the creation of a replacement password for a given token. Once the password is successfully reset, the old password for the token will be invalid. # @param token_id [String] Identifier generated when a token is created. # @param [Hash] opts the optional parameters # @return [SmtpApiTokenView] def reset_password(token_id, opts = {}) data, _status_code, _headers = reset_password_with_http_info(token_id, opts) data end # Reset the password of an existing token. # Allows the creation of a replacement password for a given token. Once the password is successfully reset, the old password for the token will be invalid. # @param token_id [String] Identifier generated when a token is created. # @param [Hash] opts the optional parameters # @return [Array<(SmtpApiTokenView, Integer, Hash)>] SmtpApiTokenView data, response status code and response headers def reset_password_with_http_info(token_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicSMTPTokensApi.reset_password ...' end # verify the required parameter 'token_id' is set if @api_client.config.client_side_validation && token_id.nil? fail ArgumentError, "Missing the required parameter 'token_id' when calling PublicSMTPTokensApi.reset_password" end # resource path local_var_path = '/marketing/v3/transactional/smtp-tokens/{tokenId}/password-reset'.sub('{' + 'tokenId' + '}', CGI.escape(token_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] || 'SmtpApiTokenView' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"PublicSMTPTokensApi.reset_password", :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: PublicSMTPTokensApi#reset_password\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/marketing/transactional/api/single_send_api.rb
lib/hubspot/codegen/marketing/transactional/api/single_send_api.rb
=begin #Marketing Transactional Single Send #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: v3 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.2.1 =end require 'cgi' module Hubspot module Marketing module Transactional class SingleSendApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Send a single transactional email asynchronously. # Asynchronously send a transactional email. Returns the status of the email send with a statusId that can be used to continuously query for the status using the Email Send Status API. # @param public_single_send_request_egg [PublicSingleSendRequestEgg] A request object describing the email to send. # @param [Hash] opts the optional parameters # @return [EmailSendStatusView] def send_email(public_single_send_request_egg, opts = {}) data, _status_code, _headers = send_email_with_http_info(public_single_send_request_egg, opts) data end # Send a single transactional email asynchronously. # Asynchronously send a transactional email. Returns the status of the email send with a statusId that can be used to continuously query for the status using the Email Send Status API. # @param public_single_send_request_egg [PublicSingleSendRequestEgg] A request object describing the email to send. # @param [Hash] opts the optional parameters # @return [Array<(EmailSendStatusView, Integer, Hash)>] EmailSendStatusView data, response status code and response headers def send_email_with_http_info(public_single_send_request_egg, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SingleSendApi.send_email ...' end # verify the required parameter 'public_single_send_request_egg' is set if @api_client.config.client_side_validation && public_single_send_request_egg.nil? fail ArgumentError, "Missing the required parameter 'public_single_send_request_egg' when calling SingleSendApi.send_email" end # resource path local_var_path = '/marketing/v3/transactional/single-email/send' # 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(public_single_send_request_egg) # return_type return_type = opts[:debug_return_type] || 'EmailSendStatusView' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"SingleSendApi.send_email", :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: SingleSendApi#send_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/audit_logs/api_error.rb
lib/hubspot/codegen/cms/audit_logs/api_error.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs 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/audit_logs/configuration.rb
lib/hubspot/codegen/cms/audit_logs/configuration.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs 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/audit_logs/api_client.rb
lib/hubspot/codegen/cms/audit_logs/api_client.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs 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::AuditLogs.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/audit_logs/models/previous_page.rb
lib/hubspot/codegen/cms/audit_logs/models/previous_page.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs 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::AuditLogs::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::AuditLogs::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::AuditLogs.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/audit_logs/models/next_page.rb
lib/hubspot/codegen/cms/audit_logs/models/next_page.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs 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::AuditLogs::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::AuditLogs::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::AuditLogs.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/audit_logs/models/paging.rb
lib/hubspot/codegen/cms/audit_logs/models/paging.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs 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::AuditLogs::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::AuditLogs::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::AuditLogs.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/audit_logs/models/error_detail.rb
lib/hubspot/codegen/cms/audit_logs/models/error_detail.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs 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::AuditLogs::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::AuditLogs::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::AuditLogs.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/audit_logs/models/collection_response_public_audit_log.rb
lib/hubspot/codegen/cms/audit_logs/models/collection_response_public_audit_log.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs class CollectionResponsePublicAuditLog attr_accessor :paging # attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'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 { :'paging' => :'Paging', :'results' => :'Array<PublicAuditLog>' } 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::AuditLogs::CollectionResponsePublicAuditLog` 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::AuditLogs::CollectionResponsePublicAuditLog`. 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?(:'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 @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 @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 && 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 [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::AuditLogs.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/audit_logs/models/public_audit_log.rb
lib/hubspot/codegen/cms/audit_logs/models/public_audit_log.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs class PublicAuditLog attr_accessor :meta # The internal name of the object in HubSpot. attr_accessor :object_name # The name of the user who caused the event. attr_accessor :full_name # The type of event that took place (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). attr_accessor :event # The ID of the user who caused the event. attr_accessor :user_id # The ID of the object. attr_accessor :object_id # The type of the object (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) attr_accessor :object_type # The timestamp at which the event occurred. attr_accessor :timestamp 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 { :'meta' => :'meta', :'object_name' => :'objectName', :'full_name' => :'fullName', :'event' => :'event', :'user_id' => :'userId', :'object_id' => :'objectId', :'object_type' => :'objectType', :'timestamp' => :'timestamp' } 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 { :'meta' => :'Object', :'object_name' => :'String', :'full_name' => :'String', :'event' => :'String', :'user_id' => :'String', :'object_id' => :'String', :'object_type' => :'String', :'timestamp' => :'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::AuditLogs::PublicAuditLog` 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::AuditLogs::PublicAuditLog`. 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?(:'meta') self.meta = attributes[:'meta'] end if attributes.key?(:'object_name') self.object_name = attributes[:'object_name'] end if attributes.key?(:'full_name') self.full_name = attributes[:'full_name'] end if attributes.key?(:'event') self.event = attributes[:'event'] end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] end if attributes.key?(:'object_id') self.object_id = attributes[:'object_id'] end if attributes.key?(:'object_type') self.object_type = attributes[:'object_type'] end if attributes.key?(:'timestamp') self.timestamp = attributes[:'timestamp'] 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 @object_name.nil? invalid_properties.push('invalid value for "object_name", object_name cannot be nil.') end if @full_name.nil? invalid_properties.push('invalid value for "full_name", full_name cannot be nil.') end if @event.nil? invalid_properties.push('invalid value for "event", event cannot be nil.') end if @user_id.nil? invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') end if @object_id.nil? invalid_properties.push('invalid value for "object_id", object_id cannot be nil.') end if @object_type.nil? invalid_properties.push('invalid value for "object_type", object_type cannot be nil.') end if @timestamp.nil? invalid_properties.push('invalid value for "timestamp", timestamp 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 @object_name.nil? return false if @full_name.nil? return false if @event.nil? event_validator = EnumAttributeValidator.new('String', ["CREATED", "UPDATED", "PUBLISHED", "DELETED", "UNPUBLISHED", "RESTORE"]) return false unless event_validator.valid?(@event) return false if @user_id.nil? return false if @object_id.nil? return false if @object_type.nil? object_type_validator = EnumAttributeValidator.new('String', ["BLOG", "BLOG_POST", "LANDING_PAGE", "WEBSITE_PAGE", "TEMPLATE", "MODULE", "GLOBAL_MODULE", "SERVERLESS_FUNCTION", "DOMAIN", "URL_MAPPING", "EMAIL", "CONTENT_SETTINGS", "HUBDB_TABLE", "KNOWLEDGE_BASE_ARTICLE", "KNOWLEDGE_BASE", "THEME", "CSS", "JS", "CTA", "FILE"]) return false unless object_type_validator.valid?(@object_type) return false if @timestamp.nil? true end # Custom attribute writer method checking allowed values (enum). # @param [Object] event Object to be assigned def event=(event) validator = EnumAttributeValidator.new('String', ["CREATED", "UPDATED", "PUBLISHED", "DELETED", "UNPUBLISHED", "RESTORE"]) unless validator.valid?(event) fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}." end @event = event end # Custom attribute writer method checking allowed values (enum). # @param [Object] object_type Object to be assigned def object_type=(object_type) validator = EnumAttributeValidator.new('String', ["BLOG", "BLOG_POST", "LANDING_PAGE", "WEBSITE_PAGE", "TEMPLATE", "MODULE", "GLOBAL_MODULE", "SERVERLESS_FUNCTION", "DOMAIN", "URL_MAPPING", "EMAIL", "CONTENT_SETTINGS", "HUBDB_TABLE", "KNOWLEDGE_BASE_ARTICLE", "KNOWLEDGE_BASE", "THEME", "CSS", "JS", "CTA", "FILE"]) unless validator.valid?(object_type) fail ArgumentError, "invalid value for \"object_type\", must be one of #{validator.allowable_values}." end @object_type = object_type 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 && meta == o.meta && object_name == o.object_name && full_name == o.full_name && event == o.event && user_id == o.user_id && object_id == o.object_id && object_type == o.object_type && timestamp == o.timestamp 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 [meta, object_name, full_name, event, user_id, object_id, object_type, timestamp].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::AuditLogs.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/audit_logs/models/error.rb
lib/hubspot/codegen/cms/audit_logs/models/error.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs 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::AuditLogs::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::AuditLogs::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::AuditLogs.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/audit_logs/api/audit_logs_api.rb
lib/hubspot/codegen/cms/audit_logs/api/audit_logs_api.rb
=begin #Cms Content Audit #Use this endpoint to query audit logs of CMS changes that occurred on your HubSpot account. 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 AuditLogs class AuditLogsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Query audit logs # Returns audit logs based on filters. # @param [Hash] opts the optional parameters # @option opts [Array<String>] :user_id Comma separated list of user ids to filter by. # @option opts [Array<String>] :event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). # @option opts [Array<String>] :object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) # @option opts [Array<String>] :object_id Comma separated list of object ids to filter by. # @option opts [String] :after Timestamp after which audit logs will be returned # @option opts [String] :before Timestamp before which audit logs will be returned # @option opts [Integer] :limit The number of logs to return. # @option opts [Array<String>] :sort The sort direction for the audit logs. (Can only sort by timestamp). # @return [CollectionResponsePublicAuditLog] def get_page(opts = {}) data, _status_code, _headers = get_page_with_http_info(opts) data end # Query audit logs # Returns audit logs based on filters. # @param [Hash] opts the optional parameters # @option opts [Array<String>] :user_id Comma separated list of user ids to filter by. # @option opts [Array<String>] :event_type Comma separated list of event types to filter by (CREATED, UPDATED, PUBLISHED, DELETED, UNPUBLISHED). # @option opts [Array<String>] :object_type Comma separated list of object types to filter by (BLOG, LANDING_PAGE, DOMAIN, HUBDB_TABLE etc.) # @option opts [Array<String>] :object_id Comma separated list of object ids to filter by. # @option opts [String] :after Timestamp after which audit logs will be returned # @option opts [String] :before Timestamp before which audit logs will be returned # @option opts [Integer] :limit The number of logs to return. # @option opts [Array<String>] :sort The sort direction for the audit logs. (Can only sort by timestamp). # @return [Array<(CollectionResponsePublicAuditLog, Integer, Hash)>] CollectionResponsePublicAuditLog 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: AuditLogsApi.get_page ...' end # resource path local_var_path = '/cms/v3/audit-logs/' # query parameters query_params = opts[:query_params] || {} query_params[:'userId'] = @api_client.build_collection_param(opts[:'user_id'], :multi) if !opts[:'user_id'].nil? query_params[:'eventType'] = @api_client.build_collection_param(opts[:'event_type'], :multi) if !opts[:'event_type'].nil? query_params[:'objectType'] = @api_client.build_collection_param(opts[:'object_type'], :multi) if !opts[:'object_type'].nil? query_params[:'objectId'] = @api_client.build_collection_param(opts[:'object_id'], :multi) if !opts[:'object_id'].nil? 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? query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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] || 'CollectionResponsePublicAuditLog' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"AuditLogsApi.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: AuditLogsApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/url_redirects/api_error.rb
lib/hubspot/codegen/cms/url_redirects/api_error.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects 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/url_redirects/configuration.rb
lib/hubspot/codegen/cms/url_redirects/configuration.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects 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/url_redirects/api_client.rb
lib/hubspot/codegen/cms/url_redirects/api_client.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects 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::UrlRedirects.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/url_redirects/models/next_page.rb
lib/hubspot/codegen/cms/url_redirects/models/next_page.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects 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::UrlRedirects::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::UrlRedirects::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::UrlRedirects.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/url_redirects/models/url_mapping_create_request_body.rb
lib/hubspot/codegen/cms/url_redirects/models/url_mapping_create_request_body.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects class UrlMappingCreateRequestBody attr_accessor :is_trailing_slash_optional attr_accessor :is_match_query_string attr_accessor :redirect_style attr_accessor :route_prefix attr_accessor :is_match_full_url attr_accessor :is_protocol_agnostic attr_accessor :destination attr_accessor :is_only_after_not_found attr_accessor :is_pattern attr_accessor :precedence # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'is_trailing_slash_optional' => :'isTrailingSlashOptional', :'is_match_query_string' => :'isMatchQueryString', :'redirect_style' => :'redirectStyle', :'route_prefix' => :'routePrefix', :'is_match_full_url' => :'isMatchFullUrl', :'is_protocol_agnostic' => :'isProtocolAgnostic', :'destination' => :'destination', :'is_only_after_not_found' => :'isOnlyAfterNotFound', :'is_pattern' => :'isPattern', :'precedence' => :'precedence' } 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 { :'is_trailing_slash_optional' => :'Boolean', :'is_match_query_string' => :'Boolean', :'redirect_style' => :'Integer', :'route_prefix' => :'String', :'is_match_full_url' => :'Boolean', :'is_protocol_agnostic' => :'Boolean', :'destination' => :'String', :'is_only_after_not_found' => :'Boolean', :'is_pattern' => :'Boolean', :'precedence' => :'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::UrlRedirects::UrlMappingCreateRequestBody` 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::UrlRedirects::UrlMappingCreateRequestBody`. 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?(:'is_trailing_slash_optional') self.is_trailing_slash_optional = attributes[:'is_trailing_slash_optional'] end if attributes.key?(:'is_match_query_string') self.is_match_query_string = attributes[:'is_match_query_string'] end if attributes.key?(:'redirect_style') self.redirect_style = attributes[:'redirect_style'] end if attributes.key?(:'route_prefix') self.route_prefix = attributes[:'route_prefix'] end if attributes.key?(:'is_match_full_url') self.is_match_full_url = attributes[:'is_match_full_url'] end if attributes.key?(:'is_protocol_agnostic') self.is_protocol_agnostic = attributes[:'is_protocol_agnostic'] end if attributes.key?(:'destination') self.destination = attributes[:'destination'] end if attributes.key?(:'is_only_after_not_found') self.is_only_after_not_found = attributes[:'is_only_after_not_found'] end if attributes.key?(:'is_pattern') self.is_pattern = attributes[:'is_pattern'] end if attributes.key?(:'precedence') self.precedence = attributes[:'precedence'] 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 @redirect_style.nil? invalid_properties.push('invalid value for "redirect_style", redirect_style cannot be nil.') end if @route_prefix.nil? invalid_properties.push('invalid value for "route_prefix", route_prefix cannot be nil.') end if @destination.nil? invalid_properties.push('invalid value for "destination", destination 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 @redirect_style.nil? return false if @route_prefix.nil? return false if @destination.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 && is_trailing_slash_optional == o.is_trailing_slash_optional && is_match_query_string == o.is_match_query_string && redirect_style == o.redirect_style && route_prefix == o.route_prefix && is_match_full_url == o.is_match_full_url && is_protocol_agnostic == o.is_protocol_agnostic && destination == o.destination && is_only_after_not_found == o.is_only_after_not_found && is_pattern == o.is_pattern && precedence == o.precedence 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 [is_trailing_slash_optional, is_match_query_string, redirect_style, route_prefix, is_match_full_url, is_protocol_agnostic, destination, is_only_after_not_found, is_pattern, precedence].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::UrlRedirects.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/url_redirects/models/collection_response_with_total_url_mapping_forward_paging.rb
lib/hubspot/codegen/cms/url_redirects/models/collection_response_with_total_url_mapping_forward_paging.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects class CollectionResponseWithTotalUrlMappingForwardPaging attr_accessor :total attr_accessor :paging 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<UrlMapping>' } 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::UrlRedirects::CollectionResponseWithTotalUrlMappingForwardPaging` 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::UrlRedirects::CollectionResponseWithTotalUrlMappingForwardPaging`. 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::UrlRedirects.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/url_redirects/models/error_detail.rb
lib/hubspot/codegen/cms/url_redirects/models/error_detail.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects 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::UrlRedirects::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::UrlRedirects::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::UrlRedirects.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/url_redirects/models/url_mapping.rb
lib/hubspot/codegen/cms/url_redirects/models/url_mapping.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects class UrlMapping # Whether a trailing slash will be ignored. attr_accessor :is_trailing_slash_optional # The type of redirect to create. Options include: 301 (permanent), 302 (temporary), or 305 (proxy). Find more details [here](https://knowledge.hubspot.com/cos-general/how-to-redirect-a-hubspot-page). attr_accessor :redirect_style # Whether the `routePrefix` should match on the entire URL path, including the query string. attr_accessor :is_match_query_string attr_accessor :created # Whether the `routePrefix` should match on the entire URL, including the domain. attr_accessor :is_match_full_url # The destination URL, where the target URL should be redirected if it matches the `routePrefix`. attr_accessor :destination # Whether the URL redirect mapping should apply only if a live page on the URL isn't found. If False, the URL redirect mapping will take precedence over any existing page. attr_accessor :is_only_after_not_found # Whether the `routePrefix` should match based on pattern. attr_accessor :is_pattern # Used to prioritize URL redirection. If a given URL matches more than one redirect, the one with the **lower** precedence will be used. attr_accessor :precedence # The target incoming URL, path, or pattern to match for redirection. attr_accessor :route_prefix # Whether the `routePrefix` should match both HTTP and HTTPS protocols. attr_accessor :is_protocol_agnostic # The unique ID of this URL redirect. attr_accessor :id attr_accessor :updated # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'is_trailing_slash_optional' => :'isTrailingSlashOptional', :'redirect_style' => :'redirectStyle', :'is_match_query_string' => :'isMatchQueryString', :'created' => :'created', :'is_match_full_url' => :'isMatchFullUrl', :'destination' => :'destination', :'is_only_after_not_found' => :'isOnlyAfterNotFound', :'is_pattern' => :'isPattern', :'precedence' => :'precedence', :'route_prefix' => :'routePrefix', :'is_protocol_agnostic' => :'isProtocolAgnostic', :'id' => :'id', :'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 { :'is_trailing_slash_optional' => :'Boolean', :'redirect_style' => :'Integer', :'is_match_query_string' => :'Boolean', :'created' => :'Time', :'is_match_full_url' => :'Boolean', :'destination' => :'String', :'is_only_after_not_found' => :'Boolean', :'is_pattern' => :'Boolean', :'precedence' => :'Integer', :'route_prefix' => :'String', :'is_protocol_agnostic' => :'Boolean', :'id' => :'String', :'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::UrlRedirects::UrlMapping` 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::UrlRedirects::UrlMapping`. 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?(:'is_trailing_slash_optional') self.is_trailing_slash_optional = attributes[:'is_trailing_slash_optional'] end if attributes.key?(:'redirect_style') self.redirect_style = attributes[:'redirect_style'] end if attributes.key?(:'is_match_query_string') self.is_match_query_string = attributes[:'is_match_query_string'] end if attributes.key?(:'created') self.created = attributes[:'created'] end if attributes.key?(:'is_match_full_url') self.is_match_full_url = attributes[:'is_match_full_url'] end if attributes.key?(:'destination') self.destination = attributes[:'destination'] end if attributes.key?(:'is_only_after_not_found') self.is_only_after_not_found = attributes[:'is_only_after_not_found'] end if attributes.key?(:'is_pattern') self.is_pattern = attributes[:'is_pattern'] end if attributes.key?(:'precedence') self.precedence = attributes[:'precedence'] end if attributes.key?(:'route_prefix') self.route_prefix = attributes[:'route_prefix'] end if attributes.key?(:'is_protocol_agnostic') self.is_protocol_agnostic = attributes[:'is_protocol_agnostic'] end if attributes.key?(:'id') self.id = attributes[:'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 @is_trailing_slash_optional.nil? invalid_properties.push('invalid value for "is_trailing_slash_optional", is_trailing_slash_optional cannot be nil.') end if @redirect_style.nil? invalid_properties.push('invalid value for "redirect_style", redirect_style cannot be nil.') end if @is_match_query_string.nil? invalid_properties.push('invalid value for "is_match_query_string", is_match_query_string cannot be nil.') end if @is_match_full_url.nil? invalid_properties.push('invalid value for "is_match_full_url", is_match_full_url cannot be nil.') end if @destination.nil? invalid_properties.push('invalid value for "destination", destination cannot be nil.') end if @is_only_after_not_found.nil? invalid_properties.push('invalid value for "is_only_after_not_found", is_only_after_not_found cannot be nil.') end if @is_pattern.nil? invalid_properties.push('invalid value for "is_pattern", is_pattern cannot be nil.') end if @precedence.nil? invalid_properties.push('invalid value for "precedence", precedence cannot be nil.') end if @route_prefix.nil? invalid_properties.push('invalid value for "route_prefix", route_prefix cannot be nil.') end if @is_protocol_agnostic.nil? invalid_properties.push('invalid value for "is_protocol_agnostic", is_protocol_agnostic 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 @is_trailing_slash_optional.nil? return false if @redirect_style.nil? return false if @is_match_query_string.nil? return false if @is_match_full_url.nil? return false if @destination.nil? return false if @is_only_after_not_found.nil? return false if @is_pattern.nil? return false if @precedence.nil? return false if @route_prefix.nil? return false if @is_protocol_agnostic.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 && is_trailing_slash_optional == o.is_trailing_slash_optional && redirect_style == o.redirect_style && is_match_query_string == o.is_match_query_string && created == o.created && is_match_full_url == o.is_match_full_url && destination == o.destination && is_only_after_not_found == o.is_only_after_not_found && is_pattern == o.is_pattern && precedence == o.precedence && route_prefix == o.route_prefix && is_protocol_agnostic == o.is_protocol_agnostic && id == o.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 [is_trailing_slash_optional, redirect_style, is_match_query_string, created, is_match_full_url, destination, is_only_after_not_found, is_pattern, precedence, route_prefix, is_protocol_agnostic, 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::UrlRedirects.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/url_redirects/models/forward_paging.rb
lib/hubspot/codegen/cms/url_redirects/models/forward_paging.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects 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::UrlRedirects::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::UrlRedirects::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::UrlRedirects.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/url_redirects/models/error.rb
lib/hubspot/codegen/cms/url_redirects/models/error.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects 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::UrlRedirects::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::UrlRedirects::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::UrlRedirects.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/url_redirects/api/redirects_api.rb
lib/hubspot/codegen/cms/url_redirects/api/redirects_api.rb
=begin #CMS Url Redirects #URL redirect operations 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 UrlRedirects class RedirectsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete a redirect # Delete one existing redirect, so it is no longer mapped. # @param url_redirect_id [String] The ID of the target redirect. # @param [Hash] opts the optional parameters # @return [nil] def archive(url_redirect_id, opts = {}) archive_with_http_info(url_redirect_id, opts) nil end # Delete a redirect # Delete one existing redirect, so it is no longer mapped. # @param url_redirect_id [String] The ID of the target redirect. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def archive_with_http_info(url_redirect_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedirectsApi.archive ...' end # verify the required parameter 'url_redirect_id' is set if @api_client.config.client_side_validation && url_redirect_id.nil? fail ArgumentError, "Missing the required parameter 'url_redirect_id' when calling RedirectsApi.archive" end # resource path local_var_path = '/cms/v3/url-redirects/{urlRedirectId}'.sub('{' + 'urlRedirectId' + '}', CGI.escape(url_redirect_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 => :"RedirectsApi.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: RedirectsApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a redirect # Creates and configures a new URL redirect. # @param url_mapping_create_request_body [UrlMappingCreateRequestBody] # @param [Hash] opts the optional parameters # @return [UrlMapping] def create(url_mapping_create_request_body, opts = {}) data, _status_code, _headers = create_with_http_info(url_mapping_create_request_body, opts) data end # Create a redirect # Creates and configures a new URL redirect. # @param url_mapping_create_request_body [UrlMappingCreateRequestBody] # @param [Hash] opts the optional parameters # @return [Array<(UrlMapping, Integer, Hash)>] UrlMapping data, response status code and response headers def create_with_http_info(url_mapping_create_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedirectsApi.create ...' end # verify the required parameter 'url_mapping_create_request_body' is set if @api_client.config.client_side_validation && url_mapping_create_request_body.nil? fail ArgumentError, "Missing the required parameter 'url_mapping_create_request_body' when calling RedirectsApi.create" end # resource path local_var_path = '/cms/v3/url-redirects/' # 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(url_mapping_create_request_body) # return_type return_type = opts[:debug_return_type] || 'UrlMapping' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RedirectsApi.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: RedirectsApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get details for a redirect # Returns the details for a single existing URL redirect by ID. # @param url_redirect_id [String] The ID of the target redirect. # @param [Hash] opts the optional parameters # @return [UrlMapping] def get_by_id(url_redirect_id, opts = {}) data, _status_code, _headers = get_by_id_with_http_info(url_redirect_id, opts) data end # Get details for a redirect # Returns the details for a single existing URL redirect by ID. # @param url_redirect_id [String] The ID of the target redirect. # @param [Hash] opts the optional parameters # @return [Array<(UrlMapping, Integer, Hash)>] UrlMapping data, response status code and response headers def get_by_id_with_http_info(url_redirect_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedirectsApi.get_by_id ...' end # verify the required parameter 'url_redirect_id' is set if @api_client.config.client_side_validation && url_redirect_id.nil? fail ArgumentError, "Missing the required parameter 'url_redirect_id' when calling RedirectsApi.get_by_id" end # resource path local_var_path = '/cms/v3/url-redirects/{urlRedirectId}'.sub('{' + 'urlRedirectId' + '}', CGI.escape(url_redirect_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] || 'UrlMapping' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RedirectsApi.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: RedirectsApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get current redirects # Returns all existing URL redirects. Results can be limited and filtered by creation or updated date. # @param [Hash] opts the optional parameters # @option opts [Time] :created_at Only return redirects created on exactly this date. # @option opts [Time] :created_after Only return redirects created after this date. # @option opts [Time] :created_before Only return redirects created before this date. # @option opts [Time] :updated_at Only return redirects last updated on exactly this date. # @option opts [Time] :updated_after Only return redirects last updated after this date. # @option opts [Time] :updated_before Only return redirects last updated before this date. # @option opts [Array<String>] :sort # @option opts [String] :after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [Integer] :limit Maximum number of result per page # @option opts [Boolean] :archived Whether to return only results that have been archived. # @return [CollectionResponseWithTotalUrlMappingForwardPaging] def get_page(opts = {}) data, _status_code, _headers = get_page_with_http_info(opts) data end # Get current redirects # Returns all existing URL redirects. Results can be limited and filtered by creation or updated date. # @param [Hash] opts the optional parameters # @option opts [Time] :created_at Only return redirects created on exactly this date. # @option opts [Time] :created_after Only return redirects created after this date. # @option opts [Time] :created_before Only return redirects created before this date. # @option opts [Time] :updated_at Only return redirects last updated on exactly this date. # @option opts [Time] :updated_after Only return redirects last updated after this date. # @option opts [Time] :updated_before Only return redirects last updated before this date. # @option opts [Array<String>] :sort # @option opts [String] :after The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results. # @option opts [Integer] :limit Maximum number of result per page # @option opts [Boolean] :archived Whether to return only results that have been archived. # @return [Array<(CollectionResponseWithTotalUrlMappingForwardPaging, Integer, Hash)>] CollectionResponseWithTotalUrlMappingForwardPaging 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: RedirectsApi.get_page ...' end # resource path local_var_path = '/cms/v3/url-redirects/' # 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? # 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] || 'CollectionResponseWithTotalUrlMappingForwardPaging' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RedirectsApi.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: RedirectsApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a redirect # Updates the settings for an existing URL redirect. # @param url_redirect_id [String] # @param url_mapping [UrlMapping] # @param [Hash] opts the optional parameters # @return [UrlMapping] def update(url_redirect_id, url_mapping, opts = {}) data, _status_code, _headers = update_with_http_info(url_redirect_id, url_mapping, opts) data end # Update a redirect # Updates the settings for an existing URL redirect. # @param url_redirect_id [String] # @param url_mapping [UrlMapping] # @param [Hash] opts the optional parameters # @return [Array<(UrlMapping, Integer, Hash)>] UrlMapping data, response status code and response headers def update_with_http_info(url_redirect_id, url_mapping, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RedirectsApi.update ...' end # verify the required parameter 'url_redirect_id' is set if @api_client.config.client_side_validation && url_redirect_id.nil? fail ArgumentError, "Missing the required parameter 'url_redirect_id' when calling RedirectsApi.update" end # verify the required parameter 'url_mapping' is set if @api_client.config.client_side_validation && url_mapping.nil? fail ArgumentError, "Missing the required parameter 'url_mapping' when calling RedirectsApi.update" end # resource path local_var_path = '/cms/v3/url-redirects/{urlRedirectId}'.sub('{' + 'urlRedirectId' + '}', CGI.escape(url_redirect_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', '*/*']) # 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(url_mapping) # return_type return_type = opts[:debug_return_type] || 'UrlMapping' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"RedirectsApi.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(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RedirectsApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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/site_search/api_error.rb
lib/hubspot/codegen/cms/site_search/api_error.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch 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/site_search/configuration.rb
lib/hubspot/codegen/cms/site_search/configuration.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch 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/site_search/api_client.rb
lib/hubspot/codegen/cms/site_search/api_client.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch 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::SiteSearch.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/site_search/models/content_search_result.rb
lib/hubspot/codegen/cms/site_search/models/content_search_result.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch class ContentSearchResult # The ID of the document in HubSpot. attr_accessor :combined_id # The result's description. The content will be determined by the value of `length` in the request. attr_accessor :description # The document's language. attr_accessor :language # The type of document. Can be `SITE_PAGE`, `LANDING_PAGE`, `BLOG_POST`, `LISTING_PAGE`, or `KNOWLEDGE_ARTICLE`. attr_accessor :type # The title of the returned document. attr_accessor :title # The url of the document. attr_accessor :url # If a blog post, the tags associated with it. attr_accessor :tags # If a dynamic page, the row ID in the HubDB table. attr_accessor :row_id # URL of the featured image. attr_accessor :featured_image_url # The matching score of the document. attr_accessor :score # Name of the author. attr_accessor :author_full_name # The domain the document is hosted on. attr_accessor :domain # If a dynamic page, the ID of the HubDB table. attr_accessor :table_id # The ID of the content. attr_accessor :id # The date the content was published. attr_accessor :published_date # For knowledge articles, the category of the article. attr_accessor :category # For knowledge articles, the subcategory of the article. attr_accessor :subcategory 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 { :'combined_id' => :'combinedId', :'description' => :'description', :'language' => :'language', :'type' => :'type', :'title' => :'title', :'url' => :'url', :'tags' => :'tags', :'row_id' => :'rowId', :'featured_image_url' => :'featuredImageUrl', :'score' => :'score', :'author_full_name' => :'authorFullName', :'domain' => :'domain', :'table_id' => :'tableId', :'id' => :'id', :'published_date' => :'publishedDate', :'category' => :'category', :'subcategory' => :'subcategory' } 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 { :'combined_id' => :'String', :'description' => :'String', :'language' => :'String', :'type' => :'String', :'title' => :'String', :'url' => :'String', :'tags' => :'Array<String>', :'row_id' => :'Integer', :'featured_image_url' => :'String', :'score' => :'Float', :'author_full_name' => :'String', :'domain' => :'String', :'table_id' => :'Integer', :'id' => :'Integer', :'published_date' => :'Integer', :'category' => :'String', :'subcategory' => :'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::SiteSearch::ContentSearchResult` 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::SiteSearch::ContentSearchResult`. 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?(:'combined_id') self.combined_id = attributes[:'combined_id'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'language') self.language = attributes[:'language'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'url') self.url = attributes[:'url'] end if attributes.key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self.tags = value end end if attributes.key?(:'row_id') self.row_id = attributes[:'row_id'] end if attributes.key?(:'featured_image_url') self.featured_image_url = attributes[:'featured_image_url'] end if attributes.key?(:'score') self.score = attributes[:'score'] end if attributes.key?(:'author_full_name') self.author_full_name = attributes[:'author_full_name'] end if attributes.key?(:'domain') self.domain = attributes[:'domain'] end if attributes.key?(:'table_id') self.table_id = attributes[:'table_id'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'published_date') self.published_date = attributes[:'published_date'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'subcategory') self.subcategory = attributes[:'subcategory'] 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 @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @url.nil? invalid_properties.push('invalid value for "url", url cannot be nil.') end if @score.nil? invalid_properties.push('invalid value for "score", score cannot be nil.') end if @domain.nil? invalid_properties.push('invalid value for "domain", domain 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? 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 @type.nil? type_validator = EnumAttributeValidator.new('String', ["LANDING_PAGE", "BLOG_POST", "SITE_PAGE", "KNOWLEDGE_ARTICLE", "LISTING_PAGE"]) return false unless type_validator.valid?(@type) return false if @url.nil? return false if @score.nil? return false if @domain.nil? return false if @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-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 # Custom attribute writer method checking allowed values (enum). # @param [Object] type Object to be assigned def type=(type) validator = EnumAttributeValidator.new('String', ["LANDING_PAGE", "BLOG_POST", "SITE_PAGE", "KNOWLEDGE_ARTICLE", "LISTING_PAGE"]) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end @type = type 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 && combined_id == o.combined_id && description == o.description && language == o.language && type == o.type && title == o.title && url == o.url && tags == o.tags && row_id == o.row_id && featured_image_url == o.featured_image_url && score == o.score && author_full_name == o.author_full_name && domain == o.domain && table_id == o.table_id && id == o.id && published_date == o.published_date && category == o.category && subcategory == o.subcategory 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 [combined_id, description, language, type, title, url, tags, row_id, featured_image_url, score, author_full_name, domain, table_id, id, published_date, category, subcategory].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::SiteSearch.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/site_search/models/error_detail.rb
lib/hubspot/codegen/cms/site_search/models/error_detail.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch 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::SiteSearch::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::SiteSearch::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::SiteSearch.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/site_search/models/indexed_data.rb
lib/hubspot/codegen/cms/site_search/models/indexed_data.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch class IndexedData # The ID of the document in HubSpot. attr_accessor :id # The type of document. Can be `SITE_PAGE`, `LANDING_PAGE`, `BLOG_POST`, `LISTING_PAGE`, or `KNOWLEDGE_ARTICLE`. attr_accessor :type # The indexed fields in HubSpot. attr_accessor :fields 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 { :'id' => :'id', :'type' => :'type', :'fields' => :'fields' } 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', :'type' => :'String', :'fields' => :'Hash<String, IndexedField>' } 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::SiteSearch::IndexedData` 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::SiteSearch::IndexedData`. 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?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'fields') if (value = attributes[:'fields']).is_a?(Hash) self.fields = 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 @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @fields.nil? invalid_properties.push('invalid value for "fields", fields 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 @type.nil? type_validator = EnumAttributeValidator.new('String', ["LANDING_PAGE", "BLOG_POST", "SITE_PAGE", "KNOWLEDGE_ARTICLE", "LISTING_PAGE"]) return false unless type_validator.valid?(@type) return false if @fields.nil? true end # Custom attribute writer method checking allowed values (enum). # @param [Object] type Object to be assigned def type=(type) validator = EnumAttributeValidator.new('String', ["LANDING_PAGE", "BLOG_POST", "SITE_PAGE", "KNOWLEDGE_ARTICLE", "LISTING_PAGE"]) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end @type = type 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 && type == o.type && fields == o.fields 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, type, fields].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::SiteSearch.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/site_search/models/indexed_field.rb
lib/hubspot/codegen/cms/site_search/models/indexed_field.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch class IndexedField attr_accessor :values attr_accessor :name attr_accessor :value attr_accessor :metadata_field # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'values' => :'values', :'name' => :'name', :'value' => :'value', :'metadata_field' => :'metadataField' } 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 { :'values' => :'Array<Object>', :'name' => :'String', :'value' => :'Object', :'metadata_field' => :'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::SiteSearch::IndexedField` 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::SiteSearch::IndexedField`. 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?(:'values') if (value = attributes[:'values']).is_a?(Array) self.values = value end end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'value') self.value = attributes[:'value'] end if attributes.key?(:'metadata_field') self.metadata_field = attributes[:'metadata_field'] 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 @values.nil? invalid_properties.push('invalid value for "values", values cannot be nil.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @value.nil? invalid_properties.push('invalid value for "value", value cannot be nil.') end if @metadata_field.nil? invalid_properties.push('invalid value for "metadata_field", metadata_field 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 @values.nil? return false if @name.nil? return false if @value.nil? return false if @metadata_field.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 && values == o.values && name == o.name && value == o.value && metadata_field == o.metadata_field 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 [values, name, value, metadata_field].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::SiteSearch.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/site_search/models/public_search_results.rb
lib/hubspot/codegen/cms/site_search/models/public_search_results.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch class PublicSearchResults attr_accessor :total attr_accessor :search_term attr_accessor :offset attr_accessor :limit attr_accessor :page attr_accessor :results # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'total' => :'total', :'search_term' => :'searchTerm', :'offset' => :'offset', :'limit' => :'limit', :'page' => :'page', :'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', :'search_term' => :'String', :'offset' => :'Integer', :'limit' => :'Integer', :'page' => :'Integer', :'results' => :'Array<ContentSearchResult>' } 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::SiteSearch::PublicSearchResults` 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::SiteSearch::PublicSearchResults`. 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?(:'search_term') self.search_term = attributes[:'search_term'] end if attributes.key?(:'offset') self.offset = attributes[:'offset'] end if attributes.key?(:'limit') self.limit = attributes[:'limit'] end if attributes.key?(:'page') self.page = attributes[:'page'] 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 @offset.nil? invalid_properties.push('invalid value for "offset", offset cannot be nil.') end if @limit.nil? invalid_properties.push('invalid value for "limit", limit cannot be nil.') end if @page.nil? invalid_properties.push('invalid value for "page", page 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 @offset.nil? return false if @limit.nil? return false if @page.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 && search_term == o.search_term && offset == o.offset && limit == o.limit && page == o.page && 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, search_term, offset, limit, page, 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::SiteSearch.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/site_search/models/error.rb
lib/hubspot/codegen/cms/site_search/models/error.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch 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::SiteSearch::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::SiteSearch::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::SiteSearch.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/site_search/api/public_api.rb
lib/hubspot/codegen/cms/site_search/api/public_api.rb
=begin #CMS Site Search #Use these endpoints for searching content on your HubSpot hosted CMS website(s). 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 SiteSearch class PublicApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get indexed properties. # For a given account and document ID (page ID, blog post ID, HubDB row ID, etc.), return all indexed data for that document. This is useful when debugging why a particular document is not returned from a custom search. # @param content_id [String] ID of the target document when searching for indexed properties. # @param [Hash] opts the optional parameters # @option opts [String] :type The type of document. Can be one of &#x60;SITE_PAGE&#x60;, &#x60;BLOG_POST&#x60;, or &#x60;KNOWLEDGE_ARTICLE&#x60;. # @return [IndexedData] def get_by_id(content_id, opts = {}) data, _status_code, _headers = get_by_id_with_http_info(content_id, opts) data end # Get indexed properties. # For a given account and document ID (page ID, blog post ID, HubDB row ID, etc.), return all indexed data for that document. This is useful when debugging why a particular document is not returned from a custom search. # @param content_id [String] ID of the target document when searching for indexed properties. # @param [Hash] opts the optional parameters # @option opts [String] :type The type of document. Can be one of &#x60;SITE_PAGE&#x60;, &#x60;BLOG_POST&#x60;, or &#x60;KNOWLEDGE_ARTICLE&#x60;. # @return [Array<(IndexedData, Integer, Hash)>] IndexedData data, response status code and response headers def get_by_id_with_http_info(content_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicApi.get_by_id ...' end # verify the required parameter 'content_id' is set if @api_client.config.client_side_validation && content_id.nil? fail ArgumentError, "Missing the required parameter 'content_id' when calling PublicApi.get_by_id" end pattern = Regexp.new(/.*/) if @api_client.config.client_side_validation && content_id !~ pattern fail ArgumentError, "invalid value for 'content_id' when calling PublicApi.get_by_id, must conform to the pattern #{pattern}." end allowable_values = ["LANDING_PAGE", "BLOG_POST", "SITE_PAGE", "KNOWLEDGE_ARTICLE", "LISTING_PAGE"] if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type']) fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}" end # resource path local_var_path = '/cms/v3/site-search/indexed-data/{contentId}'.sub('{' + 'contentId' + '}', CGI.escape(content_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'type'] = opts[:'type'] if !opts[:'type'].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] || 'IndexedData' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"PublicApi.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: PublicApi#get_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Search your site. # Returns any website content matching the given search criteria for a given HubSpot account. Searches can be filtered by content type, domain, or URL path. # @param [Hash] opts the optional parameters # @option opts [String] :q The term to search for. # @option opts [Integer] :limit Specifies the number of results to be returned in a single response. Defaults to &#x60;10&#x60;. Maximum value is &#x60;100&#x60;. # @option opts [Integer] :offset Used to page through the results. If there are more results than specified by the &#x60;limit&#x60; parameter, you will need to use the value of offset returned in the previous request to get the next set of results. # @option opts [String] :language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. &#x60;es&#x60; for Spanish) # @option opts [Boolean] :match_prefix Inverts the behavior of the pathPrefix filter when set to &#x60;false&#x60;. Defaults to &#x60;true&#x60;. # @option opts [Boolean] :autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. # @option opts [Float] :popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. # @option opts [Float] :boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). # @option opts [String] :boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent&#x3D;10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). # @option opts [Integer] :table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the &#x60;hubdbQuery&#x60; parameter to further filter results. # @option opts [String] :hubdb_query Specify a HubDB query to further filter the search results. # @option opts [Array<String>] :domain A domain to match search results for. Multiple domains can be provided with &amp;. # @option opts [Array<String>] :type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE # @option opts [Array<String>] :path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. # @option opts [Array<String>] :property Specifies which properties to include in the search. Options include &#x60;title&#x60;, &#x60;description&#x60;, and &#x60;html&#x60;. All properties will be searched by default. # @option opts [String] :length Specifies the length of the search results. Can be set to &#x60;LONG&#x60; or &#x60;SHORT&#x60;. &#x60;SHORT&#x60; will return the first 128 characters of the content&#39;s meta description. &#x60;LONG&#x60; will build a more detailed content snippet based on the html/content of the page. # @option opts [Array<Integer>] :group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. # @return [PublicSearchResults] def search(opts = {}) data, _status_code, _headers = search_with_http_info(opts) data end # Search your site. # Returns any website content matching the given search criteria for a given HubSpot account. Searches can be filtered by content type, domain, or URL path. # @param [Hash] opts the optional parameters # @option opts [String] :q The term to search for. # @option opts [Integer] :limit Specifies the number of results to be returned in a single response. Defaults to &#x60;10&#x60;. Maximum value is &#x60;100&#x60;. # @option opts [Integer] :offset Used to page through the results. If there are more results than specified by the &#x60;limit&#x60; parameter, you will need to use the value of offset returned in the previous request to get the next set of results. # @option opts [String] :language Specifies the language of content to be searched. This value must be a valid [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. &#x60;es&#x60; for Spanish) # @option opts [Boolean] :match_prefix Inverts the behavior of the pathPrefix filter when set to &#x60;false&#x60;. Defaults to &#x60;true&#x60;. # @option opts [Boolean] :autocomplete Specifies whether or not you are showing autocomplete results. Defaults to false. # @option opts [Float] :popularity_boost Specifies how strongly a result is boosted based on its view count. Defaults to 1.0. # @option opts [Float] :boost_limit Specifies the maximum amount a result will be boosted based on its view count. Defaults to 5.0. Read more about elasticsearch boosting [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html). # @option opts [String] :boost_recent Specifies a relative time window where scores of documents published outside this time window decay. This can only be used for blog posts. For example, boostRecent&#x3D;10d will boost documents published within the last 10 days. Supported timeunits are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). # @option opts [Integer] :table_id Specifies a specific HubDB table to search. Only returns results from the specified table. Can be used in tandem with the &#x60;hubdbQuery&#x60; parameter to further filter results. # @option opts [String] :hubdb_query Specify a HubDB query to further filter the search results. # @option opts [Array<String>] :domain A domain to match search results for. Multiple domains can be provided with &amp;. # @option opts [Array<String>] :type Specifies the type of content to search. Can be one or more of SITE_PAGE, LANDING_PAGE, BLOG_POST, LISTING_PAGE, and KNOWLEDGE_ARTICLE. Defaults to all content types except LANDING_PAGE and KNOWLEDGE_ARTICLE # @option opts [Array<String>] :path_prefix Specifies a path prefix to filter search results. Will only return results with URL paths that start with the specified parameter. Can be used multiple times. # @option opts [Array<String>] :property Specifies which properties to include in the search. Options include &#x60;title&#x60;, &#x60;description&#x60;, and &#x60;html&#x60;. All properties will be searched by default. # @option opts [String] :length Specifies the length of the search results. Can be set to &#x60;LONG&#x60; or &#x60;SHORT&#x60;. &#x60;SHORT&#x60; will return the first 128 characters of the content&#39;s meta description. &#x60;LONG&#x60; will build a more detailed content snippet based on the html/content of the page. # @option opts [Array<Integer>] :group_id Specifies which blog(s) to be searched by blog ID. Can be used multiple times to search more than one blog. # @return [Array<(PublicSearchResults, Integer, Hash)>] PublicSearchResults data, response status code and response headers def search_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PublicApi.search ...' end allowable_values = ["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"] if @api_client.config.client_side_validation && opts[:'language'] && !allowable_values.include?(opts[:'language']) fail ArgumentError, "invalid value for \"language\", must be one of #{allowable_values}" end allowable_values = ["LANDING_PAGE", "BLOG_POST", "SITE_PAGE", "KNOWLEDGE_ARTICLE", "LISTING_PAGE"] if @api_client.config.client_side_validation && opts[:'type'] && !opts[:'type'].all? { |item| allowable_values.include?(item) } fail ArgumentError, "invalid value for \"type\", must include one of #{allowable_values}" end allowable_values = ["SHORT", "LONG"] if @api_client.config.client_side_validation && opts[:'length'] && !allowable_values.include?(opts[:'length']) fail ArgumentError, "invalid value for \"length\", must be one of #{allowable_values}" end # resource path local_var_path = '/cms/v3/site-search/search' # query parameters query_params = opts[:query_params] || {} query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil? query_params[:'matchPrefix'] = opts[:'match_prefix'] if !opts[:'match_prefix'].nil? query_params[:'autocomplete'] = opts[:'autocomplete'] if !opts[:'autocomplete'].nil? query_params[:'popularityBoost'] = opts[:'popularity_boost'] if !opts[:'popularity_boost'].nil? query_params[:'boostLimit'] = opts[:'boost_limit'] if !opts[:'boost_limit'].nil? query_params[:'boostRecent'] = opts[:'boost_recent'] if !opts[:'boost_recent'].nil? query_params[:'tableId'] = opts[:'table_id'] if !opts[:'table_id'].nil? query_params[:'hubdbQuery'] = opts[:'hubdb_query'] if !opts[:'hubdb_query'].nil? query_params[:'domain'] = @api_client.build_collection_param(opts[:'domain'], :multi) if !opts[:'domain'].nil? query_params[:'type'] = @api_client.build_collection_param(opts[:'type'], :multi) if !opts[:'type'].nil? query_params[:'pathPrefix'] = @api_client.build_collection_param(opts[:'path_prefix'], :multi) if !opts[:'path_prefix'].nil? query_params[:'property'] = @api_client.build_collection_param(opts[:'property'], :multi) if !opts[:'property'].nil? query_params[:'length'] = opts[:'length'] if !opts[:'length'].nil? query_params[:'groupId'] = @api_client.build_collection_param(opts[:'group_id'], :multi) if !opts[:'group_id'].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] || 'PublicSearchResults' # auth_names auth_names = opts[:debug_auth_names] || ['oauth2'] new_options = opts.merge( :operation => :"PublicApi.search", :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: PublicApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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_error.rb
lib/hubspot/codegen/cms/blogs/authors/api_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 module Hubspot module Cms module Blogs module Authors 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/authors/configuration.rb
lib/hubspot/codegen/cms/blogs/authors/configuration.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 module Hubspot module Cms module Blogs module Authors 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