Module: Pubnub::Validator::Leave

Includes:
CommonValidator
Included in:
Leave
Defined in:
lib/pubnub/validators/leave.rb

Overview

Validator for Leave event

Instance Method Summary collapse

Methods included from CommonValidator

#validate_origin, #validate_publish_key, #validate_subscribe_key

Instance Method Details

#validate!Object



9
10
11
12
# File 'lib/pubnub/validators/leave.rb', line 9

def validate!
  return if @skip_validate
  validate_channel_and_group!
end

#validate_channel_and_group!Object



14
15
16
17
18
19
20
21
22
# File 'lib/pubnub/validators/leave.rb', line 14

def validate_channel_and_group!
  fail(
    ArgumentError.new(
      object: self,
      message: 'You have to specify :channel or :group while using Leave event.'
    ),
    'You have to specify :channel or :group while using Leave event.'
  ) if @channel.size == 0 && @group.size == 0 && @wildcard_channel.size == 0
end