Class: Boechat::Core::Service::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/boechat/core/service/request.rb

Overview

Class responsible for make the request to one service

Constant Summary collapse

HTTP_UNPROCESSABLE_ENTITY =
422
BASIC_HEADER =
{ 'User-Agent' => 'Boechat - API Version Verifier' }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_uri, verb: :get, parameters: nil, body: nil, headers: nil) ⇒ Request

Returns a new instance of Request.



20
21
22
23
24
25
26
27
28
# File 'lib/boechat/core/service/request.rb', line 20

def initialize(service_uri, verb: :get, parameters: nil, body: nil, headers: nil)
  @service_uri = service_uri
  @verb = verb
  @parameters = parameters
  @body = body
  @headers = headers
  @request = Typhoeus::Request.new(@service_uri, method: @verb, params: @parameters,
                                                 body: @body, headers: http_header)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



16
17
18
# File 'lib/boechat/core/service/request.rb', line 16

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



16
17
18
# File 'lib/boechat/core/service/request.rb', line 16

def headers
  @headers
end

#parametersObject (readonly)

Returns the value of attribute parameters.



16
17
18
# File 'lib/boechat/core/service/request.rb', line 16

def parameters
  @parameters
end

#requestObject (readonly)

Returns the value of attribute request.



16
17
18
# File 'lib/boechat/core/service/request.rb', line 16

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



16
17
18
# File 'lib/boechat/core/service/request.rb', line 16

def response
  @response
end

#resultObject (readonly)

Returns the value of attribute result.



16
17
18
# File 'lib/boechat/core/service/request.rb', line 16

def result
  @result
end

#service_uriObject (readonly)

Returns the value of attribute service_uri.



16
17
18
# File 'lib/boechat/core/service/request.rb', line 16

def service_uri
  @service_uri
end

#verbObject (readonly)

Returns the value of attribute verb.



16
17
18
# File 'lib/boechat/core/service/request.rb', line 16

def verb
  @verb
end

Instance Method Details

#callObject



30
31
32
# File 'lib/boechat/core/service/request.rb', line 30

def call
  handle_request
end