Class: Gapic::Presenters::Method::ComputePaginationInfo
- Inherits:
-
Object
- Object
- Gapic::Presenters::Method::ComputePaginationInfo
- Includes:
- Helpers::NamespaceHelper
- Defined in:
- lib/gapic/presenters/method/compute_pagination_info.rb
Overview
Pagination info determined from the proto method
Instance Method Summary collapse
-
#initialize(proto_method, api) ⇒ ComputePaginationInfo
constructor
A new instance of ComputePaginationInfo.
-
#paged? ⇒ Boolean
Whether the method should be generated as paged.
-
#paged_element_doc_type ⇒ String?
Proto type of the repeated field in the response message.
-
#repeated_field_is_a_map? ⇒ Boolean?
Whether the repeated field in the response message is a map.
-
#request_page_size_name ⇒ String?
Name of the request's field used for page size For Regapic can be either
page_sizeormax_results. -
#response_repeated_field_name ⇒ String?
Name of the repeated field in the response message For REST gapics can be either a vanilla repeated field or a map.
Methods included from Helpers::NamespaceHelper
#ensure_absolute_namespace, #fix_namespace, #ruby_namespace, #ruby_namespace_for_address
Constructor Details
#initialize(proto_method, api) ⇒ ComputePaginationInfo
Returns a new instance of ComputePaginationInfo.
29 30 31 32 33 34 |
# File 'lib/gapic/presenters/method/compute_pagination_info.rb', line 29 def initialize proto_method, api @api = api @request = proto_method.input @response = proto_method.output @server_streaming = proto_method.server_streaming end |
Instance Method Details
#paged? ⇒ Boolean
Whether the method should be generated as paged
40 41 42 |
# File 'lib/gapic/presenters/method/compute_pagination_info.rb', line 40 def paged? !server_streaming? && paged_request? && paged_response? end |
#paged_element_doc_type ⇒ String?
Proto type of the repeated field in the response message
74 75 76 77 |
# File 'lib/gapic/presenters/method/compute_pagination_info.rb', line 74 def paged_element_doc_type return nil if response_results_field.nil? field_paginated_elem_doc_type response_results_field end |
#repeated_field_is_a_map? ⇒ Boolean?
Whether the repeated field in the response message is a map
66 67 68 |
# File 'lib/gapic/presenters/method/compute_pagination_info.rb', line 66 def repeated_field_is_a_map? response_results_field&.map? end |
#request_page_size_name ⇒ String?
Name of the request's field used for page size
For Regapic can be either page_size or max_results
49 50 51 |
# File 'lib/gapic/presenters/method/compute_pagination_info.rb', line 49 def request_page_size_name request_page_size_field&.name end |
#response_repeated_field_name ⇒ String?
Name of the repeated field in the response message For REST gapics can be either a vanilla repeated field or a map
58 59 60 |
# File 'lib/gapic/presenters/method/compute_pagination_info.rb', line 58 def response_repeated_field_name response_results_field&.name end |