class Conekta::ShippingContactsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_customer_shipping_contacts(id, customer_shipping_contacts, opts = {}) click to toggle source

Create a shipping contacts Create a shipping contacts for a customer. @param id [String] Identifier of the resource @param customer_shipping_contacts [CustomerShippingContacts] requested field for customer shippings contacts @param [Hash] opts the optional parameters @option opts [String] :accept_language Use for knowing which language to use (default to ‘es’) @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. @return [CustomerShippingContactsResponse]

# File lib/conekta/api/shipping_contacts_api.rb, line 30
def create_customer_shipping_contacts(id, customer_shipping_contacts, opts = {})
  data, _status_code, _headers = create_customer_shipping_contacts_with_http_info(id, customer_shipping_contacts, opts)
  data
end
create_customer_shipping_contacts_with_http_info(id, customer_shipping_contacts, opts = {}) click to toggle source

Create a shipping contacts Create a shipping contacts for a customer. @param id [String] Identifier of the resource @param customer_shipping_contacts [CustomerShippingContacts] requested field for customer shippings contacts @param [Hash] opts the optional parameters @option opts [String] :accept_language Use for knowing which language to use (default to ‘es’) @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. @return [Array<(CustomerShippingContactsResponse, Integer, Hash)>] CustomerShippingContactsResponse data, response status code and response headers

# File lib/conekta/api/shipping_contacts_api.rb, line 43
def create_customer_shipping_contacts_with_http_info(id, customer_shipping_contacts, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShippingContactsApi.create_customer_shipping_contacts ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ShippingContactsApi.create_customer_shipping_contacts"
  end
  # verify the required parameter 'customer_shipping_contacts' is set
  if @api_client.config.client_side_validation && customer_shipping_contacts.nil?
    fail ArgumentError, "Missing the required parameter 'customer_shipping_contacts' when calling ShippingContactsApi.create_customer_shipping_contacts"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/shipping_contacts'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # 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/vnd.conekta-v2.1.0+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'CustomerShippingContactsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ShippingContactsApi.create_customer_shipping_contacts",
    :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: ShippingContactsApi#create_customer_shipping_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_customer_shipping_contacts(id, shipping_contacts_id, opts = {}) click to toggle source

Delete shipping contacts Delete shipping contact that corresponds to a customer ID. @param id [String] Identifier of the resource @param shipping_contacts_id [String] identifier @param [Hash] opts the optional parameters @option opts [String] :accept_language Use for knowing which language to use (default to ‘es’) @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. @return [CustomerShippingContactsResponse]

# File lib/conekta/api/shipping_contacts_api.rb, line 114
def delete_customer_shipping_contacts(id, shipping_contacts_id, opts = {})
  data, _status_code, _headers = delete_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, opts)
  data
end
delete_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, opts = {}) click to toggle source

Delete shipping contacts Delete shipping contact that corresponds to a customer ID. @param id [String] Identifier of the resource @param shipping_contacts_id [String] identifier @param [Hash] opts the optional parameters @option opts [String] :accept_language Use for knowing which language to use (default to ‘es’) @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. @return [Array<(CustomerShippingContactsResponse, Integer, Hash)>] CustomerShippingContactsResponse data, response status code and response headers

# File lib/conekta/api/shipping_contacts_api.rb, line 127
def delete_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShippingContactsApi.delete_customer_shipping_contacts ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ShippingContactsApi.delete_customer_shipping_contacts"
  end
  # verify the required parameter 'shipping_contacts_id' is set
  if @api_client.config.client_side_validation && shipping_contacts_id.nil?
    fail ArgumentError, "Missing the required parameter 'shipping_contacts_id' when calling ShippingContactsApi.delete_customer_shipping_contacts"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/shipping_contacts/{shipping_contacts_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_contacts_id' + '}', CGI.escape(shipping_contacts_id.to_s))

  # 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/vnd.conekta-v2.1.0+json'])
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CustomerShippingContactsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"ShippingContactsApi.delete_customer_shipping_contacts",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ShippingContactsApi#delete_customer_shipping_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts, opts = {}) click to toggle source

Update shipping contacts Update shipping contact that corresponds to a customer ID. @param id [String] Identifier of the resource @param shipping_contacts_id [String] identifier @param customer_update_shipping_contacts [CustomerUpdateShippingContacts] requested field for customer update shippings contacts @param [Hash] opts the optional parameters @option opts [String] :accept_language Use for knowing which language to use (default to ‘es’) @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. @return [CustomerShippingContactsResponse]

# File lib/conekta/api/shipping_contacts_api.rb, line 194
def update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts, opts = {})
  data, _status_code, _headers = update_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, customer_update_shipping_contacts, opts)
  data
end
update_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, customer_update_shipping_contacts, opts = {}) click to toggle source

Update shipping contacts Update shipping contact that corresponds to a customer ID. @param id [String] Identifier of the resource @param shipping_contacts_id [String] identifier @param customer_update_shipping_contacts [CustomerUpdateShippingContacts] requested field for customer update shippings contacts @param [Hash] opts the optional parameters @option opts [String] :accept_language Use for knowing which language to use (default to ‘es’) @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. @return [Array<(CustomerShippingContactsResponse, Integer, Hash)>] CustomerShippingContactsResponse data, response status code and response headers

# File lib/conekta/api/shipping_contacts_api.rb, line 208
def update_customer_shipping_contacts_with_http_info(id, shipping_contacts_id, customer_update_shipping_contacts, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShippingContactsApi.update_customer_shipping_contacts ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ShippingContactsApi.update_customer_shipping_contacts"
  end
  # verify the required parameter 'shipping_contacts_id' is set
  if @api_client.config.client_side_validation && shipping_contacts_id.nil?
    fail ArgumentError, "Missing the required parameter 'shipping_contacts_id' when calling ShippingContactsApi.update_customer_shipping_contacts"
  end
  # verify the required parameter 'customer_update_shipping_contacts' is set
  if @api_client.config.client_side_validation && customer_update_shipping_contacts.nil?
    fail ArgumentError, "Missing the required parameter 'customer_update_shipping_contacts' when calling ShippingContactsApi.update_customer_shipping_contacts"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/shipping_contacts/{shipping_contacts_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_contacts_id' + '}', CGI.escape(shipping_contacts_id.to_s))

  # 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/vnd.conekta-v2.1.0+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'CustomerShippingContactsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

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