README.md in jsonapi_mapper-0.1.0 vs README.md in jsonapi_mapper-0.1.1
- old
+ new
@@ -68,13 +68,25 @@
mapper = JsonapiMapper.doc(document,
people: [:name, :pet, :parent, :children, country: 'argentina'],
pet_dogs: [:name, country: 'argentina']
)
- person = mapper.data # This is the main document data as a new object
- others = mapper.included # These are all the other resources.
- mapper.save_all # Attempts to save both data and included.
+ # The document data lives in mapper.data
+ # It's always an array, even if the document had a single resource.
+ # If you want to check wether the document had a single resource
+ # or a collection as its primary data you can use the following methods.
+ mapper.collection? # Was primary document data a collection?
+ mapper.single? # Was primary document data a single resource?
+
+ person = mapper.data.first
+
+ # The rest of the included resources live in mapper.included
+ others = mapper.included
+
+ # Attempts to save both data and included. Returns false if there
+ # were any validation errors.
+ mapper.save_all
# Four people have been created
Person.count.should == 4
# All of them from 'argentina' according to the provided scope.
@@ -143,10 +155,14 @@
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
-Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jsonapi_mapper.
+Bug reports and pull requests are welcome here.
+
+## Code Status
+
+[![Build Status](https://circleci.com/gh/bitex-la/jsonapi-mapper.png)](https://circleci.com/gh/bitex-la/jsonapi-mapper)
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).