Module: XClarityClient::Services::ResponseBuilderMixin
- Includes:
- ListNameInterpreterMixin
- Included in:
- XClarityService
- Defined in:
- lib/xclarity_client/services/mixins/response_builder_mixin.rb
Overview
A response builder knows how to treat a response from LXCA and create a ruby response
Instance Method Summary collapse
-
#build_response_with_resource_list(response, endpoint_class) ⇒ Array
Builds an array from an LXCA response that contains a list of resources.
Methods included from ListNameInterpreterMixin
Instance Method Details
#build_response_with_resource_list(response, endpoint_class) ⇒ Array
Builds an array from an LXCA response that contains a list of resources.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/xclarity_client/services/mixins/response_builder_mixin.rb', line 21 def build_response_with_resource_list(response, endpoint_class) return [] unless response.success? body = JSON.parse(response.body) if endpoint_class == XClarityClient::User body = body['response'] end list_name, body = add_listname_on_body(endpoint_class, body) body[list_name].map do |resource_params| endpoint_class.new resource_params end end |