Sha256: 6e16f472eb39cde1b7ff5ca5ebdbc2c9f9cec57a4f49e206cebec6b53830b82f

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

require 'rakuten_web_service/search_result'

module RakutenWebService
  module Travel
    class SearchResult < RakutenWebService::SearchResult
      def params_to_get_next_page
        @params.merge('page' => (paging_info['page'] + 1))
      end

      using RakutenWebService::StringSupport

      %w[page pageCount recordCount].each do |name|
        method_name = name.to_snake
        define_method method_name do
          paging_info[name]
        end
      end

      def next_page?
        (page < page_count)
      end

      def next_page
        search(params_to_get_next_page)
      end

      private

      def paging_info
        response['pagingInfo']
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rakuten_web_service-1.13.2 lib/rakuten_web_service/travel/search_result.rb
rakuten_web_service-1.13.1 lib/rakuten_web_service/travel/search_result.rb
rakuten_web_service-1.13.0 lib/rakuten_web_service/travel/search_result.rb