README.md in flexirest-1.3.2 vs README.md in flexirest-1.3.3

- old
+ new

@@ -29,11 +29,11 @@ First you need to create your new model class: ```ruby # config/environments/production.rb -MyApp::Application.configure do +Rails.application.configure do # ... config.api_server_url = "https://www.example.com/api/v1" end # app/models/person.rb @@ -121,10 +121,14 @@ ```ruby @person = Person.find(email:"something@example.com") puts @person.to_json ``` +### Ruby on Rails Integration + +A detailed guide, how to integrate Flexirest with a RESTful resources can be found in the [Ruby-on-Rails-Integration.md](https://github.com/andyjeffries/flexirest/blob/master/Ruby-on-Rails-Integration.md). + ## Advanced Features ### Faraday Configuration Flexirest uses Faraday to allow switching HTTP backends, the default is to just use Faraday's default. To change the used backend just set it in the class by setting `adapter` to a Faraday supported adapter symbol. @@ -784,10 +788,20 @@ } # The last thing is the hash of defaults end) end ``` +### Root element removal + +If your JSON or XML object comes back with a root node and you'd like to ignore it, you can define the mapping as: + +```ruby +class Feed < Flexirest::Base + get :list, "/feed", ignore_root: "feed" +end +``` + ### Required Parameters If you want to specify that certain parameters are required for a specific call, you can specify them like: ```ruby @@ -915,14 +929,12 @@ end end end ``` -## Beta Features +## XML Responses -### XML Responses - Flexirest uses Crack to allow parsing of XML responses. For example, given an XML response of (with a content type of `application/xml` or `text/xml`): ```xml <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> @@ -966,17 +978,9 @@ puts @atom.feed.title puts @atom.feed.link.href @atom.feed.entry.each do |entry| puts "#{entry.title} -> #{entry.link.href}" -end -``` - -If your XML object comes back with a root node and you'd like to ignore it, you can define the mapping as: - -```ruby -class Feed < Flexirest::Base - get :atom, "/atom", ignore_xml_root: "feed" end ``` For testing purposes, if you are using a `fake` content response when defining your endpoint, you should also provide `fake_content_type: "application/xml"` so that the parser knows to use XML parsing.