Sha256: 110416a777f1c02ba11ed8e8206365fac4a8cc8f5a0d148c60a9e074d6e87c4b

Contents?: true

Size: 751 Bytes

Versions: 23

Compression:

Stored size: 751 Bytes

Contents

# *Flexirest:* Root elements

If your response comes back with a root node and you'd like to ignore it, you can define the mapping as:

```ruby
class Feed < Flexirest::Base
  post :list, "/feed", ignore_root: "feed"
end
```

This also works if you'd want to remove a tree of root nodes:

```ruby
class Feed < Flexirest::Base
  post :list, "/feed", ignore_root: ["feed", "items"]
end
```

Alternatively if you want to wrap your JSON request body in a root element, e.g.:

```json
{
  "feed": {
    "id": 1
  }
}
```

You can do it like this:

```ruby
class Feed < Flexirest::Base
  post :list, "/feed", wrap_root: "feed"
end

Feed.list(id: 1)
```


-----

[< Default parameters](default-parameters.md) | [Required parameters >](required-parameters.md)

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
flexirest-1.10.2 docs/root-elements.md
flexirest-1.10.1 docs/root-elements.md
flexirest-1.10.0 docs/root-elements.md
flexirest-1.9.18 docs/root-elements.md
flexirest-1.9.17 docs/root-elements.md
flexirest-1.9.16 docs/root-elements.md
flexirest-1.9.15 docs/root-elements.md
flexirest-1.9.14 docs/root-elements.md
flexirest-1.9.13 docs/root-elements.md
flexirest-1.9.12 docs/root-elements.md
flexirest-1.9.11 docs/root-elements.md
flexirest-1.9.10 docs/root-elements.md
flexirest-1.8.9 docs/root-elements.md
flexirest-1.8.8 docs/root-elements.md
flexirest-1.8.7 docs/root-elements.md
flexirest-1.8.6 docs/root-elements.md
flexirest-1.8.5 docs/root-elements.md
flexirest-1.8.4 docs/root-elements.md
flexirest-1.8.3 docs/root-elements.md
flexirest-1.8.2 docs/root-elements.md