Class: TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem
- Inherits:
-
Object
- Object
- TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem
- Defined in:
- lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.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 boost (YYYY-MM-DD).
-
#multiplier ⇒ Float
readonly
The points multiplier.
-
#name ⇒ String
readonly
The name of the boost.
-
#rounding ⇒ TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItemRounding
readonly
How to round the boosted points.
-
#start ⇒ String
readonly
The start date of the boost (YYYY-MM-DD).
-
#user_id ⇒ String
readonly
The ID of the user to create a boost for.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem
Deserialize a JSON object to an instance of CreatePointsBoostsRequestBoostsItem.
-
.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:, name:, start:, multiplier:, end_: OMIT, rounding: OMIT, additional_properties: nil) ⇒ TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreatePointsBoostsRequestBoostsItem to a JSON object.
Constructor Details
#initialize(user_id:, name:, start:, multiplier:, end_: OMIT, rounding: OMIT, additional_properties: nil) ⇒ TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 42 def initialize(user_id:, name:, start:, multiplier:, end_: OMIT, rounding: OMIT, additional_properties: nil) @user_id = user_id @name = name @start = start @end_ = end_ if end_ != OMIT @multiplier = multiplier @rounding = rounding if rounding != OMIT @additional_properties = additional_properties @_field_set = { "userId": user_id, "name": name, "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.
26 27 28 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 26 def additional_properties @additional_properties end |
#end_ ⇒ String (readonly)
Returns The end date of the boost (YYYY-MM-DD). If null, the boost has no end date.
19 20 21 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 19 def end_ @end_ end |
#multiplier ⇒ Float (readonly)
Returns The points multiplier. Must be greater than 0, not equal to 1, and less than 100.
22 23 24 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 22 def multiplier @multiplier end |
#name ⇒ String (readonly)
Returns The name of the boost.
15 16 17 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 15 def name @name end |
#rounding ⇒ TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItemRounding (readonly)
Returns How to round the boosted points. Defaults to ‘down’.
24 25 26 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 24 def rounding @rounding end |
#start ⇒ String (readonly)
Returns The start date of the boost (YYYY-MM-DD).
17 18 19 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 17 def start @start end |
#user_id ⇒ String (readonly)
Returns The ID of the user to create a boost for.
13 14 15 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 13 def user_id @user_id end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem
Deserialize a JSON object to an instance of CreatePointsBoostsRequestBoostsItem
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 66 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"] name = parsed_json["name"] start = parsed_json["start"] end_ = parsed_json["end"] multiplier = parsed_json["multiplier"] rounding = parsed_json["rounding"] new( user_id: user_id, name: name, 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.
99 100 101 102 103 104 105 106 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 99 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.name.is_a?(String) != false || raise("Passed value for field obj.name 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::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItemRounding) != 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 CreatePointsBoostsRequestBoostsItem to a JSON object
89 90 91 |
# File 'lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb', line 89 def to_json(*_args) @_field_set&.to_json end |