module MangoApi::DisputeDocuments
Provides API method delegates for the DisputeDocument
entity
Public Class Methods
Retrieves dispute documents belonging to the current environment's client. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
-
before_date
-
after_date
-
status
-
type
@return [Array] corresponding DisputeDocument entity objects
# File lib/mangopay/api/service/dispute_documents.rb, line 106 def all uri = provide_uri(:get_dispute_documents) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_results results end
Creates temporary URLs where each page of a dispute document can be viewed
@param id
[String] ID of the document whose pages to consult @return [Array] the corresponding DocumentPageConsult objects
# File lib/mangopay/api/service/dispute_documents.rb, line 119 def consult(id) uri = provide_uri(:consult_dispute_document, id) results = HttpClient.post(uri, nil) parse_consults results end
Creates a new dispute document entity.
DisputeDocument
properties:
-
Required
-
type
-
-
Optional
-
tag
-
@param document
[DisputeDocument] model object of the dispute document to be created @param dispute_id
[String] ID of the corresponding dispute @return [DisputeDocument] the newly-created DisputeDocument entity object
# File lib/mangopay/api/service/dispute_documents.rb, line 25 def create(document, dispute_id) uri = provide_uri(:create_dispute_document, dispute_id) response = HttpClient.post(uri, document) parse response end
Retrieves a dispute document entity.
@param id
[String] ID of the dispute document to retrieve @return [DisputeDocument] the requested DisputeDocument entity object
# File lib/mangopay/api/service/dispute_documents.rb, line 61 def get(id) uri = provide_uri(:get_dispute_document, id) response = HttpClient.get(uri) parse response end
Retrieves dispute documents belonging to a certain dispute. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
-
before_date
-
after_date
-
status
-
type
@param id
[String] ID of the dispute whose documents to retrieve @return [Array] corresponding DisputeDocument entity objects
# File lib/mangopay/api/service/dispute_documents.rb, line 83 def of_dispute(id) uri = provide_uri(:get_disputes_documents, id) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_results results end
Submits a dispute document entity for approval
@param id
[String] ID of the dispute document to submit @param dispute_id
[String] ID of the corresponding dispute @return [DisputeDocument] the submitted DisputeDocument entity object
# File lib/mangopay/api/service/dispute_documents.rb, line 50 def submit(id, dispute_id) uri = provide_uri(:submit_dispute_document, dispute_id, id) request = SubmitDocumentRequest.new response = HttpClient.put(uri, request) parse response end
Uploads a dispute document page. Allowed extensions: .pdf .jpeg .jpg .gif .png
@param id
[String] ID of the dispute document entity that the page is being uploaded for @param dispute_id
[String] ID of the corresponding dispute entity @param path
[String] path to the file to upload
# File lib/mangopay/api/service/dispute_documents.rb, line 38 def upload_page(id, dispute_id, path) uri = provide_uri(:upload_dispute_document_page, dispute_id, id) body = UploadFileRequest.new body.file = FileEncoder.encode_base64 path HttpClient.post(uri, body) end
Private Class Methods
Parses a JSON-originating hash into the corresponding DisputeDocument entity object.
@param response
[Hash] JSON-originating data hash @return [DisputeDocument] corresponding DisputeDocument entity object
# File lib/mangopay/api/service/dispute_documents.rb, line 143 def parse(response) MangoModel::DisputeDocument.new.dejsonify response end
Parses an array of JSON-originating hashes into the corresponding DocumentPageConsult objects.
@param consults
[Array] JSON-originating data hashes @return [Array] corresponding DocumentPageConsult objects
# File lib/mangopay/api/service/dispute_documents.rb, line 151 def parse_consults(consults) consults.collect do |consult| MangoModel::DocumentPageConsult.new.dejsonify consult end end
Parses an array of JSON-originating hashes into the corresponding DisputeDocument entity objects.
@param results
[Array] JSON-originating data hashes @return [Array] parsed DisputeDocument entity objects
# File lib/mangopay/api/service/dispute_documents.rb, line 132 def parse_results(results) results.collect do |entity| parse entity end end