=begin #Dropbox Sign API #Dropbox Sign v3 API The version of the OpenAPI document: 3.0.0 Contact: apisupport@hellosign.com Generated by: https://openapi-generator.tech Generator version: 7.8.0 =end require 'cgi' module Dropbox end module Dropbox::Sign class FaxLineApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Add Fax Line User # Grants a user access to the specified Fax Line. # @param fax_line_add_user_request [FaxLineAddUserRequest] # @param [Hash] opts the optional parameters # @return [FaxLineResponse] def fax_line_add_user(fax_line_add_user_request, opts = {}) data, _status_code, _headers = fax_line_add_user_with_http_info(fax_line_add_user_request, opts) data end # Add Fax Line User # Grants a user access to the specified Fax Line. # @param fax_line_add_user_request [FaxLineAddUserRequest] # @param [Hash] opts the optional parameters # @return [Array<(FaxLineResponse, Integer, Hash)>] FaxLineResponse data, response status code and response headers def fax_line_add_user_with_http_info(fax_line_add_user_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FaxLineApi.fax_line_add_user ...' end # verify the required parameter 'fax_line_add_user_request' is set if @api_client.config.client_side_validation && fax_line_add_user_request.nil? fail ArgumentError, "Missing the required parameter 'fax_line_add_user_request' when calling FaxLineApi.fax_line_add_user" end # resource path local_var_path = '/fax_line/add_user' # 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']) unless header_params['Accept'] # 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 post_body = {} form_params = opts[:form_params] || {} result = @api_client.generate_form_data( fax_line_add_user_request, Dropbox::Sign::FaxLineAddUserRequest.openapi_types ) # form parameters if result[:has_file] form_params = opts[:form_params] || result[:params] header_params['Content-Type'] = 'multipart/form-data' else # http body (model) post_body = opts[:debug_body] || result[:params] end # return_type return_type = opts[:debug_return_type] || 'FaxLineResponse' # auth_names auth_names = opts[:debug_auth_names] || ['api_key'] new_options = opts.merge( :operation => :"FaxLineApi.fax_line_add_user", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) begin data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) rescue Dropbox::Sign::ApiError => e if e.code === 200 body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::FaxLineResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end range_code = "4XX".split('').first range_code_left = "#{range_code}00".to_i range_code_right = "#{range_code}99".to_i if e.code >= range_code_left && e.code <= range_code_right body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::ErrorResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end end if @api_client.config.debugging @api_client.config.logger.debug "API called: FaxLineApi#fax_line_add_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Available Fax Line Area Codes # Returns a response with the area codes available for a given state/provice and city. # @param country [String] Filter area codes by country. # @param [Hash] opts the optional parameters # @option opts [String] :state Filter area codes by state. # @option opts [String] :province Filter area codes by province. # @option opts [String] :city Filter area codes by city. # @return [FaxLineAreaCodeGetResponse] def fax_line_area_code_get(country, opts = {}) data, _status_code, _headers = fax_line_area_code_get_with_http_info(country, opts) data end # Get Available Fax Line Area Codes # Returns a response with the area codes available for a given state/provice and city. # @param country [String] Filter area codes by country. # @param [Hash] opts the optional parameters # @option opts [String] :state Filter area codes by state. # @option opts [String] :province Filter area codes by province. # @option opts [String] :city Filter area codes by city. # @return [Array<(FaxLineAreaCodeGetResponse, Integer, Hash)>] FaxLineAreaCodeGetResponse data, response status code and response headers def fax_line_area_code_get_with_http_info(country, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FaxLineApi.fax_line_area_code_get ...' end # verify the required parameter 'country' is set if @api_client.config.client_side_validation && country.nil? fail ArgumentError, "Missing the required parameter 'country' when calling FaxLineApi.fax_line_area_code_get" end # verify enum value allowable_values = ["CA", "US", "UK"] if @api_client.config.client_side_validation && !allowable_values.include?(country) fail ArgumentError, "invalid value for \"country\", must be one of #{allowable_values}" end allowable_values = ["AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI", "WV", "WY"] if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state']) fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}" end allowable_values = ["AB", "BC", "MB", "NB", "NL", "NT", "NS", "NU", "ON", "PE", "QC", "SK", "YT"] if @api_client.config.client_side_validation && opts[:'province'] && !allowable_values.include?(opts[:'province']) fail ArgumentError, "invalid value for \"province\", must be one of #{allowable_values}" end # resource path local_var_path = '/fax_line/area_codes' # query parameters query_params = opts[:query_params] || {} query_params[:'country'] = country query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil? query_params[:'province'] = opts[:'province'] if !opts[:'province'].nil? query_params[:'city'] = opts[:'city'] if !opts[:'city'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] post_body = {} form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FaxLineAreaCodeGetResponse' # auth_names auth_names = opts[:debug_auth_names] || ['api_key'] new_options = opts.merge( :operation => :"FaxLineApi.fax_line_area_code_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) begin data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) rescue Dropbox::Sign::ApiError => e if e.code === 200 body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::FaxLineAreaCodeGetResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end range_code = "4XX".split('').first range_code_left = "#{range_code}00".to_i range_code_right = "#{range_code}99".to_i if e.code >= range_code_left && e.code <= range_code_right body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::ErrorResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end end if @api_client.config.debugging @api_client.config.logger.debug "API called: FaxLineApi#fax_line_area_code_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Purchase Fax Line # Purchases a new Fax Line. # @param fax_line_create_request [FaxLineCreateRequest] # @param [Hash] opts the optional parameters # @return [FaxLineResponse] def fax_line_create(fax_line_create_request, opts = {}) data, _status_code, _headers = fax_line_create_with_http_info(fax_line_create_request, opts) data end # Purchase Fax Line # Purchases a new Fax Line. # @param fax_line_create_request [FaxLineCreateRequest] # @param [Hash] opts the optional parameters # @return [Array<(FaxLineResponse, Integer, Hash)>] FaxLineResponse data, response status code and response headers def fax_line_create_with_http_info(fax_line_create_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FaxLineApi.fax_line_create ...' end # verify the required parameter 'fax_line_create_request' is set if @api_client.config.client_side_validation && fax_line_create_request.nil? fail ArgumentError, "Missing the required parameter 'fax_line_create_request' when calling FaxLineApi.fax_line_create" end # resource path local_var_path = '/fax_line/create' # 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']) unless header_params['Accept'] # 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 post_body = {} form_params = opts[:form_params] || {} result = @api_client.generate_form_data( fax_line_create_request, Dropbox::Sign::FaxLineCreateRequest.openapi_types ) # form parameters if result[:has_file] form_params = opts[:form_params] || result[:params] header_params['Content-Type'] = 'multipart/form-data' else # http body (model) post_body = opts[:debug_body] || result[:params] end # return_type return_type = opts[:debug_return_type] || 'FaxLineResponse' # auth_names auth_names = opts[:debug_auth_names] || ['api_key'] new_options = opts.merge( :operation => :"FaxLineApi.fax_line_create", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) begin data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) rescue Dropbox::Sign::ApiError => e if e.code === 200 body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::FaxLineResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end range_code = "4XX".split('').first range_code_left = "#{range_code}00".to_i range_code_right = "#{range_code}99".to_i if e.code >= range_code_left && e.code <= range_code_right body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::ErrorResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end end if @api_client.config.debugging @api_client.config.logger.debug "API called: FaxLineApi#fax_line_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete Fax Line # Deletes the specified Fax Line from the subscription. # @param fax_line_delete_request [FaxLineDeleteRequest] # @param [Hash] opts the optional parameters # @return [nil] def fax_line_delete(fax_line_delete_request, opts = {}) fax_line_delete_with_http_info(fax_line_delete_request, opts) nil end # Delete Fax Line # Deletes the specified Fax Line from the subscription. # @param fax_line_delete_request [FaxLineDeleteRequest] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def fax_line_delete_with_http_info(fax_line_delete_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FaxLineApi.fax_line_delete ...' end # verify the required parameter 'fax_line_delete_request' is set if @api_client.config.client_side_validation && fax_line_delete_request.nil? fail ArgumentError, "Missing the required parameter 'fax_line_delete_request' when calling FaxLineApi.fax_line_delete" end # resource path local_var_path = '/fax_line' # 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']) unless header_params['Accept'] # 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 post_body = {} form_params = opts[:form_params] || {} result = @api_client.generate_form_data( fax_line_delete_request, Dropbox::Sign::FaxLineDeleteRequest.openapi_types ) # form parameters if result[:has_file] form_params = opts[:form_params] || result[:params] header_params['Content-Type'] = 'multipart/form-data' else # http body (model) post_body = opts[:debug_body] || result[:params] end # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['api_key'] new_options = opts.merge( :operation => :"FaxLineApi.fax_line_delete", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) begin data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) rescue Dropbox::Sign::ApiError => e end if @api_client.config.debugging @api_client.config.logger.debug "API called: FaxLineApi#fax_line_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Fax Line # Returns the properties and settings of a Fax Line. # @param number [String] The Fax Line number. # @param [Hash] opts the optional parameters # @return [FaxLineResponse] def fax_line_get(number, opts = {}) data, _status_code, _headers = fax_line_get_with_http_info(number, opts) data end # Get Fax Line # Returns the properties and settings of a Fax Line. # @param number [String] The Fax Line number. # @param [Hash] opts the optional parameters # @return [Array<(FaxLineResponse, Integer, Hash)>] FaxLineResponse data, response status code and response headers def fax_line_get_with_http_info(number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FaxLineApi.fax_line_get ...' end # verify the required parameter 'number' is set if @api_client.config.client_side_validation && number.nil? fail ArgumentError, "Missing the required parameter 'number' when calling FaxLineApi.fax_line_get" end # resource path local_var_path = '/fax_line' # query parameters query_params = opts[:query_params] || {} query_params[:'number'] = number # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] post_body = {} form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FaxLineResponse' # auth_names auth_names = opts[:debug_auth_names] || ['api_key'] new_options = opts.merge( :operation => :"FaxLineApi.fax_line_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) begin data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) rescue Dropbox::Sign::ApiError => e if e.code === 200 body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::FaxLineResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end range_code = "4XX".split('').first range_code_left = "#{range_code}00".to_i range_code_right = "#{range_code}99".to_i if e.code >= range_code_left && e.code <= range_code_right body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::ErrorResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end end if @api_client.config.debugging @api_client.config.logger.debug "API called: FaxLineApi#fax_line_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Fax Lines # Returns the properties and settings of multiple Fax Lines. # @param [Hash] opts the optional parameters # @option opts [String] :account_id Account ID # @option opts [Integer] :page Page (default to 1) # @option opts [Integer] :page_size Page size (default to 20) # @option opts [Boolean] :show_team_lines Show team lines # @return [FaxLineListResponse] def fax_line_list(opts = {}) data, _status_code, _headers = fax_line_list_with_http_info(opts) data end # List Fax Lines # Returns the properties and settings of multiple Fax Lines. # @param [Hash] opts the optional parameters # @option opts [String] :account_id Account ID # @option opts [Integer] :page Page (default to 1) # @option opts [Integer] :page_size Page size (default to 20) # @option opts [Boolean] :show_team_lines Show team lines # @return [Array<(FaxLineListResponse, Integer, Hash)>] FaxLineListResponse data, response status code and response headers def fax_line_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FaxLineApi.fax_line_list ...' end # resource path local_var_path = '/fax_line/list' # query parameters query_params = opts[:query_params] || {} query_params[:'account_id'] = opts[:'account_id'] if !opts[:'account_id'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'show_team_lines'] = opts[:'show_team_lines'] if !opts[:'show_team_lines'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] post_body = {} form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FaxLineListResponse' # auth_names auth_names = opts[:debug_auth_names] || ['api_key'] new_options = opts.merge( :operation => :"FaxLineApi.fax_line_list", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) begin data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) rescue Dropbox::Sign::ApiError => e if e.code === 200 body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::FaxLineListResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end range_code = "4XX".split('').first range_code_left = "#{range_code}00".to_i range_code_right = "#{range_code}99".to_i if e.code >= range_code_left && e.code <= range_code_right body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::ErrorResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end end if @api_client.config.debugging @api_client.config.logger.debug "API called: FaxLineApi#fax_line_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Remove Fax Line Access # Removes a user's access to the specified Fax Line. # @param fax_line_remove_user_request [FaxLineRemoveUserRequest] # @param [Hash] opts the optional parameters # @return [FaxLineResponse] def fax_line_remove_user(fax_line_remove_user_request, opts = {}) data, _status_code, _headers = fax_line_remove_user_with_http_info(fax_line_remove_user_request, opts) data end # Remove Fax Line Access # Removes a user's access to the specified Fax Line. # @param fax_line_remove_user_request [FaxLineRemoveUserRequest] # @param [Hash] opts the optional parameters # @return [Array<(FaxLineResponse, Integer, Hash)>] FaxLineResponse data, response status code and response headers def fax_line_remove_user_with_http_info(fax_line_remove_user_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FaxLineApi.fax_line_remove_user ...' end # verify the required parameter 'fax_line_remove_user_request' is set if @api_client.config.client_side_validation && fax_line_remove_user_request.nil? fail ArgumentError, "Missing the required parameter 'fax_line_remove_user_request' when calling FaxLineApi.fax_line_remove_user" end # resource path local_var_path = '/fax_line/remove_user' # 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']) unless header_params['Accept'] # 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 post_body = {} form_params = opts[:form_params] || {} result = @api_client.generate_form_data( fax_line_remove_user_request, Dropbox::Sign::FaxLineRemoveUserRequest.openapi_types ) # form parameters if result[:has_file] form_params = opts[:form_params] || result[:params] header_params['Content-Type'] = 'multipart/form-data' else # http body (model) post_body = opts[:debug_body] || result[:params] end # return_type return_type = opts[:debug_return_type] || 'FaxLineResponse' # auth_names auth_names = opts[:debug_auth_names] || ['api_key'] new_options = opts.merge( :operation => :"FaxLineApi.fax_line_remove_user", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) begin data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) rescue Dropbox::Sign::ApiError => e if e.code === 200 body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::FaxLineResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end range_code = "4XX".split('').first range_code_left = "#{range_code}00".to_i range_code_right = "#{range_code}99".to_i if e.code >= range_code_left && e.code <= range_code_right body = @api_client.convert_to_type( JSON.parse("[#{e.response_body}]", :symbolize_names => true)[0], "Dropbox::Sign::ErrorResponse" ) fail ApiError.new(:code => e.code, :response_headers => e.response_headers, :response_body => body), e.message end end if @api_client.config.debugging @api_client.config.logger.debug "API called: FaxLineApi#fax_line_remove_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end