Class: Gitlab::BeyondIdentity::Client
- Inherits:
-
Object
- Object
- Gitlab::BeyondIdentity::Client
- Defined in:
- lib/gitlab/beyond_identity/client.rb
Defined Under Namespace
Classes: ApiError
Constant Summary collapse
- API_URL =
"https://api.byndid.com/key-mgmt/v0/gpg/key/authorization/git-commit-signing"
- Error =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#integration ⇒ Object
readonly
Returns the value of attribute integration.
Instance Method Summary collapse
- #execute(params) ⇒ Object
-
#initialize(integration) ⇒ Client
constructor
A new instance of Client.
Constructor Details
Instance Attribute Details
#integration ⇒ Object (readonly)
Returns the value of attribute integration.
29 30 31 |
# File 'lib/gitlab/beyond_identity/client.rb', line 29 def integration @integration end |
Instance Method Details
#execute(params) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gitlab/beyond_identity/client.rb', line 37 def execute(params) = { headers: headers, query: params } response = Gitlab::HTTP.get(API_URL, ) body = Gitlab::Json.parse(response.body) || {} raise ApiError.new(body.dig('error', 'message'), response.code) unless response.success? raise ApiError.new(body['message'], response.code) unless body['authorized'] body rescue JSON::ParserError raise ApiError.new('invalid response format', response.code) end |