Class: PhraseApp::RequestParams::WebhookParams

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/phraseapp-ruby.rb

Overview

WebhookParams

Parameters:

active

Whether webhook is active or inactive

callback_url

Callback URL to send requests to

description

Webhook description

events

List of event names to trigger the webhook (separated by comma)

Instance Method Summary collapse

Instance Method Details

#active=(val) ⇒ Object



1049
1050
1051
1052
1053
1054
1055
1056
1057
# File 'lib/phraseapp-ruby.rb', line 1049

def active=(val)
  if val.is_a?(TrueClass)
    self.active = true
  elsif val.is_a?(FalseClass) #ignore
    self.active = b
  else
    PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
  end
end

#callback_url=(val) ⇒ Object



1059
1060
1061
# File 'lib/phraseapp-ruby.rb', line 1059

def callback_url=(val)
  self.callback_url = val
end

#description=(val) ⇒ Object



1063
1064
1065
# File 'lib/phraseapp-ruby.rb', line 1063

def description=(val)
  self.description = val
end

#events=(val) ⇒ Object



1067
1068
1069
# File 'lib/phraseapp-ruby.rb', line 1067

def events=(val)
  self.events = val
end

#to_hObject



1079
1080
1081
# File 'lib/phraseapp-ruby.rb', line 1079

def to_h
  @table.dup
end

#validateObject



1071
1072
1073
1074
1075
1076
1077
# File 'lib/phraseapp-ruby.rb', line 1071

def validate
  if self.callback_url == nil || self.callback_url == "" 
    raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"callback_url\" of \"WebhookParams\" not set")
  endif self.events == nil || self.events == "" 
    raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"events\" of \"WebhookParams\" not set")
  end
end