Class: TrophyApiClient::CreatedPointsBoost
- Inherits:
-
Object
- Object
- TrophyApiClient::CreatedPointsBoost
- Defined in:
- lib/trophy_api_client/types/created_points_boost.rb
Overview
A successfully created points boost returned from the create endpoint.
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 (YYYY-MM-DD) or null if no end date.
-
#id ⇒ String
readonly
The UUID of the created boost.
-
#multiplier ⇒ Float
readonly
The points multiplier.
-
#name ⇒ String
readonly
The name of the boost.
-
#rounding ⇒ TrophyApiClient::CreatedPointsBoostRounding
readonly
How boosted points are rounded.
-
#start ⇒ String
readonly
The start date (YYYY-MM-DD).
-
#status ⇒ TrophyApiClient::CreatedPointsBoostStatus
readonly
The status of the boost.
-
#user_id ⇒ String
readonly
The customer ID of the user the boost was created for.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::CreatedPointsBoost
Deserialize a JSON object to an instance of CreatedPointsBoost.
-
.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:, user_id:, end_: OMIT, additional_properties: nil) ⇒ TrophyApiClient::CreatedPointsBoost constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreatedPointsBoost to a JSON object.
Constructor Details
#initialize(id:, name:, status:, start:, multiplier:, rounding:, user_id:, end_: OMIT, additional_properties: nil) ⇒ TrophyApiClient::CreatedPointsBoost
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 45 def initialize(id:, name:, status:, start:, multiplier:, rounding:, user_id:, end_: OMIT, additional_properties: nil) @id = id @name = name @status = status @start = start @end_ = end_ if end_ != OMIT @multiplier = multiplier @rounding = rounding @user_id = user_id @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "status": status, "start": start, "end": end_, "multiplier": multiplier, "rounding": rounding, "userId": user_id }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
28 29 30 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 28 def additional_properties @additional_properties end |
#end_ ⇒ String (readonly)
Returns The end date (YYYY-MM-DD) or null if no end date.
20 21 22 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 20 def end_ @end_ end |
#id ⇒ String (readonly)
Returns The UUID of the created boost.
12 13 14 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 12 def id @id end |
#multiplier ⇒ Float (readonly)
Returns The points multiplier.
22 23 24 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 22 def multiplier @multiplier end |
#name ⇒ String (readonly)
Returns The name of the boost.
14 15 16 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 14 def name @name end |
#rounding ⇒ TrophyApiClient::CreatedPointsBoostRounding (readonly)
Returns How boosted points are rounded.
24 25 26 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 24 def rounding @rounding end |
#start ⇒ String (readonly)
Returns The start date (YYYY-MM-DD).
18 19 20 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 18 def start @start end |
#status ⇒ TrophyApiClient::CreatedPointsBoostStatus (readonly)
Returns The status of the boost.
16 17 18 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 16 def status @status end |
#user_id ⇒ String (readonly)
Returns The customer ID of the user the boost was created for.
26 27 28 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 26 def user_id @user_id end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::CreatedPointsBoost
Deserialize a JSON object to an instance of CreatedPointsBoost
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 74 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"] user_id = parsed_json["userId"] new( id: id, name: name, status: status, start: start, end_: end_, multiplier: multiplier, rounding: rounding, user_id: user_id, 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.
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 111 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::CreatedPointsBoostStatus) != 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::CreatedPointsBoostRounding) != false || raise("Passed value for field obj.rounding is not the expected type, validation failed.") obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CreatedPointsBoost to a JSON object
101 102 103 |
# File 'lib/trophy_api_client/types/created_points_boost.rb', line 101 def to_json(*_args) @_field_set&.to_json end |