Class: TrophyApiClient::EventRequestUser

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

Overview

The user that triggered the event.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, email: OMIT, name: OMIT, tz: OMIT, additional_properties: nil) ⇒ TrophyApiClient::EventRequestUser

Parameters:

  • id (String)

    The ID of the user in your database. Must be a string.

  • email (String) (defaults to: OMIT)

    The user’s email address.

  • name (String) (defaults to: OMIT)

    The name to refer to the user by in emails.

  • tz (String) (defaults to: OMIT)

    The user’s timezone (used for email scheduling).

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



31
32
33
34
35
36
37
38
39
40
# File 'lib/trophy_api_client/types/event_request_user.rb', line 31

def initialize(id:, email: OMIT, name: OMIT, tz: OMIT, additional_properties: nil)
  @id = id
  @email = email if email != OMIT
  @name = name if name != OMIT
  @tz = tz if tz != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id, "email": email, "name": name, "tz": tz }.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



18
19
20
# File 'lib/trophy_api_client/types/event_request_user.rb', line 18

def additional_properties
  @additional_properties
end

#emailString (readonly)

Returns The user’s email address.

Returns:

  • (String)

    The user’s email address.



12
13
14
# File 'lib/trophy_api_client/types/event_request_user.rb', line 12

def email
  @email
end

#idString (readonly)

Returns The ID of the user in your database. Must be a string.

Returns:

  • (String)

    The ID of the user in your database. Must be a string.



10
11
12
# File 'lib/trophy_api_client/types/event_request_user.rb', line 10

def id
  @id
end

#nameString (readonly)

Returns The name to refer to the user by in emails.

Returns:

  • (String)

    The name to refer to the user by in emails.



14
15
16
# File 'lib/trophy_api_client/types/event_request_user.rb', line 14

def name
  @name
end

#tzString (readonly)

Returns The user’s timezone (used for email scheduling).

Returns:

  • (String)

    The user’s timezone (used for email scheduling).



16
17
18
# File 'lib/trophy_api_client/types/event_request_user.rb', line 16

def tz
  @tz
end

Class Method Details

.from_json(json_object:) ⇒ TrophyApiClient::EventRequestUser

Deserialize a JSON object to an instance of EventRequestUser

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/trophy_api_client/types/event_request_user.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  email = parsed_json["email"]
  name = parsed_json["name"]
  tz = parsed_json["tz"]
  new(
    id: id,
    email: email,
    name: name,
    tz: tz,
    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)


75
76
77
78
79
80
# File 'lib/trophy_api_client/types/event_request_user.rb', line 75

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.email&.is_a?(String) != false || raise("Passed value for field obj.email 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.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of EventRequestUser to a JSON object

Returns:

  • (String)


65
66
67
# File 'lib/trophy_api_client/types/event_request_user.rb', line 65

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