Method: DocSpring::AddFieldsData#to_hash

Defined in:
lib/docspring/models/add_fields_data.rb

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash

[View source]

189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/docspring/models/add_fields_data.rb', line 189

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