Class: TableauServerClient::PaginatableResponse
- Inherits:
-
Object
- Object
- TableauServerClient::PaginatableResponse
- Includes:
- Enumerable
- Defined in:
- lib/tableau_server_client/paginatable_response.rb
Defined Under Namespace
Classes: Pagination
Instance Method Summary collapse
- #each {|@response| ... } ⇒ Object
- #each_body ⇒ Object
-
#initialize(client, request_url, response) ⇒ PaginatableResponse
constructor
A new instance of PaginatableResponse.
Constructor Details
#initialize(client, request_url, response) ⇒ PaginatableResponse
Returns a new instance of PaginatableResponse.
7 8 9 10 11 |
# File 'lib/tableau_server_client/paginatable_response.rb', line 7 def initialize(client, request_url, response) @client = client @request_url = request_url @response = response end |
Instance Method Details
#each {|@response| ... } ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tableau_server_client/paginatable_response.rb', line 13 def each yield @response return unless paginated? res = @response.dup url = @request_url.dup while true pgn = Pagination.parse(res.body) break unless pgn.next_page? res = @client.session.get url.merge_params!(pgn.next_request_params).to_s yield res end end |
#each_body ⇒ Object
26 27 28 29 30 |
# File 'lib/tableau_server_client/paginatable_response.rb', line 26 def each_body each do |res| yield Nokogiri::XML(res.body) end end |