Class: Gusto::Webhooks::WebhookSubscription

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, url: OMIT, status: OMIT, subscription_types: OMIT, additional_properties: nil) ⇒ Gusto::Webhooks::WebhookSubscription

Parameters:

  • uuid (String)

    The UUID of the webhook subscription.

  • url (String) (defaults to: OMIT)

    The webhook subscriber URL. Updates will be POSTed to this URL.

  • status (Gusto::Webhooks::WebhookSubscriptionStatus) (defaults to: OMIT)

    The status of the webhook subscription.

  • subscription_types (Array<Gusto::Webhooks::WebhookSubscriptionSubscriptionTypesItem>) (defaults to: OMIT)

    Receive updates for these types.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#statusGusto::Webhooks::WebhookSubscriptionStatus (readonly)

Returns The status of the webhook subscription.

Returns:



16
17
18
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 16

def status
  @status
end

#subscription_typesArray<Gusto::Webhooks::WebhookSubscriptionSubscriptionTypesItem> (readonly)

Returns Receive updates for these types.

Returns:



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

def subscription_types
  @subscription_types
end

#urlString (readonly)

Returns The webhook subscriber URL. Updates will be POSTed to this URL.

Returns:

  • (String)

    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

#uuidString (readonly)

Returns The UUID of the webhook subscription.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (String)


65
66
67
# File 'lib/fern_gusto/webhooks/types/webhook_subscription.rb', line 65

def to_json
  @_field_set&.to_json
end