Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "3a6cb30",
"generated": "2025-08-12 15:41:18.406"
"spec_repo_commit": "6b8994f",
"generated": "2025-08-13 15:22:09.891"
}
20 changes: 18 additions & 2 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3446,9 +3446,25 @@ components:
example:
focus: WORLD
properties:
custom_extent:
description: A custom extent of the map defined by an array of four numbers
in the order `[minLongitude, minLatitude, maxLongitude, maxLatitude]`.
example:
- -30
- -40
- 40
- 30
items:
description: The longitudinal or latitudinal coordinates of the bounding
box.
format: double
type: number
maxItems: 4
minItems: 4
type: array
focus:
description: The 2-letter ISO code of a country to focus the map on. Or
`WORLD`.
description: The ISO code of a country, sub-division, or region to focus
the map on. Or `WORLD`. Mutually exclusive with `custom_extent`.
example: WORLD
type: string
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ module DatadogAPIClient::V1
class GeomapWidgetDefinitionView
include BaseGenericModel

# The 2-letter ISO code of a country to focus the map on. Or `WORLD`.
# A custom extent of the map defined by an array of four numbers in the order `[minLongitude, minLatitude, maxLongitude, maxLatitude]`.
attr_reader :custom_extent

# The ISO code of a country, sub-division, or region to focus the map on. Or `WORLD`. Mutually exclusive with `custom_extent`.
attr_reader :focus

attr_accessor :additional_properties
Expand All @@ -30,6 +33,7 @@ class GeomapWidgetDefinitionView
# @!visibility private
def self.attribute_map
{
:'custom_extent' => :'custom_extent',
:'focus' => :'focus'
}
end
Expand All @@ -38,6 +42,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'custom_extent' => :'Array<Float>',
:'focus' => :'String'
}
end
Expand All @@ -60,6 +65,12 @@ def initialize(attributes = {})
end
}

if attributes.key?(:'custom_extent')
if (value = attributes[:'custom_extent']).is_a?(Array)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Consider using Array() to ensure the type is that of an array (...read more)

The rule "Use Array() to ensure your variable is an array" is important for ensuring your code behaves as expected, regardless of the type of data it receives. It is common in Ruby to need to iterate through an array of items. However, if the variable is not an array, this can lead to unexpected behavior or errors.

The Array() method in Ruby is a Kernel method that converts its argument to an Array. If the argument is already an Array, it returns the argument. If the argument is nil, it returns an empty Array. This can be used to ensure that a variable is an array before trying to iterate over it, preventing potential errors or unexpected behavior.

By using Array(foos), you can ensure that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

self.custom_extent = value
end
end

if attributes.key?(:'focus')
self.focus = attributes[:'focus']
end
Expand All @@ -69,10 +80,25 @@ def initialize(attributes = {})
# @return true if the model is valid
# @!visibility private
def valid?
return false if !@custom_extent.nil? && @custom_extent.length > 4
return false if !@custom_extent.nil? && @custom_extent.length < 4
return false if @focus.nil?
true
end

# Custom attribute writer method with validation
# @param custom_extent [Object] Object to be assigned
# @!visibility private
def custom_extent=(custom_extent)
if !custom_extent.nil? && custom_extent.length > 4
fail ArgumentError, 'invalid value for "custom_extent", number of items must be less than or equal to 4.'
end
if !custom_extent.nil? && custom_extent.length < 4
fail ArgumentError, 'invalid value for "custom_extent", number of items must be greater than or equal to 4.'
end
@custom_extent = custom_extent
end

# Custom attribute writer method with validation
# @param focus [Object] Object to be assigned
# @!visibility private
Expand Down Expand Up @@ -109,6 +135,7 @@ def to_hash
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
custom_extent == o.custom_extent &&
focus == o.focus &&
additional_properties == o.additional_properties
end
Expand All @@ -117,7 +144,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[focus, additional_properties].hash
[custom_extent, focus, additional_properties].hash
end
end
end
Loading