Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 588 Bytes

root-elements.md

File metadata and controls

34 lines (24 loc) · 588 Bytes

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:

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

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

{
  "feed": {
    "id": 1
  }
}

You can do it like this:

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

Feed.list(id: 1)

< Default parameters | Required parameters >