Class: Webspicy::Web::HttpClient
- Inherits:
-
Client
- Object
- Tester::Client
- Client
- Webspicy::Web::HttpClient
- Defined in:
- lib/webspicy/web/client/http_client.rb
Defined Under Namespace
Classes: Api
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Attributes inherited from Tester::Client
Instance Method Summary collapse
- #_call(test_case) ⇒ Object
-
#initialize(scope) ⇒ HttpClient
constructor
class ::HTTP::Request.
Methods inherited from Client
Constructor Details
#initialize(scope) ⇒ HttpClient
class ::HTTP::Request
16 17 18 19 |
# File 'lib/webspicy/web/client/http_client.rb', line 16 def initialize(scope) super(scope) @api = Api.new(scope) end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
20 21 22 |
# File 'lib/webspicy/web/client/http_client.rb', line 20 def api @api end |
Instance Method Details
#_call(test_case) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/webspicy/web/client/http_client.rb', line 22 def _call(test_case) service, specification = test_case.service, test_case.specification # Instantiate the parameters headers = test_case.headers params = test_case.dress_params? ? service.dress_params(test_case.params) : test_case.params body = test_case.body || test_case.located_file_upload # Instantiate the url and strip parameters url, params = specification.instantiate_url(params) # Globalize the URL if required url = scope.to_real_url(url, test_case) # Invoke the service now api.public_send(service.method.to_s.downcase.to_sym, url, params, headers, body) # Return the response api.last_response end |