class Bitpesa::PayoutMethodsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

delete_payout_method(payout_method_id, opts = {}) click to toggle source

Deleting a payout method Deletes a single payout method by the Payout Method ID @param payout_method_id ID of the payout method to delete. Example: `/v1/payout_methods/bf9ff782-e182-45ac-abea-5bce83ad6670` @param [Hash] opts the optional parameters @return [PayoutMethodResponse]

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 29
def delete_payout_method(payout_method_id, opts = {})
  data, _status_code, _headers = delete_payout_method_with_http_info(payout_method_id, opts)
  data
end
delete_payout_method_with_http_info(payout_method_id, opts = {}) click to toggle source

Deleting a payout method Deletes a single payout method by the Payout Method ID @param payout_method_id ID of the payout method to delete. Example: &#x60;/v1/payout_methods/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60; @param [Hash] opts the optional parameters @return [Array<(PayoutMethodResponse, Fixnum, Hash)>] PayoutMethodResponse data, response status code and response headers

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 39
def delete_payout_method_with_http_info(payout_method_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PayoutMethodsApi.delete_payout_method ...'
  end
  # verify the required parameter 'payout_method_id' is set
  if @api_client.config.client_side_validation && payout_method_id.nil?
    fail ArgumentError, "Missing the required parameter 'payout_method_id' when calling PayoutMethodsApi.delete_payout_method"
  end
  # resource path
  local_var_path = '/payout_methods/{Payout Method ID}'.sub('{' + 'Payout Method ID' + '}', payout_method_id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PayoutMethodResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PayoutMethodsApi#delete_payout_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_payout_method(payout_method_id, opts = {}) click to toggle source

Fetching a payout method Show a payout method by id @param payout_method_id ID of the payout method to get. Example: &#x60;/v1/payout_methods/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60; @param [Hash] opts the optional parameters @return [PayoutMethodResponse]

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 83
def get_payout_method(payout_method_id, opts = {})
  data, _status_code, _headers = get_payout_method_with_http_info(payout_method_id, opts)
  data
end
get_payout_method_with_http_info(payout_method_id, opts = {}) click to toggle source

Fetching a payout method Show a payout method by id @param payout_method_id ID of the payout method to get. Example: &#x60;/v1/payout_methods/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60; @param [Hash] opts the optional parameters @return [Array<(PayoutMethodResponse, Fixnum, Hash)>] PayoutMethodResponse data, response status code and response headers

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 93
def get_payout_method_with_http_info(payout_method_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PayoutMethodsApi.get_payout_method ...'
  end
  # verify the required parameter 'payout_method_id' is set
  if @api_client.config.client_side_validation && payout_method_id.nil?
    fail ArgumentError, "Missing the required parameter 'payout_method_id' when calling PayoutMethodsApi.get_payout_method"
  end
  # resource path
  local_var_path = '/payout_methods/{Payout Method ID}'.sub('{' + 'Payout Method ID' + '}', payout_method_id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PayoutMethodResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PayoutMethodsApi#get_payout_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_payout_methods(opts = {}) click to toggle source

Listing payout methods List available payout methods @param [Hash] opts the optional parameters @option opts [Array<String>] :state Allows filtering results by &#x60;state&#x60; of the payout method. Example: &#x60;/v1/payout_methods?state[]&#x3D;enabled&#x60; @option opts [Array<String>] :type Allows filtering results by the specified type. Example: &#x60;/v1/payout_methods?type[]&#x3D;NGN::Bank&#x60; @option opts [String] :sender_id Allows filtering results by the specified sender id. Example: &#x60;/v1/payout_methods?sender_id&#x3D;bf9ff782-e182-45ac-abea-5bce83ad6670&#x60; @option opts [Integer] :page The page number to request (defaults to 1) @option opts [Integer] :per The number of results to load per page (defaults to 10) @option opts [String] :created_at_from Start date to filter recipients by created_at range Allows filtering results by the specified &#x60;created_at&#x60; timeframe. Example: &#x60;/v1/recipients?created_at_from&#x3D;2018-06-06&amp;created_at_to&#x3D;2018-06-08&#x60; @option opts [String] :created_at_to End date to filter recipients by created_at range Allows filtering results by the specified &#x60;created_at&#x60; timeframe. Example: &#x60;/v1/recipients?created_at_from&#x3D;2018-06-06&amp;created_at_to&#x3D;2018-06-08&#x60; @return [PayoutMethodListResponse]

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 143
def get_payout_methods(opts = {})
  data, _status_code, _headers = get_payout_methods_with_http_info(opts)
  data
end
get_payout_methods_with_http_info(opts = {}) click to toggle source

Listing payout methods List available payout methods @param [Hash] opts the optional parameters @option opts [Array<String>] :state Allows filtering results by &#x60;state&#x60; of the payout method. Example: &#x60;/v1/payout_methods?state[]&#x3D;enabled&#x60; @option opts [Array<String>] :type Allows filtering results by the specified type. Example: &#x60;/v1/payout_methods?type[]&#x3D;NGN::Bank&#x60; @option opts [String] :sender_id Allows filtering results by the specified sender id. Example: &#x60;/v1/payout_methods?sender_id&#x3D;bf9ff782-e182-45ac-abea-5bce83ad6670&#x60; @option opts [Integer] :page The page number to request (defaults to 1) @option opts [Integer] :per The number of results to load per page (defaults to 10) @option opts [String] :created_at_from Start date to filter recipients by created_at range Allows filtering results by the specified &#x60;created_at&#x60; timeframe. Example: &#x60;/v1/recipients?created_at_from&#x3D;2018-06-06&amp;created_at_to&#x3D;2018-06-08&#x60; @option opts [String] :created_at_to End date to filter recipients by created_at range Allows filtering results by the specified &#x60;created_at&#x60; timeframe. Example: &#x60;/v1/recipients?created_at_from&#x3D;2018-06-06&amp;created_at_to&#x3D;2018-06-08&#x60; @return [Array<(PayoutMethodListResponse, Fixnum, Hash)>] PayoutMethodListResponse data, response status code and response headers

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 159
def get_payout_methods_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PayoutMethodsApi.get_payout_methods ...'
  end
  if @api_client.config.client_side_validation && opts[:'state'] && !opts[:'state'].all? { |item| ['enabled', 'disabled'].include?(item) }
    fail ArgumentError, 'invalid value for "state", must include one of enabled, disabled'
  end
  # resource path
  local_var_path = '/payout_methods'

  # query parameters
  query_params = {}
  query_params[:'state'] = @api_client.build_collection_param(opts[:'state'], :multi) if !opts[:'state'].nil?
  query_params[:'type'] = @api_client.build_collection_param(opts[:'type'], :multi) if !opts[:'type'].nil?
  query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?
  query_params[:'created_at_from'] = opts[:'created_at_from'] if !opts[:'created_at_from'].nil?
  query_params[:'created_at_to'] = opts[:'created_at_to'] if !opts[:'created_at_to'].nil?

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PayoutMethodListResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PayoutMethodsApi#get_payout_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_payout_method(payout_method_id, payout_method, opts = {}) click to toggle source

Updating a payout method Updates the payout method specified in the URL path. @param payout_method_id ID of the payout method to get. Example: &#x60;/v1/payout_methods/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60; @param payout_method @param [Hash] opts the optional parameters @return [PayoutMethodResponse]

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 210
def patch_payout_method(payout_method_id, payout_method, opts = {})
  data, _status_code, _headers = patch_payout_method_with_http_info(payout_method_id, payout_method, opts)
  data
end
patch_payout_method_with_http_info(payout_method_id, payout_method, opts = {}) click to toggle source

Updating a payout method Updates the payout method specified in the URL path. @param payout_method_id ID of the payout method to get. Example: &#x60;/v1/payout_methods/bf9ff782-e182-45ac-abea-5bce83ad6670&#x60; @param payout_method @param [Hash] opts the optional parameters @return [Array<(PayoutMethodResponse, Fixnum, Hash)>] PayoutMethodResponse data, response status code and response headers

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 221
def patch_payout_method_with_http_info(payout_method_id, payout_method, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PayoutMethodsApi.patch_payout_method ...'
  end
  # verify the required parameter 'payout_method_id' is set
  if @api_client.config.client_side_validation && payout_method_id.nil?
    fail ArgumentError, "Missing the required parameter 'payout_method_id' when calling PayoutMethodsApi.patch_payout_method"
  end
  # verify the required parameter 'payout_method' is set
  if @api_client.config.client_side_validation && payout_method.nil?
    fail ArgumentError, "Missing the required parameter 'payout_method' when calling PayoutMethodsApi.patch_payout_method"
  end
  # resource path
  local_var_path = '/payout_methods/{Payout Method ID}'.sub('{' + 'Payout Method ID' + '}', payout_method_id.to_s)

  # 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/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(payout_method)
  auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PayoutMethodResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PayoutMethodsApi#patch_payout_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
post_payout_methods(payout_method_request, opts = {}) click to toggle source

Creating a payout method Creates a new payout method in our system. @param payout_method_request @param [Hash] opts the optional parameters @return [PayoutMethodResponse]

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 271
def post_payout_methods(payout_method_request, opts = {})
  data, _status_code, _headers = post_payout_methods_with_http_info(payout_method_request, opts)
  data
end
post_payout_methods_with_http_info(payout_method_request, opts = {}) click to toggle source

Creating a payout method Creates a new payout method in our system. @param payout_method_request @param [Hash] opts the optional parameters @return [Array<(PayoutMethodResponse, Fixnum, Hash)>] PayoutMethodResponse data, response status code and response headers

# File lib/bitpesa-sdk/api/payout_methods_api.rb, line 281
def post_payout_methods_with_http_info(payout_method_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PayoutMethodsApi.post_payout_methods ...'
  end
  # verify the required parameter 'payout_method_request' is set
  if @api_client.config.client_side_validation && payout_method_request.nil?
    fail ArgumentError, "Missing the required parameter 'payout_method_request' when calling PayoutMethodsApi.post_payout_methods"
  end
  # resource path
  local_var_path = '/payout_methods'

  # 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/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(payout_method_request)
  auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
  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,
    :return_type => 'PayoutMethodResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PayoutMethodsApi#post_payout_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end