Sha256: 93a32651a5bf3101b3298b9fc880fa7da3663bf3a4a0dc681f58094a5cde5af6

Contents?: true

Size: 640 Bytes

Versions: 4

Compression:

Stored size: 640 Bytes

Contents

module ApiPack
  module ApiHelper
    def pagination_meta_generator(request, total_pages)
      ApiPack::PaginationMetaGenerator.new(request: request, total_pages: total_pages).call
    end

    def current_page
      return params[:page].to_i if defined?(params[:page]) && !params[:page].nil?

      ApiPack::DEFAULT_PAGE
    end

    def per_page
      return params[:per_page].to_i if defined?(params[:per_page]) && !params[:per_page].nil?

      ApiPack::DEFAULT_PER_PAGE
    end

    def serializer_hash(resource, class_name, opt: {})
      ApiPack::Serializer::Parser.serializer_hash(resource, class_name, opt: opt)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
api_pack-1.1.4 lib/api_pack/api_helper.rb
api_pack-1.1.3 lib/api_pack/api_helper.rb
api_pack-1.1.2 lib/api_pack/api_helper.rb
api_pack-1.1.1 lib/api_pack/api_helper.rb