Class: Gusto::Notification
- Inherits:
-
Object
- Object
- Gusto::Notification
- Defined in:
- lib/fern_gusto/types/notification.rb
Overview
Representation of a notification
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#actionable ⇒ Object
readonly
notification provides critical information only.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#category ⇒ String
readonly
The notification’s category.
-
#company_uuid ⇒ String
readonly
Unique identifier of the company to which the notification belongs.
-
#due_at ⇒ Object
readonly
this field will be null.
-
#message ⇒ Object
readonly
and recommends a specific action to resolve the notification.
-
#published_at ⇒ String
readonly
Timestamp of when the notification was published.
-
#resources ⇒ Array<Gusto::NotificationResourcesItem>
readonly
An array of entities relevant to the notification.
-
#title ⇒ Object
readonly
notification.
-
#uuid ⇒ String
readonly
Unique identifier of a notification.
Class Method Summary collapse
Instance Method Summary collapse
- #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 constructor
- #to_json ⇒ String
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
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 = if != 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": , "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
#actionable ⇒ Object (readonly)
notification provides critical information only.
23 24 25 |
# File 'lib/fern_gusto/types/notification.rb', line 23 def actionable @actionable end |
#additional_properties ⇒ OpenStruct (readonly)
Returns 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 |
#category ⇒ String (readonly)
Returns The notification’s category.
20 21 22 |
# File 'lib/fern_gusto/types/notification.rb', line 20 def category @category end |
#company_uuid ⇒ String (readonly)
Returns 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_at ⇒ Object (readonly)
this field will be null.
28 29 30 |
# File 'lib/fern_gusto/types/notification.rb', line 28 def due_at @due_at end |
#message ⇒ Object (readonly)
and recommends a specific action to resolve the notification.
18 19 20 |
# File 'lib/fern_gusto/types/notification.rb', line 18 def @message end |
#published_at ⇒ String (readonly)
Returns 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 |
#resources ⇒ Array<Gusto::NotificationResourcesItem> (readonly)
Returns An array of entities relevant to the notification.
30 31 32 |
# File 'lib/fern_gusto/types/notification.rb', line 30 def resources @resources end |
#title ⇒ Object (readonly)
notification.
15 16 17 |
# File 'lib/fern_gusto/types/notification.rb', line 15 def title @title end |
#uuid ⇒ String (readonly)
Returns 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
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"] = 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: , category: category, actionable: actionable, published_at: published_at, due_at: due_at, resources: resources, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ 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.&.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_json ⇒ String
104 105 106 |
# File 'lib/fern_gusto/types/notification.rb', line 104 def to_json @_field_set&.to_json end |