Class: DeepL::Requests::Admin::ListDeveloperKeys

Inherits:
Base
  • Object
show all
Defined in:
lib/deepl/requests/admin/list_developer_keys.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_s

Constructor Details

This class inherits a constructor from DeepL::Requests::Admin::Base

Instance Method Details

#request ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/deepl/requests/admin/list_developer_keys.rb', line 10

def request
  request, response = execute_request_with_retries(get_request)
  keys = JSON.parse(response.body)
  raise DeepL::Exceptions::Error, 'Developer key list response is not a JSON array' unless
    keys.is_a?(Array)

  keys.select { |key| usable_developer_key?(key) }
      .map { |key| Resources::DeveloperKey.new(key, request, response) }
end