Class: NewDemoApiClient::BandResponse

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(alpha:, x: OMIT, low: OMIT, high: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::BandResponse

Parameters:

  • alpha (Float)

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

  • x (Array<Float>) (defaults to: OMIT)
  • low (Array<Float>) (defaults to: OMIT)
  • high (Array<Float>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



32
33
34
35
36
37
38
39
40
41
# File 'lib/test_sdk/types/band_response.rb', line 32

def initialize(alpha:, x: OMIT, low: OMIT, high: OMIT, additional_properties: nil)
  @alpha = alpha
  @x = x if x != OMIT
  @low = low if low != OMIT
  @high = high if high != OMIT
  @additional_properties = additional_properties
  @_field_set = { "alpha": alpha, "x": x, "low": low, "high": high }.reject do |_k, v|
    v == OMIT
  end
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



18
19
20
# File 'lib/test_sdk/types/band_response.rb', line 18

def additional_properties
  @additional_properties
end

#alphaFloat (readonly)

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

Returns:

  • (Float)

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



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

def alpha
  @alpha
end

#highArray<Float> (readonly)

Returns:

  • (Array<Float>)


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

def high
  @high
end

#lowArray<Float> (readonly)

Returns:

  • (Array<Float>)


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

def low
  @low
end

#xArray<Float> (readonly)

Returns:

  • (Array<Float>)


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

def x
  @x
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::BandResponse

Deserialize a JSON object to an instance of BandResponse

Parameters:

  • json_object (String)

Returns:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/test_sdk/types/band_response.rb', line 47

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"]
  low = parsed_json["low"]
  high = parsed_json["high"]
  new(
    alpha: alpha,
    x: x,
    low: low,
    high: high,
    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)


76
77
78
79
80
81
# File 'lib/test_sdk/types/band_response.rb', line 76

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.low&.is_a?(Array) != false || raise("Passed value for field obj.low is not the expected type, validation failed.")
  obj.high&.is_a?(Array) != false || raise("Passed value for field obj.high is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of BandResponse to a JSON object

Returns:

  • (String)


66
67
68
# File 'lib/test_sdk/types/band_response.rb', line 66

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