pnap_invoicing_api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +153 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/docs/Error.md +20 -0
- data/docs/Invoice.md +32 -0
- data/docs/InvoicesApi.md +307 -0
- data/docs/PaginatedInvoices.md +24 -0
- data/docs/PaginatedResponse.md +22 -0
- data/lib/pnap_invoicing_api/api/invoices_api.rb +323 -0
- data/lib/pnap_invoicing_api/api_client.rb +397 -0
- data/lib/pnap_invoicing_api/api_error.rb +58 -0
- data/lib/pnap_invoicing_api/configuration.rb +298 -0
- data/lib/pnap_invoicing_api/models/error.rb +234 -0
- data/lib/pnap_invoicing_api/models/invoice.rb +341 -0
- data/lib/pnap_invoicing_api/models/paginated_invoices.rb +281 -0
- data/lib/pnap_invoicing_api/models/paginated_response.rb +256 -0
- data/lib/pnap_invoicing_api/version.rb +19 -0
- data/lib/pnap_invoicing_api.rb +44 -0
- data/pnap_invoicing_api.gemspec +39 -0
- data/spec/api/invoices_api_spec.rb +91 -0
- data/spec/models/error_spec.rb +42 -0
- data/spec/models/invoice_spec.rb +78 -0
- data/spec/models/paginated_invoices_spec.rb +54 -0
- data/spec/models/paginated_response_spec.rb +48 -0
- data/spec/spec_helper.rb +111 -0
- metadata +116 -0
@@ -0,0 +1,323 @@
|
|
1
|
+
=begin
|
2
|
+
#Invoicing API
|
3
|
+
|
4
|
+
#List, fetch and pay invoices with the Invoicing API.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: support@phoenixnap.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module InvoicingApi
|
16
|
+
class InvoicesApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# List invoices.
|
23
|
+
# List invoices.
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [String] :number A user-friendly reference number assigned to the invoice.
|
26
|
+
# @option opts [String] :status Payment status of the invoice.
|
27
|
+
# @option opts [Time] :sent_on_from Minimum value to filter invoices by sent on date.
|
28
|
+
# @option opts [Time] :sent_on_to Maximum value to filter invoices by sent on date.
|
29
|
+
# @option opts [Integer] :limit The limit of the number of results returned. The number of records returned may be smaller than the limit. (default to 100)
|
30
|
+
# @option opts [Integer] :offset The number of items to skip in the results. (default to 0)
|
31
|
+
# @option opts [String] :sort_field If a sortField is requested, pagination will be done after sorting. Default sorting is by number. (default to 'sentOn')
|
32
|
+
# @option opts [String] :sort_direction Sort Given Field depending on the desired direction. Default sorting is descending. (default to 'DESC')
|
33
|
+
# @return [PaginatedInvoices]
|
34
|
+
def invoices_get(opts = {})
|
35
|
+
data, _status_code, _headers = invoices_get_with_http_info(opts)
|
36
|
+
data
|
37
|
+
end
|
38
|
+
|
39
|
+
# List invoices.
|
40
|
+
# List invoices.
|
41
|
+
# @param [Hash] opts the optional parameters
|
42
|
+
# @option opts [String] :number A user-friendly reference number assigned to the invoice.
|
43
|
+
# @option opts [String] :status Payment status of the invoice.
|
44
|
+
# @option opts [Time] :sent_on_from Minimum value to filter invoices by sent on date.
|
45
|
+
# @option opts [Time] :sent_on_to Maximum value to filter invoices by sent on date.
|
46
|
+
# @option opts [Integer] :limit The limit of the number of results returned. The number of records returned may be smaller than the limit. (default to 100)
|
47
|
+
# @option opts [Integer] :offset The number of items to skip in the results. (default to 0)
|
48
|
+
# @option opts [String] :sort_field If a sortField is requested, pagination will be done after sorting. Default sorting is by number. (default to 'sentOn')
|
49
|
+
# @option opts [String] :sort_direction Sort Given Field depending on the desired direction. Default sorting is descending. (default to 'DESC')
|
50
|
+
# @return [Array<(PaginatedInvoices, Integer, Hash)>] PaginatedInvoices data, response status code and response headers
|
51
|
+
def invoices_get_with_http_info(opts = {})
|
52
|
+
if @api_client.config.debugging
|
53
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.invoices_get ...'
|
54
|
+
end
|
55
|
+
allowable_values = ["PAID", "UNPAID", "OVERDUE", "PAYMENT_PROCESSING"]
|
56
|
+
if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
|
57
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
|
58
|
+
end
|
59
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
|
60
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InvoicesApi.invoices_get, must be smaller than or equal to 1000.'
|
61
|
+
end
|
62
|
+
|
63
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
64
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InvoicesApi.invoices_get, must be greater than or equal to 1.'
|
65
|
+
end
|
66
|
+
|
67
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
68
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling InvoicesApi.invoices_get, must be greater than or equal to 0.'
|
69
|
+
end
|
70
|
+
|
71
|
+
allowable_values = ["number", "sentOn", "dueDate", "amount", "outstandingAmount"]
|
72
|
+
if @api_client.config.client_side_validation && opts[:'sort_field'] && !allowable_values.include?(opts[:'sort_field'])
|
73
|
+
fail ArgumentError, "invalid value for \"sort_field\", must be one of #{allowable_values}"
|
74
|
+
end
|
75
|
+
allowable_values = ["ASC", "DESC"]
|
76
|
+
if @api_client.config.client_side_validation && opts[:'sort_direction'] && !allowable_values.include?(opts[:'sort_direction'])
|
77
|
+
fail ArgumentError, "invalid value for \"sort_direction\", must be one of #{allowable_values}"
|
78
|
+
end
|
79
|
+
# resource path
|
80
|
+
local_var_path = '/invoices'
|
81
|
+
|
82
|
+
# query parameters
|
83
|
+
query_params = opts[:query_params] || {}
|
84
|
+
query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
|
85
|
+
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
86
|
+
query_params[:'sentOnFrom'] = opts[:'sent_on_from'] if !opts[:'sent_on_from'].nil?
|
87
|
+
query_params[:'sentOnTo'] = opts[:'sent_on_to'] if !opts[:'sent_on_to'].nil?
|
88
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
89
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
90
|
+
query_params[:'sortField'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?
|
91
|
+
query_params[:'sortDirection'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil?
|
92
|
+
|
93
|
+
# header parameters
|
94
|
+
header_params = opts[:header_params] || {}
|
95
|
+
# HTTP header 'Accept' (if needed)
|
96
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
97
|
+
|
98
|
+
# form parameters
|
99
|
+
form_params = opts[:form_params] || {}
|
100
|
+
|
101
|
+
# http body (model)
|
102
|
+
post_body = opts[:debug_body]
|
103
|
+
|
104
|
+
# return_type
|
105
|
+
return_type = opts[:debug_return_type] || 'PaginatedInvoices'
|
106
|
+
|
107
|
+
# auth_names
|
108
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
109
|
+
|
110
|
+
new_options = opts.merge(
|
111
|
+
:operation => :"InvoicesApi.invoices_get",
|
112
|
+
:header_params => header_params,
|
113
|
+
:query_params => query_params,
|
114
|
+
:form_params => form_params,
|
115
|
+
:body => post_body,
|
116
|
+
:auth_names => auth_names,
|
117
|
+
:return_type => return_type
|
118
|
+
)
|
119
|
+
|
120
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
121
|
+
if @api_client.config.debugging
|
122
|
+
@api_client.config.logger.debug "API called: InvoicesApi#invoices_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
123
|
+
end
|
124
|
+
return data, status_code, headers
|
125
|
+
end
|
126
|
+
|
127
|
+
# Generate invoice details as PDF.
|
128
|
+
# Generate invoice details as PDF.
|
129
|
+
# @param invoice_id [String] The unique resource identifier of the Invoice.
|
130
|
+
# @param [Hash] opts the optional parameters
|
131
|
+
# @return [File]
|
132
|
+
def invoices_invoice_id_generate_pdf_post(invoice_id, opts = {})
|
133
|
+
data, _status_code, _headers = invoices_invoice_id_generate_pdf_post_with_http_info(invoice_id, opts)
|
134
|
+
data
|
135
|
+
end
|
136
|
+
|
137
|
+
# Generate invoice details as PDF.
|
138
|
+
# Generate invoice details as PDF.
|
139
|
+
# @param invoice_id [String] The unique resource identifier of the Invoice.
|
140
|
+
# @param [Hash] opts the optional parameters
|
141
|
+
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
142
|
+
def invoices_invoice_id_generate_pdf_post_with_http_info(invoice_id, opts = {})
|
143
|
+
if @api_client.config.debugging
|
144
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.invoices_invoice_id_generate_pdf_post ...'
|
145
|
+
end
|
146
|
+
# verify the required parameter 'invoice_id' is set
|
147
|
+
if @api_client.config.client_side_validation && invoice_id.nil?
|
148
|
+
fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoicesApi.invoices_invoice_id_generate_pdf_post"
|
149
|
+
end
|
150
|
+
# resource path
|
151
|
+
local_var_path = '/invoices/{invoiceId}/actions/generate-pdf'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_id.to_s))
|
152
|
+
|
153
|
+
# query parameters
|
154
|
+
query_params = opts[:query_params] || {}
|
155
|
+
|
156
|
+
# header parameters
|
157
|
+
header_params = opts[:header_params] || {}
|
158
|
+
# HTTP header 'Accept' (if needed)
|
159
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/json'])
|
160
|
+
|
161
|
+
# form parameters
|
162
|
+
form_params = opts[:form_params] || {}
|
163
|
+
|
164
|
+
# http body (model)
|
165
|
+
post_body = opts[:debug_body]
|
166
|
+
|
167
|
+
# return_type
|
168
|
+
return_type = opts[:debug_return_type] || 'File'
|
169
|
+
|
170
|
+
# auth_names
|
171
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
172
|
+
|
173
|
+
new_options = opts.merge(
|
174
|
+
:operation => :"InvoicesApi.invoices_invoice_id_generate_pdf_post",
|
175
|
+
:header_params => header_params,
|
176
|
+
:query_params => query_params,
|
177
|
+
:form_params => form_params,
|
178
|
+
:body => post_body,
|
179
|
+
:auth_names => auth_names,
|
180
|
+
:return_type => return_type
|
181
|
+
)
|
182
|
+
|
183
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
184
|
+
if @api_client.config.debugging
|
185
|
+
@api_client.config.logger.debug "API called: InvoicesApi#invoices_invoice_id_generate_pdf_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
186
|
+
end
|
187
|
+
return data, status_code, headers
|
188
|
+
end
|
189
|
+
|
190
|
+
# Get invoice details.
|
191
|
+
# Get invoice details.
|
192
|
+
# @param invoice_id [String] The unique resource identifier of the Invoice.
|
193
|
+
# @param [Hash] opts the optional parameters
|
194
|
+
# @return [Invoice]
|
195
|
+
def invoices_invoice_id_get(invoice_id, opts = {})
|
196
|
+
data, _status_code, _headers = invoices_invoice_id_get_with_http_info(invoice_id, opts)
|
197
|
+
data
|
198
|
+
end
|
199
|
+
|
200
|
+
# Get invoice details.
|
201
|
+
# Get invoice details.
|
202
|
+
# @param invoice_id [String] The unique resource identifier of the Invoice.
|
203
|
+
# @param [Hash] opts the optional parameters
|
204
|
+
# @return [Array<(Invoice, Integer, Hash)>] Invoice data, response status code and response headers
|
205
|
+
def invoices_invoice_id_get_with_http_info(invoice_id, opts = {})
|
206
|
+
if @api_client.config.debugging
|
207
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.invoices_invoice_id_get ...'
|
208
|
+
end
|
209
|
+
# verify the required parameter 'invoice_id' is set
|
210
|
+
if @api_client.config.client_side_validation && invoice_id.nil?
|
211
|
+
fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoicesApi.invoices_invoice_id_get"
|
212
|
+
end
|
213
|
+
# resource path
|
214
|
+
local_var_path = '/invoices/{invoiceId}'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_id.to_s))
|
215
|
+
|
216
|
+
# query parameters
|
217
|
+
query_params = opts[:query_params] || {}
|
218
|
+
|
219
|
+
# header parameters
|
220
|
+
header_params = opts[:header_params] || {}
|
221
|
+
# HTTP header 'Accept' (if needed)
|
222
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
223
|
+
|
224
|
+
# form parameters
|
225
|
+
form_params = opts[:form_params] || {}
|
226
|
+
|
227
|
+
# http body (model)
|
228
|
+
post_body = opts[:debug_body]
|
229
|
+
|
230
|
+
# return_type
|
231
|
+
return_type = opts[:debug_return_type] || 'Invoice'
|
232
|
+
|
233
|
+
# auth_names
|
234
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
235
|
+
|
236
|
+
new_options = opts.merge(
|
237
|
+
:operation => :"InvoicesApi.invoices_invoice_id_get",
|
238
|
+
:header_params => header_params,
|
239
|
+
:query_params => query_params,
|
240
|
+
:form_params => form_params,
|
241
|
+
:body => post_body,
|
242
|
+
:auth_names => auth_names,
|
243
|
+
:return_type => return_type
|
244
|
+
)
|
245
|
+
|
246
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
247
|
+
if @api_client.config.debugging
|
248
|
+
@api_client.config.logger.debug "API called: InvoicesApi#invoices_invoice_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
249
|
+
end
|
250
|
+
return data, status_code, headers
|
251
|
+
end
|
252
|
+
|
253
|
+
# Pay an invoice.
|
254
|
+
# Manually pay an invoice.
|
255
|
+
# @param invoice_id [String] The unique resource identifier of the Invoice.
|
256
|
+
# @param [Hash] opts the optional parameters
|
257
|
+
# @option opts [Object] :body
|
258
|
+
# @return [Object]
|
259
|
+
def invoices_invoice_id_pay_post(invoice_id, opts = {})
|
260
|
+
data, _status_code, _headers = invoices_invoice_id_pay_post_with_http_info(invoice_id, opts)
|
261
|
+
data
|
262
|
+
end
|
263
|
+
|
264
|
+
# Pay an invoice.
|
265
|
+
# Manually pay an invoice.
|
266
|
+
# @param invoice_id [String] The unique resource identifier of the Invoice.
|
267
|
+
# @param [Hash] opts the optional parameters
|
268
|
+
# @option opts [Object] :body
|
269
|
+
# @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
|
270
|
+
def invoices_invoice_id_pay_post_with_http_info(invoice_id, opts = {})
|
271
|
+
if @api_client.config.debugging
|
272
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.invoices_invoice_id_pay_post ...'
|
273
|
+
end
|
274
|
+
# verify the required parameter 'invoice_id' is set
|
275
|
+
if @api_client.config.client_side_validation && invoice_id.nil?
|
276
|
+
fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoicesApi.invoices_invoice_id_pay_post"
|
277
|
+
end
|
278
|
+
# resource path
|
279
|
+
local_var_path = '/invoices/{invoiceId}/actions/pay'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_id.to_s))
|
280
|
+
|
281
|
+
# query parameters
|
282
|
+
query_params = opts[:query_params] || {}
|
283
|
+
|
284
|
+
# header parameters
|
285
|
+
header_params = opts[:header_params] || {}
|
286
|
+
# HTTP header 'Accept' (if needed)
|
287
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
288
|
+
# HTTP header 'Content-Type'
|
289
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
290
|
+
if !content_type.nil?
|
291
|
+
header_params['Content-Type'] = content_type
|
292
|
+
end
|
293
|
+
|
294
|
+
# form parameters
|
295
|
+
form_params = opts[:form_params] || {}
|
296
|
+
|
297
|
+
# http body (model)
|
298
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])
|
299
|
+
|
300
|
+
# return_type
|
301
|
+
return_type = opts[:debug_return_type] || 'Object'
|
302
|
+
|
303
|
+
# auth_names
|
304
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
305
|
+
|
306
|
+
new_options = opts.merge(
|
307
|
+
:operation => :"InvoicesApi.invoices_invoice_id_pay_post",
|
308
|
+
:header_params => header_params,
|
309
|
+
:query_params => query_params,
|
310
|
+
:form_params => form_params,
|
311
|
+
:body => post_body,
|
312
|
+
:auth_names => auth_names,
|
313
|
+
:return_type => return_type
|
314
|
+
)
|
315
|
+
|
316
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
317
|
+
if @api_client.config.debugging
|
318
|
+
@api_client.config.logger.debug "API called: InvoicesApi#invoices_invoice_id_pay_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
319
|
+
end
|
320
|
+
return data, status_code, headers
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|