summaryrefslogtreecommitdiff
path: root/lib/bulk_imports/common/rest/get_badges_query.rb
blob: 60b2ebcc552d7d8b31321e54fb74ef6899b1a072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module BulkImports
  module Common
    module Rest
      module GetBadgesQuery
        extend self

        def to_h(context)
          resource = context.entity.pluralized_name
          encoded_full_path = ERB::Util.url_encode(context.entity.source_full_path)

          {
            resource: [resource, encoded_full_path, 'badges'].join('/'),
            query: {
              page: context.tracker.next_page
            }
          }
        end
      end
    end
  end
end