Class: Sekisyo::WhitelistDetails::Method
- Inherits:
-
Object
- Object
- Sekisyo::WhitelistDetails::Method
- Defined in:
- lib/sekisyo/whitelist_details/method.rb
Overview
Sekisyo WhitelistDetails Method is a definition object for each HTTP method of a specific path in the whitelist.
Instance Method Summary collapse
-
#initialize(object = {}) ⇒ Method
constructor
A new instance of Method.
- #valid?(params) ⇒ true, false
Constructor Details
#initialize(object = {}) ⇒ Method
Returns a new instance of Method.
14 15 16 17 18 19 |
# File 'lib/sekisyo/whitelist_details/method.rb', line 14 def initialize(object = {}) @required = object.fetch('required', []).flat_map do |attr| attr.is_a?(Hash) ? transform_required_keys(attr) : [[attr]] end @properties = Sekisyo::WhitelistDetails::Properties.new(object['properties']) end |
Instance Method Details
#valid?(params) ⇒ true, false
26 27 28 |
# File 'lib/sekisyo/whitelist_details/method.rb', line 26 def valid?(params) required_validate(params) && @properties.valid?(params) end |