Class: BudgeaClient::OCRApi

Inherits:
Object
  • Object
show all
Defined in:
lib/budgea_client/api/ocr_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ OCRApi

Returns a new instance of OCRApi.



19
20
21
# File 'lib/budgea_client/api/ocr_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/budgea_client/api/ocr_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#ocr_post(file, opts = {}) ⇒ nil

Post an image with OCR Post an image and apply OCR on it to obtain found meta-data.

Parameters:

  • file

    File of the document

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

    the optional parameters

Options Hash (opts):

  • :id_transaction (Integer)

    Transaction used to help OCR to find data

  • :name (String)

    Name of the document

Returns:

  • (nil)


29
30
31
32
# File 'lib/budgea_client/api/ocr_api.rb', line 29

def ocr_post(file, opts = {})
  ocr_post_with_http_info(file, opts)
  nil
end

#ocr_post_with_http_info(file, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Post an image with OCR Post an image and apply OCR on it to obtain found meta-data.&lt;br&gt;&lt;br&gt;

Parameters:

  • file

    File of the document

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

    the optional parameters

Options Hash (opts):

  • :id_transaction (Integer)

    Transaction used to help OCR to find data

  • :name (String)

    Name of the document

Returns:

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

    nil, response status code and response headers



41
42
43
44
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
# File 'lib/budgea_client/api/ocr_api.rb', line 41

def ocr_post_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OCRApi.ocr_post ...'
  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 OCRApi.ocr_post"
  end
  # resource path
  local_var_path = '/ocr'

  # 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(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['file'] = file
  form_params['id_transaction'] = opts[:'id_transaction'] if !opts[:'id_transaction'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?

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

#users_id_user_ocr_post(id_user, file, opts = {}) ⇒ nil

Post an image with OCR Post an image and apply OCR on it to obtain found meta-data.

Parameters:

  • id_user

    Hint: you can use &#39;me&#39; or &#39;all&#39;

  • file

    File of the document

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

    the optional parameters

Options Hash (opts):

  • :id_transaction (Integer)

    Transaction used to help OCR to find data

  • :name (String)

    Name of the document

Returns:

  • (nil)


90
91
92
93
# File 'lib/budgea_client/api/ocr_api.rb', line 90

def users_id_user_ocr_post(id_user, file, opts = {})
  users_id_user_ocr_post_with_http_info(id_user, file, opts)
  nil
end

#users_id_user_ocr_post_with_http_info(id_user, file, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Post an image with OCR Post an image and apply OCR on it to obtain found meta-data.&lt;br&gt;&lt;br&gt;

Parameters:

  • id_user

    Hint: you can use &#39;me&#39; or &#39;all&#39;

  • file

    File of the document

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

    the optional parameters

Options Hash (opts):

  • :id_transaction (Integer)

    Transaction used to help OCR to find data

  • :name (String)

    Name of the document

Returns:

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

    nil, response status code and response headers



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/budgea_client/api/ocr_api.rb', line 103

def users_id_user_ocr_post_with_http_info(id_user, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OCRApi.users_id_user_ocr_post ...'
  end
  # verify the required parameter 'id_user' is set
  if @api_client.config.client_side_validation && id_user.nil?
    fail ArgumentError, "Missing the required parameter 'id_user' when calling OCRApi.users_id_user_ocr_post"
  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 OCRApi.users_id_user_ocr_post"
  end
  # resource path
  local_var_path = '/users/{id_user}/ocr'.sub('{' + 'id_user' + '}', id_user.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(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['file'] = file
  form_params['id_transaction'] = opts[:'id_transaction'] if !opts[:'id_transaction'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?

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