Class: NewDemoApiClient::Area

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/area.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(alpha:, x:, y:, additional_properties: nil) ⇒ NewDemoApiClient::Area

Parameters:

  • alpha (Float)

    Quantile significance level for the area, which represents the share of data points expected to lie beyond the band.

  • x (Array<Float>)

    List of x values for the area.

  • y (Array<Float>)

    List of y values for the area.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
# File 'lib/test_sdk/types/area.rb', line 29

def initialize(alpha:, x:, y:, additional_properties: nil)
  @alpha = alpha
  @x = x
  @y = y
  @additional_properties = additional_properties
  @_field_set = { "alpha": alpha, "x": x, "y": y }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



16
17
18
# File 'lib/test_sdk/types/area.rb', line 16

def additional_properties
  @additional_properties
end

#alphaFloat (readonly)

Returns Quantile significance level for the area, which represents the share of data points expected to lie beyond the band.

Returns:

  • (Float)

    Quantile significance level for the area, which represents the share of data points expected to lie beyond the band.



10
11
12
# File 'lib/test_sdk/types/area.rb', line 10

def alpha
  @alpha
end

#xArray<Float> (readonly)

Returns List of x values for the area.

Returns:

  • (Array<Float>)

    List of x values for the area.



12
13
14
# File 'lib/test_sdk/types/area.rb', line 12

def x
  @x
end

#yArray<Float> (readonly)

Returns List of y values for the area.

Returns:

  • (Array<Float>)

    List of y values for the area.



14
15
16
# File 'lib/test_sdk/types/area.rb', line 14

def y
  @y
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::Area

Deserialize a JSON object to an instance of Area

Parameters:

  • json_object (String)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/test_sdk/types/area.rb', line 41

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  alpha = parsed_json["alpha"]
  x = parsed_json["x"]
  y = parsed_json["y"]
  new(
    alpha: alpha,
    x: x,
    y: y,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


68
69
70
71
72
# File 'lib/test_sdk/types/area.rb', line 68

def self.validate_raw(obj:)
  obj.alpha.is_a?(Float) != false || raise("Passed value for field obj.alpha is not the expected type, validation failed.")
  obj.x.is_a?(Array) != false || raise("Passed value for field obj.x is not the expected type, validation failed.")
  obj.y.is_a?(Array) != false || raise("Passed value for field obj.y is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Area to a JSON object

Returns:

  • (String)


58
59
60
# File 'lib/test_sdk/types/area.rb', line 58

def to_json(*_args)
  @_field_set&.to_json
end