Sha256: e890272844f39abaad2cfc8262d553c8ac71fa94b583300e1f9d8b6e63196aca

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

# InputSanitizer::V2::PayloadSanitizer

Usage example:

```ruby
class ContactPayload < InputSanitizer::V2::PayloadSanitizer
  string :status, allow: ['', 'current', 'past']
  integer :ids, collection: true, minimum: 1
  string :tags, collection: { minimum: 1, maximum: 4 }
  boolean :admin_flag
  datetime :launch_at
  url :website
  nested :address, sanitizer: AddressSanitizer
end

class AddressSanitizer < InputSanitizer::V2::PayloadSanitizer
  string :city
end
```

# InputSanitizer::V2::QuerySanitizer

Example:

```ruby
class IndexParams < InputSanitizer::V2::QuerySanitizer
  string :name
  integer :ids, collection: true
  sort_by %w(name updated_at created_at)
end
```

# InputSanitizer::V2::PayloadTransform

Example:

```ruby
class AddressTransform < InputSanitizer::V2::PayloadTransform
  def transform
    rename :line1, :street
  end
end

class ContactPayloadTransform < InputSanitizer::V2::PayloadTransform
  def transform
    rename :value, :scope
    merge_in :address, using: AddressTransform

    payload[:other_thing] = payload.delete(:thing) * 2
  end
end
```

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
input_sanitizer-0.6.0 v2.md
input_sanitizer-0.5.0 v2.md
input_sanitizer-0.4.1 v2.md
input_sanitizer-0.4.0 v2.md
input_sanitizer-0.3.33 v2.md