File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -447,6 +447,33 @@ resource "Orders" do
447447end
448448```
449449
450+
451+ You can also group metadata using [ with_options] ( http://api.rubyonrails.org/classes/Object.html#method-i-with_options ) to factor out duplications.
452+
453+ ``` ruby
454+ resource " Orders" do
455+ post " /orders" do
456+
457+ with_options :scope => :order , :required => true do
458+ parameter :name , " Order Name"
459+ parameter :item , " Order items"
460+ end
461+
462+ with_options :scope => :order do
463+ response_field :id , " Order ID"
464+ response_field :status , " Order status"
465+ end
466+
467+ let(:name ) { " My Order" }
468+ let(:item_id ) { 1 }
469+
470+ example " Creating an order" do
471+ expect(status).to be 201
472+ end
473+ end
474+ end
475+ ```
476+
450477#### callback
451478
452479This is complicated, see [ relish docs] ( https://www.relishapp.com/zipmark/rspec-api-documentation/docs/document-callbacks ) .
You can’t perform that action at this time.
0 commit comments