Skip to content

Commit

Permalink
update README and gmspec
Browse files Browse the repository at this point in the history
  • Loading branch information
4xposed committed Dec 25, 2016
1 parent 3cb8d9c commit c6dec65
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
40 changes: 27 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Grape::Sideload

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/grape/sideload`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem
Add sideloading support to your Grape API so you can deliver multiple resources under one endpoint.

## Installation

Expand All @@ -12,30 +10,46 @@ Add this line to your application's Gemfile:
gem 'grape-sideload'
```

And then execute:
then execute:

$ bundle

Or install it yourself as:
And add to your `app.rb`

```ruby
require 'grape-sideload'
```

$ gem install grape-sideload

## Usage

TODO: Write usage instructions here
example for sideloading with `present many`:

## Development
```ruby
resources :nature do
get do
present_many { present: Animal.all, with: Animal::Entity },
{ present: Fruit.all, with: Fruit::Entity}
end
end
```

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
example for sideloading with `merge_payloads` to sideload using grape's present syntax:

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).
```ruby
resource :nature do
get do
merge_payloads present(Animal.all, with: Animal::Entity),
present(Fruit.all, with: Fruit::Entity)

## Contributing
end
end
```

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/grape-sideload. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/4xposed/grape-sideload. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

2 changes: 1 addition & 1 deletion grape-sideload.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |spec|

spec.summary = %q{Sideload resources on your JSON response in your Grape API}
spec.description = %q{Sideload resources on your JSON response in your Grape API}
spec.homepage = ""
spec.homepage = "https://github.com/4xposed/grape-sideload"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0")
Expand Down

0 comments on commit c6dec65

Please sign in to comment.