Class: Metronome::AccessManagementApi

Inherits:
Object
  • Object
show all
Defined in:
lib/metronome/api/access_management_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AccessManagementApi

Returns a new instance of AccessManagementApi.



19
20
21
# File 'lib/metronome/api/access_management_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/metronome/api/access_management_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_api_key(api_key, opts = {}) ⇒ ApiKeyData

Read a specific API key

Parameters:

  • api_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



26
27
28
29
# File 'lib/metronome/api/access_management_api.rb', line 26

def get_api_key(api_key, opts = {})
  data, _status_code, _headers = get_api_key_with_http_info(api_key, opts)
  data
end

#get_api_key_with_http_info(api_key, opts = {}) ⇒ Array<(ApiKeyData, Integer, Hash)>

Read a specific API key

Parameters:

  • api_key (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ApiKeyData, Integer, Hash)>)

    ApiKeyData data, response status code and response headers



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/metronome/api/access_management_api.rb', line 35

def get_api_key_with_http_info(api_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessManagementApi.get_api_key ...'
  end
  # verify the required parameter 'api_key' is set
  if @api_client.config.client_side_validation && api_key.nil?
    fail ArgumentError, "Missing the required parameter 'api_key' when calling AccessManagementApi.get_api_key"
  end
  # resource path
  local_var_path = '/v1/metronome/api-keys/{api-key}'.sub('{' + 'api-key' + '}', CGI.escape(api_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ApiKeyData'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AccessManagementApi.get_api_key",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccessManagementApi#get_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_many_api_keys(opts = {}) ⇒ GetManyApiKeys200Response

Read many API keys alphanumerically sorted

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :offset (Integer)

    The number of keys to drop from the start

  • :limit (Integer)

    The number of keys to include

  • :include_data (Boolean)

    Whether to include permissions, status, description etc.

Returns:



89
90
91
92
# File 'lib/metronome/api/access_management_api.rb', line 89

def get_many_api_keys(opts = {})
  data, _status_code, _headers = get_many_api_keys_with_http_info(opts)
  data
end

#get_many_api_keys_with_http_info(opts = {}) ⇒ Array<(GetManyApiKeys200Response, Integer, Hash)>

Read many API keys alphanumerically sorted

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :offset (Integer)

    The number of keys to drop from the start

  • :limit (Integer)

    The number of keys to include

  • :include_data (Boolean)

    Whether to include permissions, status, description etc.

Returns:

  • (Array<(GetManyApiKeys200Response, Integer, Hash)>)

    GetManyApiKeys200Response data, response status code and response headers



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/metronome/api/access_management_api.rb', line 100

def get_many_api_keys_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessManagementApi.get_many_api_keys ...'
  end
  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 1
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling AccessManagementApi.get_many_api_keys, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AccessManagementApi.get_many_api_keys, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/metronome/api-keys'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'include-data'] = opts[:'include_data'] if !opts[:'include_data'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetManyApiKeys200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AccessManagementApi.get_many_api_keys",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccessManagementApi#get_many_api_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_api_key(api_key, opts = {}) ⇒ CreateOrModifyApiKeyResponse

Create or modify an API key

Parameters:

  • api_key (String)

    The API key to be modified or &#39;create&#39; for a new key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



160
161
162
163
# File 'lib/metronome/api/access_management_api.rb', line 160

def put_api_key(api_key, opts = {})
  data, _status_code, _headers = put_api_key_with_http_info(api_key, opts)
  data
end

#put_api_key_with_http_info(api_key, opts = {}) ⇒ Array<(CreateOrModifyApiKeyResponse, Integer, Hash)>

Create or modify an API key

Parameters:

  • api_key (String)

    The API key to be modified or &#39;create&#39; for a new key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/metronome/api/access_management_api.rb', line 170

def put_api_key_with_http_info(api_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessManagementApi.put_api_key ...'
  end
  # verify the required parameter 'api_key' is set
  if @api_client.config.client_side_validation && api_key.nil?
    fail ArgumentError, "Missing the required parameter 'api_key' when calling AccessManagementApi.put_api_key"
  end
  # resource path
  local_var_path = '/v1/metronome/api-keys/{api-key}'.sub('{' + 'api-key' + '}', CGI.escape(api_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'put_api_key_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'CreateOrModifyApiKeyResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"AccessManagementApi.put_api_key",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccessManagementApi#put_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#sign_up(opts = {}) ⇒ SignupResponse

Open end point for signing up new customers

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



227
228
229
230
# File 'lib/metronome/api/access_management_api.rb', line 227

def (opts = {})
  data, _status_code, _headers = (opts)
  data
end

#sign_up_with_http_info(opts = {}) ⇒ Array<(SignupResponse, Integer, Hash)>

Open end point for signing up new customers

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(SignupResponse, Integer, Hash)>)

    SignupResponse data, response status code and response headers



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/metronome/api/access_management_api.rb', line 236

def (opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AccessManagementApi.sign_up ...'
  end
  # resource path
  local_var_path = '/v1/metronome/sign-up'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'signup_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'SignupResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"AccessManagementApi.sign_up",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AccessManagementApi#sign_up\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end