Class: Nylas::FilterAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/nylas/filter_attributes.rb

Overview

Methods to check and raise error if extra attributes are present

Instance Method Summary collapse

Constructor Details

#initialize(attributes:, allowed_attributes:) ⇒ FilterAttributes

Returns a new instance of FilterAttributes.



6
7
8
9
# File 'lib/nylas/filter_attributes.rb', line 6

def initialize(attributes:, allowed_attributes:)
  @attributes = attributes
  @allowed_attributes = allowed_attributes
end

Instance Method Details

#checkObject

Raises:

  • (ArgumentError)


11
12
13
14
15
# File 'lib/nylas/filter_attributes.rb', line 11

def check
  return if extra_attributes.empty?

  raise ArgumentError, "Only #{allowed_attributes} are allowed to be sent"
end