Class: Nylas::FilterAttributes
- Inherits:
-
Object
- Object
- Nylas::FilterAttributes
- Defined in:
- lib/nylas/filter_attributes.rb
Overview
Methods to check and raise error if extra attributes are present
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(attributes:, allowed_attributes:) ⇒ FilterAttributes
constructor
A new instance of FilterAttributes.
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
#check ⇒ Object
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 |