Class: TrophyApiClient::PatchPointsLevelsRequestItem
- Inherits:
-
Object
- Object
- TrophyApiClient::PatchPointsLevelsRequestItem
- Defined in:
- lib/trophy_api_client/types/patch_points_levels_request_item.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#badge ⇒ TrophyApiClient::PatchPointsLevelsRequestItemBadge
readonly
The updated badge, or ‘null` to clear it.
-
#description ⇒ String
readonly
The updated level description.
-
#id ⇒ String
readonly
The UUID of the level to update.
-
#name ⇒ String
readonly
The updated level name.
-
#points ⇒ Integer
readonly
The updated threshold points value.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::PatchPointsLevelsRequestItem
Deserialize a JSON object to an instance of PatchPointsLevelsRequestItem.
-
.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(id:, name: OMIT, points: OMIT, description: OMIT, badge: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PatchPointsLevelsRequestItem constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PatchPointsLevelsRequestItem to a JSON object.
Constructor Details
#initialize(id:, name: OMIT, points: OMIT, description: OMIT, badge: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PatchPointsLevelsRequestItem
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 34 def initialize(id:, name: OMIT, points: OMIT, description: OMIT, badge: OMIT, additional_properties: nil) @id = id @name = name if name != OMIT @points = points if points != OMIT @description = description if description != OMIT @badge = badge if badge != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "points": points, "description": description, "badge": badge }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
20 21 22 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 20 def additional_properties @additional_properties end |
#badge ⇒ TrophyApiClient::PatchPointsLevelsRequestItemBadge (readonly)
Returns The updated badge, or ‘null` to clear it.
18 19 20 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 18 def badge @badge end |
#description ⇒ String (readonly)
Returns The updated level description.
16 17 18 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 16 def description @description end |
#id ⇒ String (readonly)
Returns The UUID of the level to update.
10 11 12 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 10 def id @id end |
#name ⇒ String (readonly)
Returns The updated level name.
12 13 14 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 12 def name @name end |
#points ⇒ Integer (readonly)
Returns The updated threshold points value.
14 15 16 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 14 def points @points end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::PatchPointsLevelsRequestItem
Deserialize a JSON object to an instance of PatchPointsLevelsRequestItem
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 56 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] name = parsed_json["name"] points = parsed_json["points"] description = parsed_json["description"] if parsed_json["badge"].nil? badge = nil else badge = parsed_json["badge"].to_json badge = TrophyApiClient::PatchPointsLevelsRequestItemBadge.from_json(json_object: badge) end new( id: id, name: name, points: points, description: description, badge: badge, 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.
92 93 94 95 96 97 98 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 92 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.points&.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.badge.nil? || TrophyApiClient::PatchPointsLevelsRequestItemBadge.validate_raw(obj: obj.badge) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PatchPointsLevelsRequestItem to a JSON object
82 83 84 |
# File 'lib/trophy_api_client/types/patch_points_levels_request_item.rb', line 82 def to_json(*_args) @_field_set&.to_json end |