Sha256: b7fb937905599ee7c229d725885724ca4bbab0718fba9bc34c6a91212c3fbedc

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

require 'httparty'

module Gitlab
  module Triage
    module NetworkAdapters
      class HttpartyAdapter
        def get(token, url)
          response = HTTParty.get(
            url,
            headers: {
              'Content-type' => 'application/json',
              'PRIVATE-TOKEN' => token
            }
          )

          {
            more_pages: (response.headers["x-next-page"] != ""),
            next_page_url: url + "&page=#{response.headers['x-next-page']}",
            results: response.parsed_response
          }
        end

        def post(token, url, body)
          HTTParty.post(
            url,
            body: { body: body }.to_json,
            headers: {
              'Content-type' => 'application/json',
              'PRIVATE-TOKEN' => token
            }
          )
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gitlab-triage-0.1.0 lib/gitlab/triage/network_adapters/httparty_adapter.rb
gitlab-triage-0.0.3 lib/gitlab/triage/network_adapters/httparty_adapter.rb
gitlab-triage-0.0.2 lib/gitlab/triage/network_adapters/httparty_adapter.rb
gitlab-triage-0.0.1 lib/gitlab/triage/network_adapters/httparty_adapter.rb