Class: ApiTransformer::BackendRequest
- Inherits:
-
Object
- Object
- ApiTransformer::BackendRequest
- Defined in:
- lib/api_transformer/backend_request.rb
Overview
Process request blocks
Instance Attribute Summary collapse
-
#cookie_params ⇒ Object
Returns the value of attribute cookie_params.
-
#form_params ⇒ Object
Returns the value of attribute form_params.
-
#header_params ⇒ Object
Returns the value of attribute header_params.
-
#json_params ⇒ Object
Returns the value of attribute json_params.
-
#method ⇒ Object
Returns the value of attribute method.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#query_params ⇒ Object
Returns the value of attribute query_params.
Instance Method Summary collapse
-
#initialize(name, base_url, frontend_headers) ⇒ BackendRequest
constructor
A new instance of BackendRequest.
- #send ⇒ Object
Constructor Details
#initialize(name, base_url, frontend_headers) ⇒ BackendRequest
Returns a new instance of BackendRequest.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/api_transformer/backend_request.rb', line 10 def initialize(name, base_url, frontend_headers) @name = name @base_url = base_url @frontend_headers = frontend_headers @query_params = {} @form_params = {} @json_params = {} = {} @header_params = {} end |
Instance Attribute Details
#cookie_params ⇒ Object
Returns the value of attribute cookie_params.
7 8 9 |
# File 'lib/api_transformer/backend_request.rb', line 7 def end |
#form_params ⇒ Object
Returns the value of attribute form_params.
7 8 9 |
# File 'lib/api_transformer/backend_request.rb', line 7 def form_params @form_params end |
#header_params ⇒ Object
Returns the value of attribute header_params.
7 8 9 |
# File 'lib/api_transformer/backend_request.rb', line 7 def header_params @header_params end |
#json_params ⇒ Object
Returns the value of attribute json_params.
7 8 9 |
# File 'lib/api_transformer/backend_request.rb', line 7 def json_params @json_params end |
#method ⇒ Object
Returns the value of attribute method.
7 8 9 |
# File 'lib/api_transformer/backend_request.rb', line 7 def method @method end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/api_transformer/backend_request.rb', line 6 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/api_transformer/backend_request.rb', line 7 def path @path end |
#query_params ⇒ Object
Returns the value of attribute query_params.
7 8 9 |
# File 'lib/api_transformer/backend_request.rb', line 7 def query_params @query_params end |
Instance Method Details
#send ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/api_transformer/backend_request.rb', line 22 def send url = @base_url + @path EM::HttpRequest.new(url).send( "a#{@method}", query: @query_params, body: body, head: headers ) end |