Class: TripletexRubyClient::ProjectimportApi

Inherits:
Object
  • Object
show all
Defined in:
lib/tripletex_ruby_client/api/projectimport_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProjectimportApi

Returns a new instance of ProjectimportApi.



19
20
21
# File 'lib/tripletex_ruby_client/api/projectimport_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/tripletex_ruby_client/api/projectimport_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#import_project_statement(file_format, file, opts = {}) ⇒ ListResponseProject

Upload project import file.

Parameters:

  • file_format

    File format

  • file

    The project import file

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :encoding (String)

    Encoding

  • :delimiter (String)

    Delimiter

  • :ignore_first_row (BOOLEAN)

    Ignore first row

Returns:



31
32
33
34
# File 'lib/tripletex_ruby_client/api/projectimport_api.rb', line 31

def import_project_statement(file_format, file, opts = {})
  data, _status_code, _headers = import_project_statement_with_http_info(file_format, file, opts)
  data
end

#import_project_statement_with_http_info(file_format, file, opts = {}) ⇒ Array<(ListResponseProject, Fixnum, Hash)>

Upload project import file.

Parameters:

  • file_format

    File format

  • file

    The project import file

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :encoding (String)

    Encoding

  • :delimiter (String)

    Delimiter

  • :ignore_first_row (BOOLEAN)

    Ignore first row

Returns:

  • (Array<(ListResponseProject, Fixnum, Hash)>)

    ListResponseProject data, response status code and response headers



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/tripletex_ruby_client/api/projectimport_api.rb', line 45

def import_project_statement_with_http_info(file_format, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProjectimportApi.import_project_statement ...'
  end
  # verify the required parameter 'file_format' is set
  if @api_client.config.client_side_validation && file_format.nil?
    fail ArgumentError, "Missing the required parameter 'file_format' when calling ProjectimportApi.import_project_statement"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['XLS', 'CSV'].include?(file_format)
    fail ArgumentError, "invalid value for 'file_format', must be one of XLS, CSV"
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling ProjectimportApi.import_project_statement"
  end
  # resource path
  local_var_path = '/project/import'

  # query parameters
  query_params = {}
  query_params[:'fileFormat'] = file_format
  query_params[:'encoding'] = opts[:'encoding'] if !opts[:'encoding'].nil?
  query_params[:'delimiter'] = opts[:'delimiter'] if !opts[:'delimiter'].nil?
  query_params[:'ignoreFirstRow'] = opts[:'ignore_first_row'] if !opts[:'ignore_first_row'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['file'] = file

  # http body (model)
  post_body = nil
  auth_names = ['tokenAuthScheme']
  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 => 'ListResponseProject')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProjectimportApi#import_project_statement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end