lib/hubspot/codegen/crm/timeline/models/timeline_event_response.rb in hubspot-api-client-15.0.2 vs lib/hubspot/codegen/crm/timeline/models/timeline_event_response.rb in hubspot-api-client-16.0.0
- old
+ new
@@ -4,15 +4,16 @@
#This feature allows an app to create and configure custom events that can show up in the timelines of certain CRM objects like contacts, companies, tickets, or deals. You'll find multiple use cases for this API in the sections below.
The version of the OpenAPI document: v3
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 4.3.1
+OpenAPI Generator version: 6.2.1
=end
require 'date'
+require 'time'
module Hubspot
module Crm
module Timeline
class TimelineEventResponse
@@ -66,25 +67,30 @@
:'object_type' => :'objectType',
:'created_at' => :'createdAt'
}
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',
:'event_template_id' => :'String',
:'email' => :'String',
:'object_id' => :'String',
:'utk' => :'String',
:'domain' => :'String',
- :'timestamp' => :'DateTime',
+ :'timestamp' => :'Time',
:'tokens' => :'Hash<String, String>',
:'extra_data' => :'Object',
:'timeline_i_frame' => :'TimelineEventIFrame',
:'object_type' => :'String',
- :'created_at' => :'DateTime'
+ :'created_at' => :'Time'
}
end
# List of attributes with nullable: true
def self.openapi_nullable
@@ -232,20 +238,23 @@
# 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 type =~ /\AArray<(.*)>/i
+ 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 # or else data not found in attributes(hash), not an issue as the data can be optional
+ end
end
self
end
@@ -253,12 +262,12 @@
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def _deserialize(type, value)
case type.to_sym
- when :DateTime
- DateTime.parse(value)
+ when :Time
+ Time.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
@@ -284,11 +293,13 @@
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
- Hubspot::Crm::Timeline.const_get(type).build_from_hash(value)
+ # models (e.g. Pet) or oneOf
+ klass = Hubspot::Crm::Timeline.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
@@ -310,11 +321,11 @@
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
@@ -333,9 +344,11 @@
value.to_hash
else
value
end
end
+
end
+
end
end
end