Class: ModernTreasury::DocumentApi
- Defined in:
- lib/modern_treasury/apis/document_api.rb
Overview
DocumentApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#create_document(documentable_id, documentable_type, file, idempotency_key: nil, document_type: nil) ⇒ ApiResponse
Create a document.
-
#create_document1(documentable_id, documentable_type, file, idempotency_key: nil, document_type: nil) ⇒ ApiResponse
Create a document.
-
#download_document(documentable_id, documentable_type, id) ⇒ ApiResponse
Download an existing document.
-
#download_document1(id) ⇒ ApiResponse
Download an existing document.
-
#get_document(documentable_id, documentable_type, id) ⇒ ApiResponse
Get an existing document.
-
#get_document1(id) ⇒ ApiResponse
Get an existing document.
-
#list_documents(documentable_id: nil, documentable_type: nil, after_cursor: nil, per_page: nil) ⇒ ApiResponse
Get a list of documents.
-
#list_documents1(documentable_id, documentable_type, document_type: nil, after_cursor: nil, per_page: nil) ⇒ ApiResponse
Get a list of documents.
Methods inherited from BaseApi
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from ModernTreasury::BaseApi
Instance Method Details
#create_document(documentable_id, documentable_type, file, idempotency_key: nil, document_type: nil) ⇒ ApiResponse
Create a document. for the associated object. type description here here something unique, preferably something like an UUID. document, can be ‘null`.
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 |
# File 'lib/modern_treasury/apis/document_api.rb', line 59 def create_document(documentable_id, documentable_type, file, idempotency_key: nil, document_type: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/documents', Server::DEFAULT) .form_param(new_parameter(documentable_id, key: 'documentable_id') .is_required(true)) .form_param(new_parameter(documentable_type, key: 'documentable_type') .is_required(true)) .multipart_param(new_parameter(file, key: 'file') .is_required(true) .default_content_type('application/octet-stream')) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .form_param(new_parameter(document_type, key: 'document_type')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Document.method(:from_hash)) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#create_document1(documentable_id, documentable_type, file, idempotency_key: nil, document_type: nil) ⇒ ApiResponse
Create a document. for the associated object. of the associated object. Currently can be one of ‘payment_order`, `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`, `case`, `internal_account`, `decision`, or `external_account`. here something unique, preferably something like an UUID. document, can be `null`.
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 |
# File 'lib/modern_treasury/apis/document_api.rb', line 150 def create_document1(documentable_id, documentable_type, file, idempotency_key: nil, document_type: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/{documentable_type}/{documentable_id}/documents', Server::DEFAULT) .template_param(new_parameter(documentable_id, key: 'documentable_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(documentable_type, key: 'documentable_type') .is_required(true) .should_encode(true)) .multipart_param(new_parameter(file, key: 'file') .is_required(true) .default_content_type('application/octet-stream')) .header_param(new_parameter(idempotency_key, key: 'Idempotency-Key')) .form_param(new_parameter(document_type, key: 'document_type')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Document.method(:from_hash)) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#download_document(documentable_id, documentable_type, id) ⇒ ApiResponse
Download an existing document. for the associated object. of the associated object. Currently can be one of ‘payment_order`, `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`, `case`, `internal_account`, `decision`, or `external_account`.
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/modern_treasury/apis/document_api.rb', line 256 def download_document(documentable_id, documentable_type, id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/{documentable_type}/{documentable_id}/documents/{id}/download', Server::DEFAULT) .template_param(new_parameter(documentable_id, key: 'documentable_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(documentable_type, key: 'documentable_type') .is_required(true) .should_encode(true)) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#download_document1(id) ⇒ ApiResponse
Download an existing document.
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/modern_treasury/apis/document_api.rb', line 288 def download_document1(id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/documents/{id}/download', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .auth(Single.new('basic_auth'))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('403', 'forbidden', ErrorMessageException) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#get_document(documentable_id, documentable_type, id) ⇒ ApiResponse
Get an existing document. for the associated object. of the associated object. Currently can be one of ‘payment_order`, `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`, `case`, `internal_account`, `decision`, or `external_account`.
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/modern_treasury/apis/document_api.rb', line 195 def get_document(documentable_id, documentable_type, id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/{documentable_type}/{documentable_id}/documents/{id}', Server::DEFAULT) .template_param(new_parameter(documentable_id, key: 'documentable_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(documentable_type, key: 'documentable_type') .is_required(true) .should_encode(true)) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Document.method(:from_hash)) .is_api_response(true) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#get_document1(id) ⇒ ApiResponse
Get an existing document.
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/modern_treasury/apis/document_api.rb', line 226 def get_document1(id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/documents/{id}', Server::DEFAULT) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Document.method(:from_hash)) .is_api_response(true) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#list_documents(documentable_id: nil, documentable_type: nil, after_cursor: nil, per_page: nil) ⇒ ApiResponse
Get a list of documents. for the associated object. of the associated object. Currently can be one of ‘payment_order`, `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`, `case`, `internal_account`, `decision`, or `external_account`. here here
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/modern_treasury/apis/document_api.rb', line 22 def list_documents(documentable_id: nil, documentable_type: nil, after_cursor: nil, per_page: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/documents', Server::DEFAULT) .query_param(new_parameter(documentable_id, key: 'documentable_id')) .query_param(new_parameter(documentable_type, key: 'documentable_type')) .query_param(new_parameter(after_cursor, key: 'after_cursor')) .query_param(new_parameter(per_page, key: 'per_page')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Document.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('404', 'not found', ErrorMessageException)) .execute end |
#list_documents1(documentable_id, documentable_type, document_type: nil, after_cursor: nil, per_page: nil) ⇒ ApiResponse
Get a list of documents. for the associated object. of the associated object. Currently can be one of ‘payment_order`, `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`, `case`, `internal_account`, `decision`, or `external_account`. document, can be `null`. here here
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 |
# File 'lib/modern_treasury/apis/document_api.rb', line 107 def list_documents1(documentable_id, documentable_type, document_type: nil, after_cursor: nil, per_page: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/{documentable_type}/{documentable_id}/documents', Server::DEFAULT) .template_param(new_parameter(documentable_id, key: 'documentable_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(documentable_type, key: 'documentable_type') .is_required(true) .should_encode(true)) .query_param(new_parameter(document_type, key: 'document_type')) .query_param(new_parameter(after_cursor, key: 'after_cursor')) .query_param(new_parameter(per_page, key: 'per_page')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic_auth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Document.method(:from_hash)) .is_api_response(true) .is_response_array(true)) .execute end |