=begin
#Forgejo API
#This documentation describes the Forgejo API.
The version of the OpenAPI document: 10.0.0-121-28886cd+gitea-1.22.0
Generated by: https://openapi-generator.tech
Generator version: 7.12.0
=endrequire'date'require'time'moduleForgejo# Comment represents a comment on a commit or issueclassCommentattr_accessor:assetsattr_accessor:bodyattr_accessor:created_atattr_accessor:html_urlattr_accessor:idattr_accessor:issue_urlattr_accessor:original_authorattr_accessor:original_author_idattr_accessor:pull_request_urlattr_accessor:updated_atattr_accessor:user# Attribute mapping from ruby-style variable name to JSON key.defself.attribute_map{:'assets'=>:'assets',:'body'=>:'body',:'created_at'=>:'created_at',:'html_url'=>:'html_url',:'id'=>:'id',:'issue_url'=>:'issue_url',:'original_author'=>:'original_author',:'original_author_id'=>:'original_author_id',:'pull_request_url'=>:'pull_request_url',:'updated_at'=>:'updated_at',:'user'=>:'user'}end# Returns attribute mapping this model knows aboutdefself.acceptable_attribute_mapattribute_mapend# Returns all the JSON keys this model knows aboutdefself.acceptable_attributesacceptable_attribute_map.valuesend# Attribute type mapping.defself.openapi_types{:'assets'=>:'Array<Attachment>',:'body'=>:'String',:'created_at'=>:'Time',:'html_url'=>:'String',:'id'=>:'Integer',:'issue_url'=>:'String',:'original_author'=>:'String',:'original_author_id'=>:'Integer',:'pull_request_url'=>:'String',:'updated_at'=>:'Time',:'user'=>:'User'}end# List of attributes with nullable: truedefself.openapi_nullableSet.new([])end# Initializes the object# @param [Hash] attributes Model attributes in the form of hashdefinitialize(attributes={})if(!attributes.is_a?(Hash))failArgumentError,"The input argument (attributes) must be a hash in `Forgejo::Comment` initialize method"end# check to see if the attribute exists and convert string to symbol for hash keyacceptable_attribute_map=self.class.acceptable_attribute_mapattributes=attributes.each_with_object({}){|(k,v),h|if(!acceptable_attribute_map.key?(k.to_sym))failArgumentError,"`#{k}` is not a valid attribute in `Forgejo::Comment`. Please check the name to make sure it's valid. List of attributes: "+acceptable_attribute_map.keys.inspectendh[k.to_sym]=v}ifattributes.key?(:'assets')if(value=attributes[:'assets']).is_a?(Array)self.assets=valueendendifattributes.key?(:'body')self.body=attributes[:'body']endifattributes.key?(:'created_at')self.created_at=attributes[:'created_at']endifattributes.key?(:'html_url')self.html_url=attributes[:'html_url']endifattributes.key?(:'id')self.id=attributes[:'id']endifattributes.key?(:'issue_url')self.issue_url=attributes[:'issue_url']endifattributes.key?(:'original_author')self.original_author=attributes[:'original_author']endifattributes.key?(:'original_author_id')self.original_author_id=attributes[:'original_author_id']endifattributes.key?(:'pull_request_url')self.pull_request_url=attributes[:'pull_request_url']endifattributes.key?(:'updated_at')self.updated_at=attributes[:'updated_at']endifattributes.key?(:'user')self.user=attributes[:'user']endend# Show invalid properties with the reasons. Usually used together with valid?# @return Array for valid properties with the reasonsdeflist_invalid_propertieswarn'[DEPRECATED] the `list_invalid_properties` method is obsolete'invalid_properties=Array.newinvalid_propertiesend# Check to see if the all the properties in the model are valid# @return true if the model is validdefvalid?warn'[DEPRECATED] the `valid?` method is obsolete'trueend# Checks equality by comparing each attribute.# @param [Object] Object to be compareddef==(o)returntrueifself.equal?(o)self.class==o.class&&assets==o.assets&&body==o.body&&created_at==o.created_at&&html_url==o.html_url&&id==o.id&&issue_url==o.issue_url&&original_author==o.original_author&&original_author_id==o.original_author_id&&pull_request_url==o.pull_request_url&&updated_at==o.updated_at&&user==o.userend# @see the `==` method# @param [Object] Object to be compareddefeql?(o)self==oend# Calculates hash code according to all attributes.# @return [Integer] Hash codedefhash[assets,body,created_at,html_url,id,issue_url,original_author,original_author_id,pull_request_url,updated_at,user].hashend# Builds the object from hash# @param [Hash] attributes Model attributes in the form of hash# @return [Object] Returns the model itselfdefself.build_from_hash(attributes)returnnilunlessattributes.is_a?(Hash)attributes=attributes.transform_keys(&:to_sym)transformed_hash={}openapi_types.each_pairdo|key,type|ifattributes.key?(attribute_map[key])&&attributes[attribute_map[key]].nil?transformed_hash["#{key}"]=nilelsiftype=~/\AArray<(.*)>/i# check to ensure the input is an array given that the attribute# is documented as an array but the input is notifattributes[attribute_map[key]].is_a?(Array)transformed_hash["#{key}"]=attributes[attribute_map[key]].map{|v|_deserialize($1,v)}endelsif!attributes[attribute_map[key]].nil?transformed_hash["#{key}"]=_deserialize(type,attributes[attribute_map[key]])endendnew(transformed_hash)end# Deserializes the data based on type# @param string type Data type# @param string value Value to be deserialized# @return [Object] Deserialized datadefself._deserialize(type,value)casetype.to_symwhen:TimeTime.parse(value)when:DateDate.parse(value)when:Stringvalue.to_swhen:Integervalue.to_iwhen:Floatvalue.to_fwhen:Booleanifvalue.to_s=~/\A(true|t|yes|y|1)\z/itrueelsefalseendwhen:Object# generic object (usually a Hash), return directlyvaluewhen/\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]{}.tapdo|hash|value.eachdo|k,v|hash[_deserialize(k_type,k)]=_deserialize(v_type,v)endendelse# model# models (e.g. Pet) or oneOfklass=Forgejo.const_get(type)klass.respond_to?(:openapi_any_of)||klass.respond_to?(:openapi_one_of)?klass.build(value):klass.build_from_hash(value)endend# Returns the string representation of the object# @return [String] String presentation of the objectdefto_sto_hash.to_send# to_body is an alias to to_hash (backward compatibility)# @return [Hash] Returns the object in the form of hashdefto_bodyto_hashend# Returns the object in the form of hash# @return [Hash] Returns the object in the form of hashdefto_hashhash={}self.class.attribute_map.each_pairdo|attr,param|value=self.send(attr)ifvalue.nil?is_nullable=self.class.openapi_nullable.include?(attr)nextif!is_nullable||(is_nullable&&!instance_variable_defined?(:"@#{attr}"))endhash[param]=_to_hash(value)endhashend# 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 hashdef_to_hash(value)ifvalue.is_a?(Array)value.compact.map{|v|_to_hash(v)}elsifvalue.is_a?(Hash){}.tapdo|hash|value.each{|k,v|hash[k]=_to_hash(v)}endelsifvalue.respond_to?:to_hashvalue.to_hashelsevalueendendendend