Class: TrophyApiClient::WrappedMetricByAttributeValueValue
- Inherits:
-
Object
- Object
- TrophyApiClient::WrappedMetricByAttributeValueValue
- Defined in:
- lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#change_this_period ⇒ Float
readonly
The change during the period for this attribute value.
-
#current_total ⇒ Float
readonly
The current total for this attribute value.
-
#name ⇒ String
readonly
The name of the metric.
-
#percent_change ⇒ Float
readonly
The percentage change for this attribute value.
-
#percentile_this_period ⇒ Float
readonly
The user’s percentile rank for this attribute value during the period.
-
#units ⇒ String
readonly
The units of the metric.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::WrappedMetricByAttributeValueValue
Deserialize a JSON object to an instance of WrappedMetricByAttributeValueValue.
-
.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.
Instance Method Summary collapse
- #initialize(name: OMIT, units: OMIT, current_total: OMIT, change_this_period: OMIT, percent_change: OMIT, percentile_this_period: OMIT, additional_properties: nil) ⇒ TrophyApiClient::WrappedMetricByAttributeValueValue constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of WrappedMetricByAttributeValueValue to a JSON object.
Constructor Details
#initialize(name: OMIT, units: OMIT, current_total: OMIT, change_this_period: OMIT, percent_change: OMIT, percentile_this_period: OMIT, additional_properties: nil) ⇒ TrophyApiClient::WrappedMetricByAttributeValueValue
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 36 def initialize(name: OMIT, units: OMIT, current_total: OMIT, change_this_period: OMIT, percent_change: OMIT, percentile_this_period: OMIT, additional_properties: nil) @name = name if name != OMIT @units = units if units != OMIT @current_total = current_total if current_total != OMIT @change_this_period = change_this_period if change_this_period != OMIT @percent_change = percent_change if percent_change != OMIT @percentile_this_period = percentile_this_period if percentile_this_period != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "units": units, "currentTotal": current_total, "changeThisPeriod": change_this_period, "percentChange": percent_change, "percentileThisPeriod": percentile_this_period }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 21 def additional_properties @additional_properties end |
#change_this_period ⇒ Float (readonly)
Returns The change during the period for this attribute value.
15 16 17 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 15 def change_this_period @change_this_period end |
#current_total ⇒ Float (readonly)
Returns The current total for this attribute value.
13 14 15 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 13 def current_total @current_total end |
#name ⇒ String (readonly)
Returns The name of the metric.
9 10 11 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 9 def name @name end |
#percent_change ⇒ Float (readonly)
Returns The percentage change for this attribute value.
17 18 19 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 17 def percent_change @percent_change end |
#percentile_this_period ⇒ Float (readonly)
Returns The user’s percentile rank for this attribute value during the period.
19 20 21 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 19 def percentile_this_period @percentile_this_period end |
#units ⇒ String (readonly)
Returns The units of the metric.
11 12 13 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 11 def units @units end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::WrappedMetricByAttributeValueValue
Deserialize a JSON object to an instance of WrappedMetricByAttributeValueValue
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 61 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] units = parsed_json["units"] current_total = parsed_json["currentTotal"] change_this_period = parsed_json["changeThisPeriod"] percent_change = parsed_json["percentChange"] percentile_this_period = parsed_json["percentileThisPeriod"] new( name: name, units: units, current_total: current_total, change_this_period: change_this_period, percent_change: percent_change, percentile_this_period: percentile_this_period, 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.
94 95 96 97 98 99 100 101 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 94 def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.units&.is_a?(String) != false || raise("Passed value for field obj.units is not the expected type, validation failed.") obj.current_total&.is_a?(Float) != false || raise("Passed value for field obj.current_total is not the expected type, validation failed.") obj.change_this_period&.is_a?(Float) != false || raise("Passed value for field obj.change_this_period is not the expected type, validation failed.") obj.percent_change&.is_a?(Float) != false || raise("Passed value for field obj.percent_change is not the expected type, validation failed.") obj.percentile_this_period&.is_a?(Float) != false || raise("Passed value for field obj.percentile_this_period is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of WrappedMetricByAttributeValueValue to a JSON object
84 85 86 |
# File 'lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb', line 84 def to_json(*_args) @_field_set&.to_json end |