Class: TrophyApiClient::BulkStreakResponseItem
- Inherits:
-
Object
- Object
- TrophyApiClient::BulkStreakResponseItem
- Defined in:
- lib/trophy_api_client/types/bulk_streak_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.
-
#extended ⇒ String
readonly
The timestamp the streak was extended, as a string.
-
#streak_length ⇒ Integer
readonly
The length of the user’s streak.
-
#user_id ⇒ String
readonly
The ID of the user.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::BulkStreakResponseItem
Deserialize a JSON object to an instance of BulkStreakResponseItem.
-
.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(user_id:, streak_length:, extended:, additional_properties: nil) ⇒ TrophyApiClient::BulkStreakResponseItem constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of BulkStreakResponseItem to a JSON object.
Constructor Details
#initialize(user_id:, streak_length:, extended:, additional_properties: nil) ⇒ TrophyApiClient::BulkStreakResponseItem
27 28 29 30 31 32 33 |
# File 'lib/trophy_api_client/types/bulk_streak_response_item.rb', line 27 def initialize(user_id:, streak_length:, extended:, additional_properties: nil) @user_id = user_id @streak_length = streak_length @extended = extended @additional_properties = additional_properties @_field_set = { "userId": user_id, "streakLength": streak_length, "extended": extended } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/trophy_api_client/types/bulk_streak_response_item.rb', line 15 def additional_properties @additional_properties end |
#extended ⇒ String (readonly)
Returns The timestamp the streak was extended, as a string.
13 14 15 |
# File 'lib/trophy_api_client/types/bulk_streak_response_item.rb', line 13 def extended @extended end |
#streak_length ⇒ Integer (readonly)
Returns The length of the user’s streak.
11 12 13 |
# File 'lib/trophy_api_client/types/bulk_streak_response_item.rb', line 11 def streak_length @streak_length end |
#user_id ⇒ String (readonly)
Returns The ID of the user.
9 10 11 |
# File 'lib/trophy_api_client/types/bulk_streak_response_item.rb', line 9 def user_id @user_id end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::BulkStreakResponseItem
Deserialize a JSON object to an instance of BulkStreakResponseItem
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/trophy_api_client/types/bulk_streak_response_item.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) user_id = parsed_json["userId"] streak_length = parsed_json["streakLength"] extended = parsed_json["extended"] new( user_id: user_id, streak_length: streak_length, extended: extended, 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 70 |
# File 'lib/trophy_api_client/types/bulk_streak_response_item.rb', line 66 def self.validate_raw(obj:) obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") obj.streak_length.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.") obj.extended.is_a?(String) != false || raise("Passed value for field obj.extended is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of BulkStreakResponseItem to a JSON object
56 57 58 |
# File 'lib/trophy_api_client/types/bulk_streak_response_item.rb', line 56 def to_json(*_args) @_field_set&.to_json end |