ruby on rails - How can find domain name in Grape::API -


i not able fetch request object in grape::api, method is

module artical

module railsapp module v1 class articleapi < grape::api include railsapp::v1::defaults

  resource :articleapi     desc "return article"      "", root: :articles         error!({:error_message => "please provide article id."}, 422)     end      desc "return acticle"      params       requires :id, type: string, desc: "id of photo"     end      ":id", root: "photo"        @artical = contents.where(id: params[:id],content_type: 'article').first        if @artical.present?         error!({:success_message => "record found",:result => @artical }, 300)       else         error!({:error_message => "record not found"}, 422)       end       # photos.where(:id =>  @id).update_all(publish_status: @status_value)     end   end 

in grape endpoint can access request object "request". request object has many methods available access various parameters.

for example: if want access path details of request :

request.path_info 

will give path details of current request.if want know various methods available request object, print , check :

request.methods 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -