Class: TrophyApiClient::PointsBoost
- Inherits:
-
Object
- Object
- TrophyApiClient::PointsBoost
- Defined in:
- lib/trophy_api_client/types/points_boost.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#end_ ⇒ String
readonly
The end date of the points boost.
-
#id ⇒ String
readonly
The ID of the points boost.
-
#multiplier ⇒ Float
readonly
The multiplier of the points boost.
-
#name ⇒ String
readonly
The name of the points boost.
-
#rounding ⇒ TrophyApiClient::PointsBoostRounding
readonly
The rounding method of the points boost.
-
#start ⇒ String
readonly
The start date of the points boost.
-
#status ⇒ TrophyApiClient::PointsBoostStatus
readonly
The status of the points boost.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::PointsBoost
Deserialize a JSON object to an instance of PointsBoost.
-
.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:, status:, start:, multiplier:, rounding:, end_: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PointsBoost constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PointsBoost to a JSON object.
Constructor Details
#initialize(id:, name:, status:, start:, multiplier:, rounding:, end_: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PointsBoost
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 41 def initialize(id:, name:, status:, start:, multiplier:, rounding:, end_: OMIT, additional_properties: nil) @id = id @name = name @status = status @start = start @end_ = end_ if end_ != OMIT @multiplier = multiplier @rounding = rounding @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "status": status, "start": start, "end": end_, "multiplier": multiplier, "rounding": rounding }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
25 26 27 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 25 def additional_properties @additional_properties end |
#end_ ⇒ String (readonly)
Returns The end date of the points boost.
19 20 21 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 19 def end_ @end_ end |
#id ⇒ String (readonly)
Returns The ID of the points boost.
11 12 13 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 11 def id @id end |
#multiplier ⇒ Float (readonly)
Returns The multiplier of the points boost.
21 22 23 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 21 def multiplier @multiplier end |
#name ⇒ String (readonly)
Returns The name of the points boost.
13 14 15 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 13 def name @name end |
#rounding ⇒ TrophyApiClient::PointsBoostRounding (readonly)
Returns The rounding method of the points boost.
23 24 25 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 23 def rounding @rounding end |
#start ⇒ String (readonly)
Returns The start date of the points boost.
17 18 19 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 17 def start @start end |
#status ⇒ TrophyApiClient::PointsBoostStatus (readonly)
Returns The status of the points boost.
15 16 17 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 15 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::PointsBoost
Deserialize a JSON object to an instance of PointsBoost
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 67 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"] status = parsed_json["status"] start = parsed_json["start"] end_ = parsed_json["end"] multiplier = parsed_json["multiplier"] rounding = parsed_json["rounding"] new( id: id, name: name, status: status, start: start, end_: end_, multiplier: multiplier, rounding: rounding, 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.
102 103 104 105 106 107 108 109 110 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 102 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.status.is_a?(TrophyApiClient::PointsBoostStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.") obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.") obj.multiplier.is_a?(Float) != false || raise("Passed value for field obj.multiplier is not the expected type, validation failed.") obj.rounding.is_a?(TrophyApiClient::PointsBoostRounding) != false || raise("Passed value for field obj.rounding is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PointsBoost to a JSON object
92 93 94 |
# File 'lib/trophy_api_client/types/points_boost.rb', line 92 def to_json(*_args) @_field_set&.to_json end |