Class: Gitlab::PhabricatorImport::Conduit::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/phabricator_import/conduit/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(phabricator_url, api_token) ⇒ Client

Returns a new instance of Client.


6
7
8
9
# File 'lib/gitlab/phabricator_import/conduit/client.rb', line 6

def initialize(phabricator_url, api_token)
  @phabricator_url = phabricator_url
  @api_token = api_token
end

Instance Method Details

#get(path, params: {}) ⇒ Object


11
12
13
14
15
16
17
# File 'lib/gitlab/phabricator_import/conduit/client.rb', line 11

def get(path, params: {})
  response = Gitlab::HTTP.get(build_url(path), body: build_params(params), headers: headers)
  Response.parse!(response)
rescue *Gitlab::HTTP::HTTP_ERRORS => e
  # Wrap all errors from the API into an API-error.
  raise ApiError.new(e)
end