Class: Gapic::Presenters::SnippetPresenter::PaginatedResponseHandlingPresenter
- Inherits:
-
Object
- Object
- Gapic::Presenters::SnippetPresenter::PaginatedResponseHandlingPresenter
- Includes:
- ResponseHandlingPresenterCommon
- Defined in:
- lib/gapic/presenters/snippet/response_handling_presenters.rb
Overview
Presentation information about paginated response handling
Instance Attribute Summary collapse
-
#render ⇒ String
readonly
The rendered code as a single string, possibly with line breaks.
-
#render_lines ⇒ Array<String>
readonly
The lines of rendered code.
-
#response_name ⇒ String?
readonly
The name of the response variable, or nil for no response handling.
Instance Method Summary collapse
-
#initialize(proto, json, paged_response_type:, phase1:) ⇒ PaginatedResponseHandlingPresenter
constructor
Create a paginated response handling presenter.
Constructor Details
#initialize(proto, json, paged_response_type:, phase1:) ⇒ PaginatedResponseHandlingPresenter
Create a paginated response handling presenter
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/gapic/presenters/snippet/response_handling_presenters.rb', line 247 def initialize proto, json, paged_response_type:, phase1: @response_name = compute_response_name proto, phase1 @render_lines = [] if @response_name if phase1 @render_lines << "# The returned object is of type Gapic::PagedEnumerable. You can iterate" @render_lines << "# over elements, and API calls will be issued to fetch pages as needed." end @render_lines += if proto&.by_page by_page_lines proto, json, @response_name, paged_response_type, phase1 elsif proto&.next_page_token next_page_token_lines proto, json else by_item_lines proto, json, @response_name, paged_response_type, phase1 end end @render = @render_lines.join "\n" end |
Instance Attribute Details
#render ⇒ String (readonly)
The rendered code as a single string, possibly with line breaks
277 278 279 |
# File 'lib/gapic/presenters/snippet/response_handling_presenters.rb', line 277 def render @render end |
#render_lines ⇒ Array<String> (readonly)
The lines of rendered code
271 272 273 |
# File 'lib/gapic/presenters/snippet/response_handling_presenters.rb', line 271 def render_lines @render_lines end |
#response_name ⇒ String? (readonly)
The name of the response variable, or nil for no response handling
283 284 285 |
# File 'lib/gapic/presenters/snippet/response_handling_presenters.rb', line 283 def response_name @response_name end |