class PhoneComClient::PaymentMethodsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_account_payment_method(account_id, data, opts = {}) click to toggle source

Create an individual payment method. Create an individual payment method. See Account Payment Methods for more info on the properties. @param account_id Account ID @param data Payment data @param [Hash] opts the optional parameters @return [PaymentFull]

# File lib/phone_com_client/api/payment_methods_api.rb, line 28
def create_account_payment_method(account_id, data, opts = {})
  data, _status_code, _headers = create_account_payment_method_with_http_info(account_id, data, opts)
  data
end
create_account_payment_method_with_http_info(account_id, data, opts = {}) click to toggle source

Create an individual payment method. Create an individual payment method. See Account Payment Methods for more info on the properties. @param account_id Account ID @param data Payment data @param [Hash] opts the optional parameters @return [Array<(PaymentFull, Fixnum, Hash)>] PaymentFull data, response status code and response headers

# File lib/phone_com_client/api/payment_methods_api.rb, line 39
def create_account_payment_method_with_http_info(account_id, data, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.create_account_payment_method ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling PaymentMethodsApi.create_account_payment_method"
  end
  # verify the required parameter 'data' is set
  if @api_client.config.client_side_validation && data.nil?
    fail ArgumentError, "Missing the required parameter 'data' when calling PaymentMethodsApi.create_account_payment_method"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/payment-methods'.sub('{' + 'account_id' + '}', account_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(data)
  auth_names = ['apiKey']
  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 => 'PaymentFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentMethodsApi#create_account_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_account_payment_method(account_id, pm_id, opts = {}) click to toggle source

Delete an individual payment method. Delete an individual payment method. See Account Payment Methods for more info on the properties. @param account_id Account ID @param pm_id Payment Method ID @param [Hash] opts the optional parameters @return [DeleteEntry]

# File lib/phone_com_client/api/payment_methods_api.rb, line 88
def delete_account_payment_method(account_id, pm_id, opts = {})
  data, _status_code, _headers = delete_account_payment_method_with_http_info(account_id, pm_id, opts)
  data
end
delete_account_payment_method_with_http_info(account_id, pm_id, opts = {}) click to toggle source

Delete an individual payment method. Delete an individual payment method. See Account Payment Methods for more info on the properties. @param account_id Account ID @param pm_id Payment Method ID @param [Hash] opts the optional parameters @return [Array<(DeleteEntry, Fixnum, Hash)>] DeleteEntry data, response status code and response headers

# File lib/phone_com_client/api/payment_methods_api.rb, line 99
def delete_account_payment_method_with_http_info(account_id, pm_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.delete_account_payment_method ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling PaymentMethodsApi.delete_account_payment_method"
  end
  # verify the required parameter 'pm_id' is set
  if @api_client.config.client_side_validation && pm_id.nil?
    fail ArgumentError, "Missing the required parameter 'pm_id' when calling PaymentMethodsApi.delete_account_payment_method"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/payment-methods/{pm_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'pm_id' + '}', pm_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 = nil
  auth_names = ['apiKey']
  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 => 'DeleteEntry')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentMethodsApi#delete_account_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_account_payment_method(account_id, pm_id, opts = {}) click to toggle source

Show details of an individual payment method. Show details of an individual payment method. See Account Payment Methods for more info on the properties. @param account_id Account ID @param pm_id Payment Method ID @param [Hash] opts the optional parameters @return [PaymentFull]

# File lib/phone_com_client/api/payment_methods_api.rb, line 148
def get_account_payment_method(account_id, pm_id, opts = {})
  data, _status_code, _headers = get_account_payment_method_with_http_info(account_id, pm_id, opts)
  data
end
get_account_payment_method_with_http_info(account_id, pm_id, opts = {}) click to toggle source

Show details of an individual payment method. Show details of an individual payment method. See Account Payment Methods for more info on the properties. @param account_id Account ID @param pm_id Payment Method ID @param [Hash] opts the optional parameters @return [Array<(PaymentFull, Fixnum, Hash)>] PaymentFull data, response status code and response headers

# File lib/phone_com_client/api/payment_methods_api.rb, line 159
def get_account_payment_method_with_http_info(account_id, pm_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.get_account_payment_method ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling PaymentMethodsApi.get_account_payment_method"
  end
  # verify the required parameter 'pm_id' is set
  if @api_client.config.client_side_validation && pm_id.nil?
    fail ArgumentError, "Missing the required parameter 'pm_id' when calling PaymentMethodsApi.get_account_payment_method"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/payment-methods/{pm_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'pm_id' + '}', pm_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 = nil
  auth_names = ['apiKey']
  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 => 'PaymentFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentMethodsApi#get_account_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_account_payment_methods(account_id, opts = {}) click to toggle source

Get a list of payment methods for an account. Get a list of payment methods for an account. See Account Payment Methods for more info on the properties. @param account_id Account ID @param [Hash] opts the optional parameters @option opts [Array<String>] :filters_id ID filter @option opts [String] :sort_id ID sorting @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @return [ListPaymentMethods]

# File lib/phone_com_client/api/payment_methods_api.rb, line 212
def list_account_payment_methods(account_id, opts = {})
  data, _status_code, _headers = list_account_payment_methods_with_http_info(account_id, opts)
  data
end
list_account_payment_methods_with_http_info(account_id, opts = {}) click to toggle source

Get a list of payment methods for an account. Get a list of payment methods for an account. See Account Payment Methods for more info on the properties. @param account_id Account ID @param [Hash] opts the optional parameters @option opts [Array<String>] :filters_id ID filter @option opts [String] :sort_id ID sorting @option opts [Integer] :limit Max results @option opts [Integer] :offset Results to skip @option opts [String] :fields Field set @return [Array<(ListPaymentMethods, Fixnum, Hash)>] ListPaymentMethods data, response status code and response headers

# File lib/phone_com_client/api/payment_methods_api.rb, line 227
def list_account_payment_methods_with_http_info(account_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.list_account_payment_methods ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling PaymentMethodsApi.list_account_payment_methods"
  end
  if @api_client.config.client_side_validation && !opts[:'sort_id'].nil? && opts[:'sort_id'] !~ Regexp.new(/asc|desc/)
    fail ArgumentError, "invalid value for 'opts[:\"sort_id\"]' when calling PaymentMethodsApi.list_account_payment_methods, must conform to the pattern /asc|desc/."
  end

  # resource path
  local_var_path = '/accounts/{account_id}/payment-methods'.sub('{' + 'account_id' + '}', account_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'filters[id]'] = @api_client.build_collection_param(opts[:'filters_id'], :multi) if !opts[:'filters_id'].nil?
  query_params[:'sort[id]'] = opts[:'sort_id'] if !opts[:'sort_id'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?

  # 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 = nil
  auth_names = ['apiKey']
  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 => 'ListPaymentMethods')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentMethodsApi#list_account_payment_methods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_account_payment_method(account_id, pm_id, opts = {}) click to toggle source

Replace the status of an individual payment method. Replace the status of an individual payment method. See Account Payment Methods for more info on the properties. @param account_id Account ID @param pm_id Payment Method ID @param [Hash] opts the optional parameters @option opts [PatchPaymentParams] :data Payment data @return [PaymentFull]

# File lib/phone_com_client/api/payment_methods_api.rb, line 282
def patch_account_payment_method(account_id, pm_id, opts = {})
  data, _status_code, _headers = patch_account_payment_method_with_http_info(account_id, pm_id, opts)
  data
end
patch_account_payment_method_with_http_info(account_id, pm_id, opts = {}) click to toggle source

Replace the status of an individual payment method. Replace the status of an individual payment method. See Account Payment Methods for more info on the properties. @param account_id Account ID @param pm_id Payment Method ID @param [Hash] opts the optional parameters @option opts [PatchPaymentParams] :data Payment data @return [Array<(PaymentFull, Fixnum, Hash)>] PaymentFull data, response status code and response headers

# File lib/phone_com_client/api/payment_methods_api.rb, line 294
def patch_account_payment_method_with_http_info(account_id, pm_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentMethodsApi.patch_account_payment_method ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && account_id.nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling PaymentMethodsApi.patch_account_payment_method"
  end
  # verify the required parameter 'pm_id' is set
  if @api_client.config.client_side_validation && pm_id.nil?
    fail ArgumentError, "Missing the required parameter 'pm_id' when calling PaymentMethodsApi.patch_account_payment_method"
  end
  # resource path
  local_var_path = '/accounts/{account_id}/payment-methods/{pm_id}'.sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'pm_id' + '}', pm_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(opts[:'data'])
  auth_names = ['apiKey']
  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 => 'PaymentFull')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentMethodsApi#patch_account_payment_method\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end