Class: Gusto::Webhooks::WebhookSubscription
- Inherits:
-
Object
- Object
- Gusto::Webhooks::WebhookSubscription
- Defined in:
- lib/fern_gusto/webhooks/types/webhook_subscription.rb
Overview
The representation of webhook subscription.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#status ⇒ Gusto::Webhooks::WebhookSubscriptionStatus
readonly
The status of the webhook subscription.
-
#subscription_types ⇒ Array<Gusto::Webhooks::WebhookSubscriptionSubscriptionTypesItem>
readonly
Receive updates for these types.
-
#url ⇒ String
readonly
The webhook subscriber URL.
-
#uuid ⇒ String
readonly
The UUID of the webhook subscription.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(uuid:, url: OMIT, status: OMIT, subscription_types: OMIT, additional_properties: nil) ⇒ Gusto::Webhooks::WebhookSubscription constructor
- #to_json ⇒ String
Constructor Details
#initialize(uuid:, url: OMIT, status: OMIT, subscription_types: OMIT, additional_properties: nil) ⇒ Gusto::Webhooks::WebhookSubscription
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 33 def initialize(uuid:, url: OMIT, status: OMIT, subscription_types: OMIT, additional_properties: nil) @uuid = uuid @url = url if url != OMIT @status = status if status != OMIT @subscription_types = subscription_types if subscription_types != OMIT @additional_properties = additional_properties @_field_set = { "uuid": uuid, "url": url, "status": status, "subscription_types": subscription_types }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
20 21 22 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 20 def additional_properties @additional_properties end |
#status ⇒ Gusto::Webhooks::WebhookSubscriptionStatus (readonly)
Returns The status of the webhook subscription.
16 17 18 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 16 def status @status end |
#subscription_types ⇒ Array<Gusto::Webhooks::WebhookSubscriptionSubscriptionTypesItem> (readonly)
Returns Receive updates for these types.
18 19 20 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 18 def subscription_types @subscription_types end |
#url ⇒ String (readonly)
Returns The webhook subscriber URL. Updates will be POSTed to this URL.
14 15 16 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 14 def url @url end |
#uuid ⇒ String (readonly)
Returns The UUID of the webhook subscription.
12 13 14 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 12 def uuid @uuid end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Webhooks::WebhookSubscription
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) uuid = parsed_json["uuid"] url = parsed_json["url"] status = parsed_json["status"] subscription_types = parsed_json["subscription_types"] new( uuid: uuid, url: url, status: status, subscription_types: subscription_types, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
74 75 76 77 78 79 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 74 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.url&.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") obj.status&.is_a?(Gusto::Webhooks::WebhookSubscriptionStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.subscription_types&.is_a?(Array) != false || raise("Passed value for field obj.subscription_types is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
65 66 67 |
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 65 def to_json @_field_set&.to_json end |