Class: InvoicingApi::InvoicesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pnap_invoicing_api/api/invoices_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ InvoicesApi

Returns a new instance of InvoicesApi.



19
20
21
# File 'lib/pnap_invoicing_api/api/invoices_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/pnap_invoicing_api/api/invoices_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#invoices_get(opts = {}) ⇒ PaginatedInvoices

List invoices. List invoices.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :number (String)

    A user-friendly reference number assigned to the invoice.

  • :status (String)

    Payment status of the invoice.

  • :sent_on_from (Time)

    Minimum value to filter invoices by sent on date.

  • :sent_on_to (Time)

    Maximum value to filter invoices by sent on date.

  • :limit (Integer)

    The limit of the number of results returned. The number of records returned may be smaller than the limit. (default to 100)

  • :offset (Integer)

    The number of items to skip in the results. (default to 0)

  • :sort_field (String)

    If a sortField is requested, pagination will be done after sorting. Default sorting is by number. (default to ‘sentOn’)

  • :sort_direction (String)

    Sort Given Field depending on the desired direction. Default sorting is descending. (default to ‘DESC’)

Returns:



34
35
36
37
# File 'lib/pnap_invoicing_api/api/invoices_api.rb', line 34

def invoices_get(opts = {})
  data, _status_code, _headers = invoices_get_with_http_info(opts)
  data
end

#invoices_get_with_http_info(opts = {}) ⇒ Array<(PaginatedInvoices, Integer, Hash)>

List invoices. List invoices.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :number (String)

    A user-friendly reference number assigned to the invoice.

  • :status (String)

    Payment status of the invoice.

  • :sent_on_from (Time)

    Minimum value to filter invoices by sent on date.

  • :sent_on_to (Time)

    Maximum value to filter invoices by sent on date.

  • :limit (Integer)

    The limit of the number of results returned. The number of records returned may be smaller than the limit. (default to 100)

  • :offset (Integer)

    The number of items to skip in the results. (default to 0)

  • :sort_field (String)

    If a sortField is requested, pagination will be done after sorting. Default sorting is by number. (default to ‘sentOn’)

  • :sort_direction (String)

    Sort Given Field depending on the desired direction. Default sorting is descending. (default to ‘DESC’)

Returns:

  • (Array<(PaginatedInvoices, Integer, Hash)>)

    PaginatedInvoices data, response status code and response headers



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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/pnap_invoicing_api/api/invoices_api.rb', line 51

def invoices_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoicesApi.invoices_get ...'
  end
  allowable_values = ["PAID", "UNPAID", "OVERDUE", "PAYMENT_PROCESSING"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InvoicesApi.invoices_get, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InvoicesApi.invoices_get, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling InvoicesApi.invoices_get, must be greater than or equal to 0.'
  end

  allowable_values = ["number", "sentOn", "dueDate", "amount", "outstandingAmount"]
  if @api_client.config.client_side_validation && opts[:'sort_field'] && !allowable_values.include?(opts[:'sort_field'])
    fail ArgumentError, "invalid value for \"sort_field\", must be one of #{allowable_values}"
  end
  allowable_values = ["ASC", "DESC"]
  if @api_client.config.client_side_validation && opts[:'sort_direction'] && !allowable_values.include?(opts[:'sort_direction'])
    fail ArgumentError, "invalid value for \"sort_direction\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/invoices'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'sentOnFrom'] = opts[:'sent_on_from'] if !opts[:'sent_on_from'].nil?
  query_params[:'sentOnTo'] = opts[:'sent_on_to'] if !opts[:'sent_on_to'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sortField'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?
  query_params[:'sortDirection'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

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

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

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

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

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

#invoices_invoice_id_generate_pdf_post(invoice_id, opts = {}) ⇒ File

Generate invoice details as PDF. Generate invoice details as PDF.

Parameters:

  • invoice_id (String)

    The unique resource identifier of the Invoice.

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

    the optional parameters

Returns:

  • (File)


132
133
134
135
# File 'lib/pnap_invoicing_api/api/invoices_api.rb', line 132

def invoices_invoice_id_generate_pdf_post(invoice_id, opts = {})
  data, _status_code, _headers = invoices_invoice_id_generate_pdf_post_with_http_info(invoice_id, opts)
  data
end

#invoices_invoice_id_generate_pdf_post_with_http_info(invoice_id, opts = {}) ⇒ Array<(File, Integer, Hash)>

Generate invoice details as PDF. Generate invoice details as PDF.

Parameters:

  • invoice_id (String)

    The unique resource identifier of the Invoice.

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

    the optional parameters

Returns:

  • (Array<(File, Integer, Hash)>)

    File data, response status code and response headers



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/pnap_invoicing_api/api/invoices_api.rb', line 142

def invoices_invoice_id_generate_pdf_post_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoicesApi.invoices_invoice_id_generate_pdf_post ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoicesApi.invoices_invoice_id_generate_pdf_post"
  end
  # resource path
  local_var_path = '/invoices/{invoiceId}/actions/generate-pdf'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_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/pdf', 'application/json'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"InvoicesApi.invoices_invoice_id_generate_pdf_post",
    :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: InvoicesApi#invoices_invoice_id_generate_pdf_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#invoices_invoice_id_get(invoice_id, opts = {}) ⇒ Invoice

Get invoice details. Get invoice details.

Parameters:

  • invoice_id (String)

    The unique resource identifier of the Invoice.

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

    the optional parameters

Returns:



195
196
197
198
# File 'lib/pnap_invoicing_api/api/invoices_api.rb', line 195

def invoices_invoice_id_get(invoice_id, opts = {})
  data, _status_code, _headers = invoices_invoice_id_get_with_http_info(invoice_id, opts)
  data
end

#invoices_invoice_id_get_with_http_info(invoice_id, opts = {}) ⇒ Array<(Invoice, Integer, Hash)>

Get invoice details. Get invoice details.

Parameters:

  • invoice_id (String)

    The unique resource identifier of the Invoice.

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

    the optional parameters

Returns:

  • (Array<(Invoice, Integer, Hash)>)

    Invoice data, response status code and response headers



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/pnap_invoicing_api/api/invoices_api.rb', line 205

def invoices_invoice_id_get_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoicesApi.invoices_invoice_id_get ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoicesApi.invoices_invoice_id_get"
  end
  # resource path
  local_var_path = '/invoices/{invoiceId}'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_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/json'])

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

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

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

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

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

#invoices_invoice_id_pay_post(invoice_id, opts = {}) ⇒ Object

Pay an invoice. Manually pay an invoice.

Parameters:

  • invoice_id (String)

    The unique resource identifier of the Invoice.

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

    the optional parameters

Options Hash (opts):

  • :body (Object)

Returns:

  • (Object)


259
260
261
262
# File 'lib/pnap_invoicing_api/api/invoices_api.rb', line 259

def invoices_invoice_id_pay_post(invoice_id, opts = {})
  data, _status_code, _headers = invoices_invoice_id_pay_post_with_http_info(invoice_id, opts)
  data
end

#invoices_invoice_id_pay_post_with_http_info(invoice_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

Pay an invoice. Manually pay an invoice.

Parameters:

  • invoice_id (String)

    The unique resource identifier of the Invoice.

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

    the optional parameters

Options Hash (opts):

  • :body (Object)

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/pnap_invoicing_api/api/invoices_api.rb', line 270

def invoices_invoice_id_pay_post_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoicesApi.invoices_invoice_id_pay_post ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoicesApi.invoices_invoice_id_pay_post"
  end
  # resource path
  local_var_path = '/invoices/{invoiceId}/actions/pay'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_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/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

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

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

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

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

  new_options = opts.merge(
    :operation => :"InvoicesApi.invoices_invoice_id_pay_post",
    :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: InvoicesApi#invoices_invoice_id_pay_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end