Class: DirectusSDK::UtilsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/directus_sdk/api/utils_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ UtilsApi

Returns a new instance of UtilsApi.



19
20
21
# File 'lib/directus_sdk/api/utils_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/directus_sdk/api/utils_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_hash(opts = {}) ⇒ nil

Get a hashed value

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :string (String)

    The string to be hashed

  • :hasher (String)

    The hasher used to hash the given string (default to core)

  • :options (String)

    The hasher options

Returns:

  • (nil)


30
31
32
33
# File 'lib/directus_sdk/api/utils_api.rb', line 30

def get_hash(opts = {})
  get_hash_with_http_info(opts)
  return nil
end

#get_hash_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Get a hashed value

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :string (String)

    The string to be hashed

  • :hasher (String)

    The hasher used to hash the given string

  • :options (String)

    The hasher options

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



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/directus_sdk/api/utils_api.rb', line 42

def get_hash_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UtilsApi.get_hash ..."
  end
  if @api_client.config.client_side_validation && opts[:'hasher'] && !['core', 'bcrypt', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'].include?(opts[:'hasher'])
    fail ArgumentError, 'invalid value for "hasher", must be one of core, bcrypt, sha1, sha224, sha256, sha384, sha512'
  end
  # resource path
  local_var_path = "/hash"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["string"] = opts[:'string'] if !opts[:'string'].nil?
  form_params["hasher"] = opts[:'hasher'] if !opts[:'hasher'].nil?
  form_params["options"] = opts[:'options'] if !opts[:'options'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UtilsApi#get_hash\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_random(opts = {}) ⇒ nil

Returns random alphanumeric string

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :length (String)

    Integer(String) for length of random string

Returns:

  • (nil)


88
89
90
91
# File 'lib/directus_sdk/api/utils_api.rb', line 88

def get_random(opts = {})
  get_random_with_http_info(opts)
  return nil
end

#get_random_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Returns random alphanumeric string

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :length (String)

    Integer(String) for length of random string

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



98
99
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
# File 'lib/directus_sdk/api/utils_api.rb', line 98

def get_random_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: UtilsApi.get_random ..."
  end
  # resource path
  local_var_path = "/random"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}
  form_params["length"] = opts[:'length'] if !opts[:'length'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: UtilsApi#get_random\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end