Class: Samsara::Types::WebhooksGetWebhookResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::WebhooksGetWebhookResponseBody
- Defined in:
- lib/samsara_api/types/webhooks_get_webhook_response_body.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#custom_headers ⇒ Array<Samsara::Types::CustomHeadersObjectResponseBody>
readonly
The list of custom headers that users can include with their request.
-
#event_types ⇒ Array<Samsara::Types::WebhooksGetWebhookResponseBodyEventTypesItem>
readonly
The list of event types associated with a particular webhook.
-
#id ⇒ Object
readonly
the API.
-
#name ⇒ Object
readonly
API at any time.
-
#secret_key ⇒ Object
readonly
dashboard and the API.
-
#url ⇒ Object
readonly
API at any time.
-
#version ⇒ Samsara::Types::WebhooksGetWebhookResponseBodyVersion
readonly
The version of the webhook.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::WebhooksGetWebhookResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(custom_headers: OMIT, event_types: OMIT, id:, name:, secret_key:, url:, version:, additional_properties: nil) ⇒ Samsara::Types::WebhooksGetWebhookResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(custom_headers: OMIT, event_types: OMIT, id:, name:, secret_key:, url:, version:, additional_properties: nil) ⇒ Samsara::Types::WebhooksGetWebhookResponseBody
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 54 def initialize(custom_headers: OMIT, event_types: OMIT, id:, name:, secret_key:, url:, version:, additional_properties: nil) @custom_headers = custom_headers if custom_headers != OMIT @event_types = event_types if event_types != OMIT @id = id @name = name @secret_key = secret_key @url = url @version = version @additional_properties = additional_properties @_field_set = { "customHeaders": custom_headers, "eventTypes": event_types, "id": id, "name": name, "secretKey": secret_key, "url": url, "version": version }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
32 33 34 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 32 def additional_properties @additional_properties end |
#custom_headers ⇒ Array<Samsara::Types::CustomHeadersObjectResponseBody> (readonly)
Returns The list of custom headers that users can include with their request.
12 13 14 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 12 def custom_headers @custom_headers end |
#event_types ⇒ Array<Samsara::Types::WebhooksGetWebhookResponseBodyEventTypesItem> (readonly)
Returns The list of event types associated with a particular webhook.
14 15 16 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 14 def event_types @event_types end |
#id ⇒ Object (readonly)
the API. This is the id of the webhook. This is system generated.
17 18 19 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 17 def id @id end |
#name ⇒ Object (readonly)
API at any time.
21 22 23 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 21 def name @name end |
#secret_key ⇒ Object (readonly)
dashboard and the API.
24 25 26 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 24 def secret_key @secret_key end |
#url ⇒ Object (readonly)
API at any time.
28 29 30 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 28 def url @url end |
#version ⇒ Samsara::Types::WebhooksGetWebhookResponseBodyVersion (readonly)
Returns The version of the webhook. Valid values: ‘2018-01-01`, `2021-06-09`.
30 31 32 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 30 def version @version end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::WebhooksGetWebhookResponseBody
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 71 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) custom_headers = parsed_json["customHeaders"]&.map do | item | item = item.to_json Samsara::Types::CustomHeadersObjectResponseBody.from_json(json_object: item) end event_types = parsed_json["eventTypes"] id = parsed_json["id"] name = parsed_json["name"] secret_key = parsed_json["secretKey"] url = parsed_json["url"] version = parsed_json["version"] new( custom_headers: custom_headers, event_types: event_types, id: id, name: name, secret_key: secret_key, url: url, version: version, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
107 108 109 110 111 112 113 114 115 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 107 def self.validate_raw(obj:) obj.custom_headers&.is_a?(Array) != false || raise("Passed value for field obj.custom_headers is not the expected type, validation failed.") obj.event_types&.is_a?(Array) != false || raise("Passed value for field obj.event_types is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id 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.secret_key.is_a?(String) != false || raise("Passed value for field obj.secret_key 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.version.is_a?(Samsara::Types::WebhooksGetWebhookResponseBodyVersion) != false || raise("Passed value for field obj.version is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
98 99 100 |
# File 'lib/samsara_api/types/webhooks_get_webhook_response_body.rb', line 98 def to_json @_field_set&.to_json end |