Class: Apipony::Request
Overview
Model a request that an API user can make. Includes information about required parameters and required headers
Instance Attribute Summary collapse
-
#headers ⇒ Object
:nodoc:.
-
#params ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Request
constructor
A new instance of Request.
-
#param(name, example: '', type: :string, required: false, description: '') ⇒ Object
Construct a new parameter.
Constructor Details
#initialize(&block) ⇒ Request
Returns a new instance of Request.
12 13 14 15 16 |
# File 'lib/apipony/request.rb', line 12 def initialize(&block) @params = [] instance_eval(&block) end |
Instance Attribute Details
#headers ⇒ Object
:nodoc:
10 11 12 |
# File 'lib/apipony/request.rb', line 10 def headers @headers end |
#params ⇒ Object
:nodoc:
7 8 9 |
# File 'lib/apipony/request.rb', line 7 def params @params end |
Instance Method Details
#param(name, example: '', type: :string, required: false, description: '') ⇒ Object
Construct a new parameter
19 20 21 22 23 24 25 |
# File 'lib/apipony/request.rb', line 19 def param(name, example: '', type: :string, required: false, description: '') @params << Apipony::Parameter.new(name, example, type, required, description) end |