Class: Apipony::Request

Inherits:
Base
  • Object
show all
Defined in:
lib/apipony/request.rb

Overview

Model a request that an API user can make. Includes information about required parameters and required headers

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#headersObject

:nodoc:



10
11
12
# File 'lib/apipony/request.rb', line 10

def headers
  @headers
end

#paramsObject

: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