Class: UniOne::Webhook

Inherits:
Object
  • Object
show all
Defined in:
lib/unione/helpers/webhook/webhook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWebhook

Returns a new instance of Webhook.



5
6
7
# File 'lib/unione/helpers/webhook/webhook.rb', line 5

def initialize
  @settings = {}
end

Instance Attribute Details

#eventsObject

Returns the value of attribute events.



3
4
5
# File 'lib/unione/helpers/webhook/webhook.rb', line 3

def events
  @events
end

#settingsObject

Returns the value of attribute settings.



3
4
5
# File 'lib/unione/helpers/webhook/webhook.rb', line 3

def settings
  @settings
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/unione/helpers/webhook/webhook.rb', line 3

def status
  @status
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/unione/helpers/webhook/webhook.rb', line 3

def url
  @url
end

Instance Method Details

#to_jsonObject



9
10
11
12
13
14
15
16
# File 'lib/unione/helpers/webhook/webhook.rb', line 9

def to_json(*)
  {
    url: self.url,
    status: self.status,
    events: self.events
  }.merge(self.settings)
    .delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {}}
end