Class: NewDemoApiClient::WeatherMarketContext

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stage:, date:, total_amount_raised_annualized: OMIT, rounds_annualized: OMIT, average_raise_years: OMIT, average_amount_raised: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::WeatherMarketContext

Parameters:

  • stage (String)

    The stage of the weather gauge

  • date (String)

    The date of the data point

  • total_amount_raised_annualized (Float) (defaults to: OMIT)

    A simple estimate of total amount of fundraising in the market at the stage in a rolling window

  • rounds_annualized (Float) (defaults to: OMIT)

    A simple estimate of total count of rounds in the market at the stage in a rolling window

  • average_raise_years (Float) (defaults to: OMIT)

    The average number of years between raises in the market at the stage in a rolling window

  • average_amount_raised (Float) (defaults to: OMIT)

    The average amount raised in the market at the stage in a rolling window

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/test_sdk/types/weather_market_context.rb', line 42

def initialize(stage:, date:, total_amount_raised_annualized: OMIT, rounds_annualized: OMIT,
               average_raise_years: OMIT, average_amount_raised: OMIT, additional_properties: nil)
  @stage = stage
  @date = date
  @total_amount_raised_annualized = total_amount_raised_annualized if total_amount_raised_annualized != OMIT
  @rounds_annualized = rounds_annualized if rounds_annualized != OMIT
  @average_raise_years = average_raise_years if average_raise_years != OMIT
  @average_amount_raised = average_amount_raised if average_amount_raised != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "stage": stage,
    "date": date,
    "total_amount_raised_annualized": total_amount_raised_annualized,
    "rounds_annualized": rounds_annualized,
    "average_raise_years": average_raise_years,
    "average_amount_raised": average_amount_raised
  }.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



24
25
26
# File 'lib/test_sdk/types/weather_market_context.rb', line 24

def additional_properties
  @additional_properties
end

#average_amount_raisedFloat (readonly)

Returns The average amount raised in the market at the stage in a rolling window.

Returns:

  • (Float)

    The average amount raised in the market at the stage in a rolling window



22
23
24
# File 'lib/test_sdk/types/weather_market_context.rb', line 22

def average_amount_raised
  @average_amount_raised
end

#average_raise_yearsFloat (readonly)

Returns The average number of years between raises in the market at the stage in a rolling window.

Returns:

  • (Float)

    The average number of years between raises in the market at the stage in a rolling window



20
21
22
# File 'lib/test_sdk/types/weather_market_context.rb', line 20

def average_raise_years
  @average_raise_years
end

#dateString (readonly)

Returns The date of the data point.

Returns:

  • (String)

    The date of the data point



11
12
13
# File 'lib/test_sdk/types/weather_market_context.rb', line 11

def date
  @date
end

#rounds_annualizedFloat (readonly)

Returns A simple estimate of total count of rounds in the market at the stage in a rolling window.

Returns:

  • (Float)

    A simple estimate of total count of rounds in the market at the stage in a rolling window



17
18
19
# File 'lib/test_sdk/types/weather_market_context.rb', line 17

def rounds_annualized
  @rounds_annualized
end

#stageString (readonly)

Returns The stage of the weather gauge.

Returns:

  • (String)

    The stage of the weather gauge



9
10
11
# File 'lib/test_sdk/types/weather_market_context.rb', line 9

def stage
  @stage
end

#total_amount_raised_annualizedFloat (readonly)

Returns A simple estimate of total amount of fundraising in the market at the stage in a rolling window.

Returns:

  • (Float)

    A simple estimate of total amount of fundraising in the market at the stage in a rolling window



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

def total_amount_raised_annualized
  @total_amount_raised_annualized
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::WeatherMarketContext

Deserialize a JSON object to an instance of WeatherMarketContext

Parameters:

  • json_object (String)

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/test_sdk/types/weather_market_context.rb', line 67

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  stage = parsed_json["stage"]
  date = parsed_json["date"]
  total_amount_raised_annualized = parsed_json["total_amount_raised_annualized"]
  rounds_annualized = parsed_json["rounds_annualized"]
  average_raise_years = parsed_json["average_raise_years"]
  average_amount_raised = parsed_json["average_amount_raised"]
  new(
    stage: stage,
    date: date,
    total_amount_raised_annualized: total_amount_raised_annualized,
    rounds_annualized: rounds_annualized,
    average_raise_years: average_raise_years,
    average_amount_raised: average_amount_raised,
    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)


100
101
102
103
104
105
106
107
# File 'lib/test_sdk/types/weather_market_context.rb', line 100

def self.validate_raw(obj:)
  obj.stage.is_a?(String) != false || raise("Passed value for field obj.stage is not the expected type, validation failed.")
  obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
  obj.total_amount_raised_annualized&.is_a?(Float) != false || raise("Passed value for field obj.total_amount_raised_annualized is not the expected type, validation failed.")
  obj.rounds_annualized&.is_a?(Float) != false || raise("Passed value for field obj.rounds_annualized is not the expected type, validation failed.")
  obj.average_raise_years&.is_a?(Float) != false || raise("Passed value for field obj.average_raise_years is not the expected type, validation failed.")
  obj.average_amount_raised&.is_a?(Float) != false || raise("Passed value for field obj.average_amount_raised is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of WeatherMarketContext to a JSON object

Returns:

  • (String)


90
91
92
# File 'lib/test_sdk/types/weather_market_context.rb', line 90

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