grape

Groovy grapes freeze after downloading artifacts

南笙酒味 提交于 2019-12-05 22:32:06
After updating my ubuntu system I have problem to run groovy grapes scripts. All dependecies are download but process is still running in about 100 % I have ubuntu : lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.10 Release: 12.10 Codename: quantal groovy version: Groovy Version: 1.8.6 JVM: 1.7.0_25 Vendor: Oracle Corporation OS: Linux My simple script look like: @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.6') @GrabExclude('asm:*') import groovyx.net.http.* import groovy.util.CliBuilder import groovy.xml

Why ActionDispatch::Routing::RouteSet takes so long

懵懂的女人 提交于 2019-12-05 20:54:13
问题 I am using Grape on top of Rails 4.2.1 to provide API for our application. But when I check Newrelic for performance today I found that RackApp Proc#call and Grape API::Root#call are taking up large amount of time. (See the screenshot) Then I tried to log the time consumed in middleware with rack_timer and found that ActionDispatch::Routing::RouteSet is taking up most of the time: Rack Timer (Application Action) -- ActionDispatch::Routing::RouteSet: 67.12579727172852 ms Rack Timer

testing rails grape API with curl, params array

蹲街弑〆低调 提交于 2019-12-05 20:18:30
I am manually testing my rails application grape API using curl. I would like to send a [1,2,3] array as a request query parameter for to to be accesible like: p params[:tickets_ids] => [1,2,3] I only found clues how to send something what is interpreted as hash . I will be grateful for a clue how to post an array using curl. Thank you for the clue. The answer is to encode query like this: ?&tickets_ids[]=1&tickets_ids[]=2&tickets_ids[]=3 Results in: p params[:tickets_ids] => ["1", "2", "3"] 来源: https://stackoverflow.com/questions/18314017/testing-rails-grape-api-with-curl-params-array

Why does mounting a route in Rails fail with “uninitialized constant API”?

大兔子大兔子 提交于 2019-12-05 10:30:08
I am working on an app that includes an API that is using the grape gem. Here is my Root Class: module API class Root < Grape::API rescue_from :all do |e| Rack::Response.new( [ "Error: #{e.message}" ], 500, { "Content-type" => "text/error" } ).finish end prefix "api" version 'v1', using: :path format :json error_format :json mount ::API::ServiceRequests end end Here is how I am mounting it in routes: mount API::Root => '/' The error I am receiving is: routes.rb:45:in block in ': uninitialized constant API (NameError)` The files are structured like app/api/root.rb and I have this bit of code in

Grape error handling strategy?

让人想犯罪 __ 提交于 2019-12-05 04:06:32
I am using Grape and Rails to create a REST API. I have the basic architecture in place and I am looking for places to 'clean' things up. One of those places is the error handling/processing. I am currently rescuing errors in the root.rb (GRAPE::API base class) file for the whole API. I format them and then send the error back via rack_response. Everything works find but the root.rb file is getting a bit bloated with all the errors being rescued and some of them have special parsing that needs to be done. I was wondering if anyone has developed a good strategy for error handling so that it can

Why am I getting “Unable to autoload constant” with Rails and grape?

核能气质少年 提交于 2019-12-04 17:25:37
问题 I want to do an API for an Android app. When searching, I found {grape}. I'm following this tutorial, but I have a problem launching the Rails server: => Booting WEBrick => Rails 4.0.2 application starting in development on http://0.0.0.0:80 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server Exiting C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/act ive_support/dependencies.rb:464:in `load_missing_constant': Unable to autoload c

Groovy with Grape and AntBuilder classloader problem

有些话、适合烂在心里 提交于 2019-12-04 11:44:16
问题 I wanted to use groovy for a little ftp script and found this post http://www.hhhhq.org/blog/2009/05/01/ftp-using-groovy-and-ant/ Since there were several dependencies I wanted to use Grape. All dependencies are resolved and present in the cache. But I can't get Ant to find the optional tasks in the other libs. It always says Caught: : Problem: failed to create task or type ftp Cause: the class org.apache.tools.ant.taskdefs.optional.net.FTP was not found. This looks like one of Ant's optional

RestSharp Accept header change

前提是你 提交于 2019-12-04 04:12:08
I am using RestSharp for developing on the client side. I am also using Ruby Grape gem for my custom API on server side. Grape gem can do versioning by setting Accept HTTP header f.e to application/vnd.twitter-v1+json And test command via console works perfect curl -H Accept=application/vnd.twitter-v1+json /statuses/public_timeline But when I am trying to set up header for RestRequest I am getting error 404 on the server. I have no idea why so. I have found another issue that server returns 406 error - but in my case 404. How can I put custom value for Accept header? You can set a custom

Why am I getting “Unable to autoload constant” with Rails and grape?

风格不统一 提交于 2019-12-03 10:21:42
I want to do an API for an Android app. When searching, I found {grape} . I'm following this tutorial , but I have a problem launching the Rails server: => Booting WEBrick => Rails 4.0.2 application starting in development on http://0.0.0.0:80 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server Exiting C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/act ive_support/dependencies.rb:464:in `load_missing_constant': Unable to autoload c onstant Usuarios, expected C:/Sites/appCerca/app/api/v1/usuarios.rb to define it (LoadError) My directory:

Intellij IDEA not importing dependencies from @Grab in Groovy project

 ̄綄美尐妖づ 提交于 2019-12-03 04:06:27
问题 I have a groovy script I am working on, which imports dependencies using the @Grab annotation. This script will run within IDEA, and from the command line. However, within the IDE, the imports are shown in red (as unresolvable), and no auto-completion on the classes so imported is given. I am accessing a corporate repository via a proxy, which has been configured as the Http Proxy within IDEA (the module should be, and is, in my local .m2 repo anyway!) Anyone got any ideas (no pun intended!)?