class VeloPayments::LoginApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/velopayments/api/login_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

logout(opts = {}) click to toggle source

Logout <p>Given a valid access token in the header then log out the authenticated user or client </p> <p>Will revoke the token</p> @param [Hash] opts the optional parameters @return [nil]

# File lib/velopayments/api/login_api.rb, line 26
def logout(opts = {})
  logout_with_http_info(opts)
  nil
end
logout_with_http_info(opts = {}) click to toggle source

Logout &lt;p&gt;Given a valid access token in the header then log out the authenticated user or client &lt;/p&gt; &lt;p&gt;Will revoke the token&lt;/p&gt; @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/velopayments/api/login_api.rb, line 35
def logout_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LoginApi.logout ...'
  end
  # resource path
  local_var_path = '/v1/logout'

  # 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[:body] 

  # return_type
  return_type = opts[:return_type] 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LoginApi#logout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
reset_password(reset_password_request, opts = {}) click to toggle source

Reset password <p>Reset password </p> <p>An email with an embedded link will be sent to the receipient of the email address </p> <p>The link will contain a token to be used for resetting the password </p> @param reset_password_request [ResetPasswordRequest] An Email address to send the reset password link to @param [Hash] opts the optional parameters @return [nil]

# File lib/velopayments/api/login_api.rb, line 83
def reset_password(reset_password_request, opts = {})
  reset_password_with_http_info(reset_password_request, opts)
  nil
end
reset_password_with_http_info(reset_password_request, opts = {}) click to toggle source

Reset password &lt;p&gt;Reset password &lt;/p&gt; &lt;p&gt;An email with an embedded link will be sent to the receipient of the email address &lt;/p&gt; &lt;p&gt;The link will contain a token to be used for resetting the password &lt;/p&gt; @param reset_password_request [ResetPasswordRequest] An Email address to send the reset password link to @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/velopayments/api/login_api.rb, line 93
def reset_password_with_http_info(reset_password_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LoginApi.reset_password ...'
  end
  # verify the required parameter 'reset_password_request' is set
  if @api_client.config.client_side_validation && reset_password_request.nil?
    fail ArgumentError, "Missing the required parameter 'reset_password_request' when calling LoginApi.reset_password"
  end
  # resource path
  local_var_path = '/v1/password/reset'

  # 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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

  # return_type
  return_type = opts[:return_type] 

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

  new_options = opts.merge(
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LoginApi#reset_password\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
validate_access_token(access_token_validation_request, opts = {}) click to toggle source

validate <p>The second part of login involves validating using an MFA device</p> <p>An access token with PRE_AUTH authorities is required</p> @param access_token_validation_request [AccessTokenValidationRequest] An OTP from the user&#39;s registered MFA Device @param [Hash] opts the optional parameters @return [AccessTokenResponse]

# File lib/velopayments/api/login_api.rb, line 147
def validate_access_token(access_token_validation_request, opts = {})
  data, _status_code, _headers = validate_access_token_with_http_info(access_token_validation_request, opts)
  data
end
validate_access_token_with_http_info(access_token_validation_request, opts = {}) click to toggle source

validate &lt;p&gt;The second part of login involves validating using an MFA device&lt;/p&gt; &lt;p&gt;An access token with PRE_AUTH authorities is required&lt;/p&gt; @param access_token_validation_request [AccessTokenValidationRequest] An OTP from the user&#39;s registered MFA Device @param [Hash] opts the optional parameters @return [Array<(AccessTokenResponse, Integer, Hash)>] AccessTokenResponse data, response status code and response headers

# File lib/velopayments/api/login_api.rb, line 157
def validate_access_token_with_http_info(access_token_validation_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LoginApi.validate_access_token ...'
  end
  # verify the required parameter 'access_token_validation_request' is set
  if @api_client.config.client_side_validation && access_token_validation_request.nil?
    fail ArgumentError, "Missing the required parameter 'access_token_validation_request' when calling LoginApi.validate_access_token"
  end
  # resource path
  local_var_path = '/v1/validate'

  # 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'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

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

  # return_type
  return_type = opts[:return_type] || 'AccessTokenResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LoginApi#validate_access_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
velo_auth(opts = {}) click to toggle source

Authentication endpoint Use this endpoint to obtain an access token for calling Velo Payments APIs. Use HTTP Basic Auth. String value of Basic and a Base64 endcoded string comprising the API key (e.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8) and API secret (e.g. c396b26b-137a-44fd-87f5-34631f8fd529) with a colon between them. E.g. Basic 44a9537d-d55d-4b47-8082-14061c2bcdd8:c396b26b-137a-44fd-87f5-34631f8fd529 @param [Hash] opts the optional parameters @option opts [String] :grant_type OAuth grant type. Should use &#39;client_credentials&#39; (default to 'client_credentials') @return [AuthResponse]

# File lib/velopayments/api/login_api.rb, line 211
def velo_auth(opts = {})
  data, _status_code, _headers = velo_auth_with_http_info(opts)
  data
end
velo_auth_with_http_info(opts = {}) click to toggle source

Authentication endpoint Use this endpoint to obtain an access token for calling Velo Payments APIs. Use HTTP Basic Auth. String value of Basic and a Base64 endcoded string comprising the API key (e.g. 44a9537d-d55d-4b47-8082-14061c2bcdd8) and API secret (e.g. c396b26b-137a-44fd-87f5-34631f8fd529) with a colon between them. E.g. Basic 44a9537d-d55d-4b47-8082-14061c2bcdd8:c396b26b-137a-44fd-87f5-34631f8fd529 @param [Hash] opts the optional parameters @option opts [String] :grant_type OAuth grant type. Should use &#39;client_credentials&#39; @return [Array<(AuthResponse, Integer, Hash)>] AuthResponse data, response status code and response headers

# File lib/velopayments/api/login_api.rb, line 221
def velo_auth_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LoginApi.velo_auth ...'
  end
  # resource path
  local_var_path = '/v1/authenticate'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'grant_type'] = opts[:'grant_type'] if !opts[:'grant_type'].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[:body] 

  # return_type
  return_type = opts[:return_type] || 'AuthResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['basicAuth']

  new_options = opts.merge(
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LoginApi#velo_auth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end