Class: TrophyApiClient::PatchPointsBoostsRequestItem
- Inherits:
-
Object
- Object
- TrophyApiClient::PatchPointsBoostsRequestItem
- Defined in:
- lib/trophy_api_client/types/patch_points_boosts_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.
-
#end_ ⇒ String
readonly
Updated end date (YYYY-MM-DD) or null to remove end date.
-
#id ⇒ String
readonly
The UUID of the boost to update.
-
#multiplier ⇒ Float
readonly
Updated points multiplier.
-
#name ⇒ String
readonly
Updated name for the boost.
-
#rounding ⇒ TrophyApiClient::PatchPointsBoostsRequestItemRounding
readonly
Updated rounding strategy.
-
#start ⇒ String
readonly
Updated start date (YYYY-MM-DD).
-
#user_attributes ⇒ Array<TrophyApiClient::PatchPointsBoostsRequestItemUserAttributesItem>
readonly
Updated user attribute filters.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::PatchPointsBoostsRequestItem
Deserialize a JSON object to an instance of PatchPointsBoostsRequestItem.
-
.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, start: OMIT, end_: OMIT, multiplier: OMIT, rounding: OMIT, user_attributes: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PatchPointsBoostsRequestItem constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PatchPointsBoostsRequestItem to a JSON object.
Constructor Details
#initialize(id:, name: OMIT, start: OMIT, end_: OMIT, multiplier: OMIT, rounding: OMIT, user_attributes: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PatchPointsBoostsRequestItem
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 43 def initialize(id:, name: OMIT, start: OMIT, end_: OMIT, multiplier: OMIT, rounding: OMIT, user_attributes: OMIT, additional_properties: nil) @id = id @name = name if name != OMIT @start = start if start != OMIT @end_ = end_ if end_ != OMIT @multiplier = multiplier if multiplier != OMIT @rounding = rounding if rounding != OMIT @user_attributes = user_attributes if user_attributes != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "start": start, "end": end_, "multiplier": multiplier, "rounding": rounding, "userAttributes": user_attributes }.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/types/patch_points_boosts_request_item.rb', line 26 def additional_properties @additional_properties end |
#end_ ⇒ String (readonly)
Returns Updated end date (YYYY-MM-DD) or null to remove end date.
17 18 19 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 17 def end_ @end_ end |
#id ⇒ String (readonly)
Returns The UUID of the boost to update.
11 12 13 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 11 def id @id end |
#multiplier ⇒ Float (readonly)
Returns Updated points multiplier.
19 20 21 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 19 def multiplier @multiplier end |
#name ⇒ String (readonly)
Returns Updated name for the boost.
13 14 15 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 13 def name @name end |
#rounding ⇒ TrophyApiClient::PatchPointsBoostsRequestItemRounding (readonly)
Returns Updated rounding strategy.
21 22 23 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 21 def rounding @rounding end |
#start ⇒ String (readonly)
Returns Updated start date (YYYY-MM-DD).
15 16 17 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 15 def start @start end |
#user_attributes ⇒ Array<TrophyApiClient::PatchPointsBoostsRequestItemUserAttributesItem> (readonly)
Returns Updated user attribute filters. Cannot be set on user-specific boosts. Set to null to clear.
24 25 26 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 24 def user_attributes @user_attributes end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::PatchPointsBoostsRequestItem
Deserialize a JSON object to an instance of PatchPointsBoostsRequestItem
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 70 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"] start = parsed_json["start"] end_ = parsed_json["end"] multiplier = parsed_json["multiplier"] rounding = parsed_json["rounding"] user_attributes = parsed_json["userAttributes"]&.map do |item| item = item.to_json TrophyApiClient::PatchPointsBoostsRequestItemUserAttributesItem.from_json(json_object: item) end new( id: id, name: name, start: start, end_: end_, multiplier: multiplier, rounding: rounding, user_attributes: user_attributes, 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.
108 109 110 111 112 113 114 115 116 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 108 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.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::PatchPointsBoostsRequestItemRounding) != false || raise("Passed value for field obj.rounding is not the expected type, validation failed.") obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PatchPointsBoostsRequestItem to a JSON object
98 99 100 |
# File 'lib/trophy_api_client/types/patch_points_boosts_request_item.rb', line 98 def to_json(*_args) @_field_set&.to_json end |