Module: SimpleQS::Request

Defined in:
lib/simple_qs/request.rb,
lib/simple_qs/request/get.rb,
lib/simple_qs/request/base.rb,
lib/simple_qs/request/post.rb

Defined Under Namespace

Classes: Base, Get, Post, UnknownHttpMethod

Constant Summary collapse

HTTP_METHODS =
{
  :get    => :Get,
  :post   => :Post
}

Class Method Summary collapse

Class Method Details

.build(request, params = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/simple_qs/request.rb', line 15

def build(request, params = {})
  if SimpleQS::Request::HTTP_METHODS.keys.include?(request)
    SimpleQS::Request.const_get(HTTP_METHODS[request]).new(params)
  else
    raise SimpleQS::Request::UnknownHttpMethod, "Method #{request} is unknown or unsupported"
  end
end