Class: TrophyApiClient::PointsLevelSummaryResponseItem
- Inherits:
-
Object
- Object
- TrophyApiClient::PointsLevelSummaryResponseItem
- Defined in:
- lib/trophy_api_client/types/points_level_summary_response_item.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #level ⇒ TrophyApiClient::PointsLevel readonly
-
#users ⇒ Integer
readonly
The number of users currently at this level.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::PointsLevelSummaryResponseItem
Deserialize a JSON object to an instance of PointsLevelSummaryResponseItem.
-
.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(level:, users:, additional_properties: nil) ⇒ TrophyApiClient::PointsLevelSummaryResponseItem constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PointsLevelSummaryResponseItem to a JSON object.
Constructor Details
#initialize(level:, users:, additional_properties: nil) ⇒ TrophyApiClient::PointsLevelSummaryResponseItem
25 26 27 28 29 30 |
# File 'lib/trophy_api_client/types/points_level_summary_response_item.rb', line 25 def initialize(level:, users:, additional_properties: nil) @level = level @users = users @additional_properties = additional_properties @_field_set = { "level": level, "users": users } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
14 15 16 |
# File 'lib/trophy_api_client/types/points_level_summary_response_item.rb', line 14 def additional_properties @additional_properties end |
#level ⇒ TrophyApiClient::PointsLevel (readonly)
10 11 12 |
# File 'lib/trophy_api_client/types/points_level_summary_response_item.rb', line 10 def level @level end |
#users ⇒ Integer (readonly)
Returns The number of users currently at this level.
12 13 14 |
# File 'lib/trophy_api_client/types/points_level_summary_response_item.rb', line 12 def users @users end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::PointsLevelSummaryResponseItem
Deserialize a JSON object to an instance of PointsLevelSummaryResponseItem
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/trophy_api_client/types/points_level_summary_response_item.rb', line 36 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["level"].nil? level = nil else level = parsed_json["level"].to_json level = TrophyApiClient::PointsLevel.from_json(json_object: level) end users = parsed_json["users"] new( level: level, users: users, 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.
66 67 68 69 |
# File 'lib/trophy_api_client/types/points_level_summary_response_item.rb', line 66 def self.validate_raw(obj:) TrophyApiClient::PointsLevel.validate_raw(obj: obj.level) obj.users.is_a?(Integer) != false || raise("Passed value for field obj.users is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PointsLevelSummaryResponseItem to a JSON object
56 57 58 |
# File 'lib/trophy_api_client/types/points_level_summary_response_item.rb', line 56 def to_json(*_args) @_field_set&.to_json end |