Class: NewDemoApiClient::CategoryGrowthRates

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date:, category:, cmgr3: OMIT, cmgr6: OMIT, cmgr12: OMIT, cqgr1: OMIT, cqgr2: OMIT, cqgr4: OMIT, cagr1: OMIT, cagr2: OMIT, cagr4: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::CategoryGrowthRates

Parameters:

  • date (String)

    The date of the entry.

  • category (String)

    The category of the entry.

  • cmgr3 (Float) (defaults to: OMIT)

    3-month category growth rate, for monthly frequency.

  • cmgr6 (Float) (defaults to: OMIT)

    6-month category growth rate, for monthly frequency.

  • cmgr12 (Float) (defaults to: OMIT)

    12-month category growth rate, for monthly frequency.

  • cqgr1 (Float) (defaults to: OMIT)

    1-quarter category growth rate, for quarterly frequency.

  • cqgr2 (Float) (defaults to: OMIT)

    2-quarter category growth rate, for quarterly frequency.

  • cqgr4 (Float) (defaults to: OMIT)

    4-quarter category growth rate, for quarterly frequency.

  • cagr1 (Float) (defaults to: OMIT)

    1-year category growth rate, for annual frequency.

  • cagr2 (Float) (defaults to: OMIT)

    2-year category growth rate, for annual frequency.

  • cagr4 (Float) (defaults to: OMIT)

    4-year category growth rate, for annual frequency.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/test_sdk/types/category_growth_rates.rb', line 51

def initialize(date:, category:, cmgr3: OMIT, cmgr6: OMIT, cmgr12: OMIT, cqgr1: OMIT, cqgr2: OMIT, cqgr4: OMIT,
               cagr1: OMIT, cagr2: OMIT, cagr4: OMIT, additional_properties: nil)
  @date = date
  @category = category
  @cmgr3 = cmgr3 if cmgr3 != OMIT
  @cmgr6 = cmgr6 if cmgr6 != OMIT
  @cmgr12 = cmgr12 if cmgr12 != OMIT
  @cqgr1 = cqgr1 if cqgr1 != OMIT
  @cqgr2 = cqgr2 if cqgr2 != OMIT
  @cqgr4 = cqgr4 if cqgr4 != OMIT
  @cagr1 = cagr1 if cagr1 != OMIT
  @cagr2 = cagr2 if cagr2 != OMIT
  @cagr4 = cagr4 if cagr4 != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "date": date,
    "category": category,
    "cmgr3": cmgr3,
    "cmgr6": cmgr6,
    "cmgr12": cmgr12,
    "cqgr1": cqgr1,
    "cqgr2": cqgr2,
    "cqgr4": cqgr4,
    "cagr1": cagr1,
    "cagr2": cagr2,
    "cagr4": cagr4
  }.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



31
32
33
# File 'lib/test_sdk/types/category_growth_rates.rb', line 31

def additional_properties
  @additional_properties
end

#cagr1Float (readonly)

Returns 1-year category growth rate, for annual frequency.

Returns:

  • (Float)

    1-year category growth rate, for annual frequency.



25
26
27
# File 'lib/test_sdk/types/category_growth_rates.rb', line 25

def cagr1
  @cagr1
end

#cagr2Float (readonly)

Returns 2-year category growth rate, for annual frequency.

Returns:

  • (Float)

    2-year category growth rate, for annual frequency.



27
28
29
# File 'lib/test_sdk/types/category_growth_rates.rb', line 27

def cagr2
  @cagr2
end

#cagr4Float (readonly)

Returns 4-year category growth rate, for annual frequency.

Returns:

  • (Float)

    4-year category growth rate, for annual frequency.



29
30
31
# File 'lib/test_sdk/types/category_growth_rates.rb', line 29

def cagr4
  @cagr4
end

#categoryString (readonly)

Returns The category of the entry.

Returns:

  • (String)

    The category of the entry.



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

def category
  @category
end

#cmgr12Float (readonly)

Returns 12-month category growth rate, for monthly frequency.

Returns:

  • (Float)

    12-month category growth rate, for monthly frequency.



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

def cmgr12
  @cmgr12
end

#cmgr3Float (readonly)

Returns 3-month category growth rate, for monthly frequency.

Returns:

  • (Float)

    3-month category growth rate, for monthly frequency.



13
14
15
# File 'lib/test_sdk/types/category_growth_rates.rb', line 13

def cmgr3
  @cmgr3
end

#cmgr6Float (readonly)

Returns 6-month category growth rate, for monthly frequency.

Returns:

  • (Float)

    6-month category growth rate, for monthly frequency.



15
16
17
# File 'lib/test_sdk/types/category_growth_rates.rb', line 15

def cmgr6
  @cmgr6
end

#cqgr1Float (readonly)

Returns 1-quarter category growth rate, for quarterly frequency.

Returns:

  • (Float)

    1-quarter category growth rate, for quarterly frequency.



19
20
21
# File 'lib/test_sdk/types/category_growth_rates.rb', line 19

def cqgr1
  @cqgr1
end

#cqgr2Float (readonly)

Returns 2-quarter category growth rate, for quarterly frequency.

Returns:

  • (Float)

    2-quarter category growth rate, for quarterly frequency.



21
22
23
# File 'lib/test_sdk/types/category_growth_rates.rb', line 21

def cqgr2
  @cqgr2
end

#cqgr4Float (readonly)

Returns 4-quarter category growth rate, for quarterly frequency.

Returns:

  • (Float)

    4-quarter category growth rate, for quarterly frequency.



23
24
25
# File 'lib/test_sdk/types/category_growth_rates.rb', line 23

def cqgr4
  @cqgr4
end

#dateString (readonly)

Returns The date of the entry.

Returns:

  • (String)

    The date of the entry.



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

def date
  @date
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::CategoryGrowthRates

Deserialize a JSON object to an instance of CategoryGrowthRates

Parameters:

  • json_object (String)

Returns:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/test_sdk/types/category_growth_rates.rb', line 86

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  date = parsed_json["date"]
  category = parsed_json["category"]
  cmgr3 = parsed_json["cmgr3"]
  cmgr6 = parsed_json["cmgr6"]
  cmgr12 = parsed_json["cmgr12"]
  cqgr1 = parsed_json["cqgr1"]
  cqgr2 = parsed_json["cqgr2"]
  cqgr4 = parsed_json["cqgr4"]
  cagr1 = parsed_json["cagr1"]
  cagr2 = parsed_json["cagr2"]
  cagr4 = parsed_json["cagr4"]
  new(
    date: date,
    category: category,
    cmgr3: cmgr3,
    cmgr6: cmgr6,
    cmgr12: cmgr12,
    cqgr1: cqgr1,
    cqgr2: cqgr2,
    cqgr4: cqgr4,
    cagr1: cagr1,
    cagr2: cagr2,
    cagr4: cagr4,
    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)


129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/test_sdk/types/category_growth_rates.rb', line 129

def self.validate_raw(obj:)
  obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
  obj.category.is_a?(String) != false || raise("Passed value for field obj.category is not the expected type, validation failed.")
  obj.cmgr3&.is_a?(Float) != false || raise("Passed value for field obj.cmgr3 is not the expected type, validation failed.")
  obj.cmgr6&.is_a?(Float) != false || raise("Passed value for field obj.cmgr6 is not the expected type, validation failed.")
  obj.cmgr12&.is_a?(Float) != false || raise("Passed value for field obj.cmgr12 is not the expected type, validation failed.")
  obj.cqgr1&.is_a?(Float) != false || raise("Passed value for field obj.cqgr1 is not the expected type, validation failed.")
  obj.cqgr2&.is_a?(Float) != false || raise("Passed value for field obj.cqgr2 is not the expected type, validation failed.")
  obj.cqgr4&.is_a?(Float) != false || raise("Passed value for field obj.cqgr4 is not the expected type, validation failed.")
  obj.cagr1&.is_a?(Float) != false || raise("Passed value for field obj.cagr1 is not the expected type, validation failed.")
  obj.cagr2&.is_a?(Float) != false || raise("Passed value for field obj.cagr2 is not the expected type, validation failed.")
  obj.cagr4&.is_a?(Float) != false || raise("Passed value for field obj.cagr4 is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CategoryGrowthRates to a JSON object

Returns:

  • (String)


119
120
121
# File 'lib/test_sdk/types/category_growth_rates.rb', line 119

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