Giter Club home page Giter Club logo

grape-with-roar's People

Contributors

dblock avatar dylanfareed avatar jcwilk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grape-with-roar's Issues

Hyperclient sample for README

This doesn't work (on the with-mongoid branch) for _post.

require 'hyperclient'

client = Hyperclient.new('http://localhost:9292/api')

3.times do |i|
  client.splines._post(spline: { name: i.to_s, reticulated: [true, false].sample })
end

client.splines.each do |spline|
  puts "spline #{spline.id} #{spline.reticulated ? 'is' : 'is not'} reticulated"
end

client.splines.each(&:_delete)

I can't upgrade to grape 0.10

I use this project as a template, except I use activerecord:

get 'articles' do
  # ActiveRecord::Relation
  articles = Articles.all
  # articles.respond_to?('merge') == true
  present articles, with: ArticlesPresenter
end

This crashes because of this change.

Because the opts parameter is empty:

link :self do |opts|
  "#{base_url(opts)}/api"
end

Though it's not a problem for this project because splines is an array and it doesn't respond_to?('merge').

get do
  splines = Acme::Models::Spline.all
  present Kaminari.paginate_array(splines).page(params[:page]).per(params[:size]), with: Acme::Api::Presenters::SplinesPresenter
end

I can't understand further, please fix this, here's a full stack trace:

NoMethodError:
undefined method `[]' for nil:NilClass
Shared Example Group: "paginated resource" called from ./spec/app/api/article_spec.rb:4
# ./app/presenters/paginated_presenter.rb:33:in `request_url'
# ./app/presenters/paginated_presenter.rb:16:in `block in <module:PaginatedPresenter>'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/roar-1.0.0/lib/roar/hypermedia.rb:80:in `instance_exec'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/roar-1.0.0/lib/roar/hypermedia.rb:80:in `run_link_block'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/roar-1.0.0/lib/roar/hypermedia.rb:68:in `block in compile_links_for'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/roar-1.0.0/lib/roar/hypermedia.rb:66:in `collect'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/roar-1.0.0/lib/roar/hypermedia.rb:66:in `compile_links_for'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/roar-1.0.0/lib/roar/hypermedia.rb:62:in `prepare_links!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/roar-1.0.0/lib/roar/hypermedia.rb:139:in `block in create_links_definition!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/uber-0.0.12/lib/uber/options.rb:80:in `instance_exec'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/uber-0.0.12/lib/uber/options.rb:80:in `proc!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/uber-0.0.12/lib/uber/options.rb:69:in `evaluate_for'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/uber-0.0.12/lib/uber/options.rb:60:in `evaluate'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/binding.rb:107:in `evaluate_option'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/binding.rb:80:in `get'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/binding.rb:37:in `block in compile_fragment'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/binding.rb:100:in `evaluate_option'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/binding.rb:36:in `compile_fragment'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/mapper.rb:64:in `compile_fragment'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/roar-1.0.0/lib/roar/json/hal.rb:64:in `compile_fragment'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/mapper.rb:30:in `serialize_property'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/mapper.rb:22:in `block in serialize'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/mapper.rb:21:in `each'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/mapper.rb:21:in `serialize'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable.rb:41:in `create_representation_with'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/representable-2.1.3/lib/representable/hash.rb:35:in `to_hash'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/dsl/inside_route.rb:200:in `merge'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/dsl/inside_route.rb:200:in `present'
# ./app/api/articles.rb:20:in `block in <class:Articles>'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/endpoint.rb:47:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/endpoint.rb:47:in `block in generate_api_method'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/endpoint.rb:247:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/endpoint.rb:247:in `run'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/endpoint.rb:195:in `block in call!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/base.rb:24:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/base.rb:24:in `call!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/base.rb:18:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/base.rb:24:in `call!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/base.rb:18:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/error.rb:27:in `block in call!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/error.rb:26:in `catch'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/error.rb:26:in `call!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/middleware/base.rb:18:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-1.6.0/lib/rack/head.rb:13:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-1.6.0/lib/rack/builder.rb:153:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/endpoint.rb:196:in `call!'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/endpoint.rb:184:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:in `block in call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in `block in recognize'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:75:in `optimized_each'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in `recognize'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in `block in recognize'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:75:in `optimized_each'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in `recognize'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/grape-0.10.1/lib/grape/api.rb:102:in `call'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
# /home/ubuntu/.rvm/gems/ruby-2.1.3/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
# ./spec/app/api/shared_examples/resource.rb:34:in `block (3 levels) in <top (required)>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.