Class: Gusto::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/types/notification.rb

Overview

Representation of a notification

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, company_uuid: OMIT, title: OMIT, message: OMIT, category: OMIT, actionable: OMIT, published_at: OMIT, due_at: OMIT, resources: OMIT, additional_properties: nil) ⇒ Gusto::Notification

Parameters:

  • resources (Array<Gusto::NotificationResourcesItem>) (defaults to: OMIT)

    An array of entities relevant to the notification

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fern_gusto/types/notification.rb', line 54

def initialize(uuid:, company_uuid: OMIT, title: OMIT, message: OMIT, category: OMIT, actionable: OMIT, published_at: OMIT, due_at: OMIT, resources: OMIT, additional_properties: nil)
  @uuid = uuid
  @company_uuid = company_uuid if company_uuid != OMIT
  @title = title if title != OMIT
  @message = message if message != OMIT
  @category = category if category != OMIT
  @actionable = actionable if actionable != OMIT
  @published_at = published_at if published_at != OMIT
  @due_at = due_at if due_at != OMIT
  @resources = resources if resources != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "company_uuid": company_uuid, "title": title, "message": message, "category": category, "actionable": actionable, "published_at": published_at, "due_at": due_at, "resources": resources }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#actionableObject (readonly)

notification provides critical information only.



23
24
25
# File 'lib/fern_gusto/types/notification.rb', line 23

def actionable
  @actionable
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



32
33
34
# File 'lib/fern_gusto/types/notification.rb', line 32

def additional_properties
  @additional_properties
end

#categoryString (readonly)

Returns The notification’s category.

Returns:

  • (String)

    The notification’s category.



20
21
22
# File 'lib/fern_gusto/types/notification.rb', line 20

def category
  @category
end

#company_uuidString (readonly)

Returns Unique identifier of the company to which the notification belongs.

Returns:

  • (String)

    Unique identifier of the company to which the notification belongs.



12
13
14
# File 'lib/fern_gusto/types/notification.rb', line 12

def company_uuid
  @company_uuid
end

#due_atObject (readonly)

this field will be null.



28
29
30
# File 'lib/fern_gusto/types/notification.rb', line 28

def due_at
  @due_at
end

#messageObject (readonly)

and recommends a specific action to resolve the notification.



18
19
20
# File 'lib/fern_gusto/types/notification.rb', line 18

def message
  @message
end

#published_atString (readonly)

Returns Timestamp of when the notification was published.

Returns:

  • (String)

    Timestamp of when the notification was published.



25
26
27
# File 'lib/fern_gusto/types/notification.rb', line 25

def published_at
  @published_at
end

#resourcesArray<Gusto::NotificationResourcesItem> (readonly)

Returns An array of entities relevant to the notification.

Returns:



30
31
32
# File 'lib/fern_gusto/types/notification.rb', line 30

def resources
  @resources
end

#titleObject (readonly)

notification.



15
16
17
# File 'lib/fern_gusto/types/notification.rb', line 15

def title
  @title
end

#uuidString (readonly)

Returns Unique identifier of a notification.

Returns:

  • (String)

    Unique identifier of a notification.



10
11
12
# File 'lib/fern_gusto/types/notification.rb', line 10

def uuid
  @uuid
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Notification

Parameters:

  • json_object (String)

Returns:



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/fern_gusto/types/notification.rb', line 73

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  company_uuid = parsed_json["company_uuid"]
  title = parsed_json["title"]
  message = parsed_json["message"]
  category = parsed_json["category"]
  actionable = parsed_json["actionable"]
  published_at = parsed_json["published_at"]
  due_at = parsed_json["due_at"]
  resources = parsed_json["resources"]&.map do | item |
  item = item.to_json
  Gusto::NotificationResourcesItem.from_json(json_object: item)
end
  new(
    uuid: uuid,
    company_uuid: company_uuid,
    title: title,
    message: message,
    category: category,
    actionable: actionable,
    published_at: published_at,
    due_at: due_at,
    resources: resources,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


113
114
115
116
117
118
119
120
121
122
123
# File 'lib/fern_gusto/types/notification.rb', line 113

def self.validate_raw(obj:)
  obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.")
  obj.company_uuid&.is_a?(String) != false || raise("Passed value for field obj.company_uuid is not the expected type, validation failed.")
  obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
  obj.message&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
  obj.category&.is_a?(String) != false || raise("Passed value for field obj.category is not the expected type, validation failed.")
  obj.actionable&.is_a?(Boolean) != false || raise("Passed value for field obj.actionable is not the expected type, validation failed.")
  obj.published_at&.is_a?(String) != false || raise("Passed value for field obj.published_at is not the expected type, validation failed.")
  obj.due_at&.is_a?(String) != false || raise("Passed value for field obj.due_at is not the expected type, validation failed.")
  obj.resources&.is_a?(Array) != false || raise("Passed value for field obj.resources is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


104
105
106
# File 'lib/fern_gusto/types/notification.rb', line 104

def to_json
  @_field_set&.to_json
end