Class: MistApi::ConstWebhookTopic

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/const_webhook_topic.rb

Overview

ConstWebhookTopic Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(allows_single_event_per_message = SKIP, for_org = SKIP, has_delivery_results = SKIP, internal = SKIP, key = SKIP) ⇒ ConstWebhookTopic

Returns a new instance of ConstWebhookTopic.



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/const_webhook_topic.rb', line 61

def initialize(allows_single_event_per_message = SKIP, for_org = SKIP,
               has_delivery_results = SKIP, internal = SKIP, key = SKIP)
  unless allows_single_event_per_message == SKIP
    @allows_single_event_per_message =
      allows_single_event_per_message
  end
  @for_org = for_org unless for_org == SKIP
  @has_delivery_results = has_delivery_results unless has_delivery_results == SKIP
  @internal = internal unless internal == SKIP
  @key = key unless key == SKIP
end

Instance Attribute Details

#allows_single_event_per_messageTrueClass | FalseClass

supports single event per message results

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/mist_api/models/const_webhook_topic.rb', line 14

def allows_single_event_per_message
  @allows_single_event_per_message
end

#for_orgTrueClass | FalseClass

Can be used in org webhooks, optional

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/mist_api/models/const_webhook_topic.rb', line 18

def for_org
  @for_org
end

#has_delivery_resultsTrueClass | FalseClass

Supports webhook delivery results /api/v1/:scope/:scope_id/webhooks/:webhook_id/events/search

Returns:

  • (TrueClass | FalseClass)


23
24
25
# File 'lib/mist_api/models/const_webhook_topic.rb', line 23

def has_delivery_results
  @has_delivery_results
end

#internalTrueClass | FalseClass

Internal topic (not selectable in site/org webhooks)

Returns:

  • (TrueClass | FalseClass)


27
28
29
# File 'lib/mist_api/models/const_webhook_topic.rb', line 27

def internal
  @internal
end

#keyString

Webhook topic name

Returns:

  • (String)


31
32
33
# File 'lib/mist_api/models/const_webhook_topic.rb', line 31

def key
  @key
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/mist_api/models/const_webhook_topic.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  allows_single_event_per_message =
    hash.key?('allows_single_event_per_message') ? hash['allows_single_event_per_message'] : SKIP
  for_org = hash.key?('for_org') ? hash['for_org'] : SKIP
  has_delivery_results =
    hash.key?('has_delivery_results') ? hash['has_delivery_results'] : SKIP
  internal = hash.key?('internal') ? hash['internal'] : SKIP
  key = hash.key?('key') ? hash['key'] : SKIP

  # Create object from extracted values.
  ConstWebhookTopic.new(allows_single_event_per_message,
                        for_org,
                        has_delivery_results,
                        internal,
                        key)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
43
# File 'lib/mist_api/models/const_webhook_topic.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['allows_single_event_per_message'] =
    'allows_single_event_per_message'
  @_hash['for_org'] = 'for_org'
  @_hash['has_delivery_results'] = 'has_delivery_results'
  @_hash['internal'] = 'internal'
  @_hash['key'] = 'key'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/mist_api/models/const_webhook_topic.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/mist_api/models/const_webhook_topic.rb', line 46

def self.optionals
  %w[
    allows_single_event_per_message
    for_org
    has_delivery_results
    internal
    key
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



103
104
105
106
107
108
109
# File 'lib/mist_api/models/const_webhook_topic.rb', line 103

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} allows_single_event_per_message:"\
  " #{@allows_single_event_per_message.inspect}, for_org: #{@for_org.inspect},"\
  " has_delivery_results: #{@has_delivery_results.inspect}, internal: #{@internal.inspect},"\
  " key: #{@key.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
99
100
# File 'lib/mist_api/models/const_webhook_topic.rb', line 95

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} allows_single_event_per_message: #{@allows_single_event_per_message},"\
  " for_org: #{@for_org}, has_delivery_results: #{@has_delivery_results}, internal:"\
  " #{@internal}, key: #{@key}>"
end