Class: TrophyApiClient::PointsBoostWebhookPayload

Inherits:
Object
  • Object
show all
Defined in:
lib/trophy_api_client/types/points_boost_webhook_payload.rb

Overview

Points boost payload sent in points.boost_started and points.boost_finished

webhook events.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, status:, points_system_id:, points_system_key:, points_system_name:, start:, multiplier:, rounding:, user_id: OMIT, end_: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PointsBoostWebhookPayload

Parameters:

  • id (String)

    The ID of the points boost.

  • name (String)

    The name of the points boost.

  • status (TrophyApiClient::PointsBoostWebhookPayloadStatus)

    The status of the points boost.

  • user_id (String) (defaults to: OMIT)

    The customer-facing user ID that the boost is scoped to, or null for global boosts.

  • points_system_id (String)

    The ID of the points system this boost applies to.

  • points_system_key (String)

    The key of the points system this boost applies to.

  • points_system_name (String)

    The name of the points system this boost applies to.

  • start (String)

    The start date of the points boost (YYYY-MM-DD).

  • end_ (String) (defaults to: OMIT)

    The end date of the points boost (YYYY-MM-DD), or null if open-ended.

  • multiplier (Float)

    The multiplier applied to points during the boost.

  • rounding (TrophyApiClient::PointsBoostWebhookPayloadRounding)

    The rounding method applied to boosted points.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 57

def initialize(id:, name:, status:, points_system_id:, points_system_key:, points_system_name:, start:,
               multiplier:, rounding:, user_id: OMIT, end_: OMIT, additional_properties: nil)
  @id = id
  @name = name
  @status = status
  @user_id = user_id if user_id != OMIT
  @points_system_id = points_system_id
  @points_system_key = points_system_key
  @points_system_name = points_system_name
  @start = start
  @end_ = end_ if end_ != OMIT
  @multiplier = multiplier
  @rounding = rounding
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "name": name,
    "status": status,
    "userId": user_id,
    "pointsSystemId": points_system_id,
    "pointsSystemKey": points_system_key,
    "pointsSystemName": points_system_name,
    "start": start,
    "end": end_,
    "multiplier": multiplier,
    "rounding": rounding
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



36
37
38
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 36

def additional_properties
  @additional_properties
end

#end_String (readonly)

Returns The end date of the points boost (YYYY-MM-DD), or null if open-ended.

Returns:

  • (String)

    The end date of the points boost (YYYY-MM-DD), or null if open-ended.



30
31
32
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 30

def end_
  @end_
end

#idString (readonly)

Returns The ID of the points boost.

Returns:

  • (String)

    The ID of the points boost.



13
14
15
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 13

def id
  @id
end

#multiplierFloat (readonly)

Returns The multiplier applied to points during the boost.

Returns:

  • (Float)

    The multiplier applied to points during the boost.



32
33
34
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 32

def multiplier
  @multiplier
end

#nameString (readonly)

Returns The name of the points boost.

Returns:

  • (String)

    The name of the points boost.



15
16
17
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 15

def name
  @name
end

#points_system_idString (readonly)

Returns The ID of the points system this boost applies to.

Returns:

  • (String)

    The ID of the points system this boost applies to.



22
23
24
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 22

def points_system_id
  @points_system_id
end

#points_system_keyString (readonly)

Returns The key of the points system this boost applies to.

Returns:

  • (String)

    The key of the points system this boost applies to.



24
25
26
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 24

def points_system_key
  @points_system_key
end

#points_system_nameString (readonly)

Returns The name of the points system this boost applies to.

Returns:

  • (String)

    The name of the points system this boost applies to.



26
27
28
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 26

def points_system_name
  @points_system_name
end

#roundingTrophyApiClient::PointsBoostWebhookPayloadRounding (readonly)

Returns The rounding method applied to boosted points.

Returns:



34
35
36
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 34

def rounding
  @rounding
end

#startString (readonly)

Returns The start date of the points boost (YYYY-MM-DD).

Returns:

  • (String)

    The start date of the points boost (YYYY-MM-DD).



28
29
30
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 28

def start
  @start
end

#statusTrophyApiClient::PointsBoostWebhookPayloadStatus (readonly)

Returns The status of the points boost.

Returns:



17
18
19
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 17

def status
  @status
end

#user_idString (readonly)

Returns The customer-facing user ID that the boost is scoped to, or null for global boosts.

Returns:

  • (String)

    The customer-facing user ID that the boost is scoped to, or null for global boosts.



20
21
22
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 20

def user_id
  @user_id
end

Class Method Details

.from_json(json_object:) ⇒ TrophyApiClient::PointsBoostWebhookPayload

Deserialize a JSON object to an instance of PointsBoostWebhookPayload

Parameters:

  • json_object (String)

Returns:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 92

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"]
  user_id = parsed_json["userId"]
  points_system_id = parsed_json["pointsSystemId"]
  points_system_key = parsed_json["pointsSystemKey"]
  points_system_name = parsed_json["pointsSystemName"]
  start = parsed_json["start"]
  end_ = parsed_json["end"]
  multiplier = parsed_json["multiplier"]
  rounding = parsed_json["rounding"]
  new(
    id: id,
    name: name,
    status: status,
    user_id: user_id,
    points_system_id: points_system_id,
    points_system_key: points_system_key,
    points_system_name: points_system_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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 135

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::PointsBoostWebhookPayloadStatus) != false || raise("Passed value for field obj.status 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.")
  obj.points_system_id.is_a?(String) != false || raise("Passed value for field obj.points_system_id is not the expected type, validation failed.")
  obj.points_system_key.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
  obj.points_system_name.is_a?(String) != false || raise("Passed value for field obj.points_system_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::PointsBoostWebhookPayloadRounding) != 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 PointsBoostWebhookPayload to a JSON object

Returns:

  • (String)


125
126
127
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 125

def to_json(*_args)
  @_field_set&.to_json
end