Module: ApiKeys

Included in:
Config
Defined in:
lib/user/config/api_keys.rb

Instance Method Summary collapse

Instance Method Details

#create_api_key(data) ⇒ Object

Create api key.

Create an api key with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  description: 'New Api Key Description'
}
@data = @mints_user.create_api_key(data)


52
53
54
# File 'lib/user/config/api_keys.rb', line 52

def create_api_key(data)
  @client.raw('post', '/config/api-keys', nil, data_transform(data))
end

#delete_api_key(id) ⇒ Object

Delete api key.

Delete an api key.

Parameters

id

(Integer) – Api key id.

Example

@data = @mints_user.delete_api_key(2)


64
65
66
# File 'lib/user/config/api_keys.rb', line 64

def delete_api_key(id)
  @client.raw('delete', "/config/api-keys/#{id}")
end

#get_api_key(id, options = nil) ⇒ Object

Get api key.

Get an api key info.

Parameters

id

(Integer) – Api key id.

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_api_key(2)

Second Example

options = { fields: 'id' }
@data = @mints_user.get_api_key(2, options)


37
38
39
# File 'lib/user/config/api_keys.rb', line 37

def get_api_key(id, options = nil)
  @client.raw('get', "/config/api-keys/#{id}", options)
end

#get_api_keys(options = nil) ⇒ Object

Get api keys.

Get a collection of api keys.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_api_keys

Second Example

options = { fields: 'id' }
@data = @mints_user.get_api_keys(options)


20
21
22
# File 'lib/user/config/api_keys.rb', line 20

def get_api_keys(options = nil)
  @client.raw('get', '/config/api-keys', options)
end