Class: SatMx::DownloadRequestBody Private

Inherits:
Object
  • Object
show all
Includes:
Body
Defined in:
lib/sat_mx/download_request_body.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

REQUEST_TYPES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  cfdi: "CFDI",
  metadata: "Metadata"
}.freeze

Constants included from Body

Body::DES, Body::DS, Body::ENVELOPE_ATTRS, Body::NAMESPACE, Body::S11, Body::XMLNS

Instance Method Summary collapse

Constructor Details

#initialize(start_date:, end_date:, request_type:, issuing_rfc:, recipient_rfcs:, requester_rfc:, certificate:) ⇒ DownloadRequestBody

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DownloadRequestBody.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/sat_mx/download_request_body.rb', line 13

def initialize(start_date:,
  end_date:,
  request_type:,
  issuing_rfc:,
  recipient_rfcs:,
  requester_rfc:,
  certificate:)
  @start_date = start_date
  @end_date = end_date
  @request_type = request_type
  @issuing_rfc = issuing_rfc
  @recipient_rfcs = recipient_rfcs
  @requester_rfc = requester_rfc
  @certificate = certificate
end

Instance Method Details

#generateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/sat_mx/download_request_body.rb', line 29

def generate
  envelope do |xml|
    xml[Body::DES].SolicitaDescarga do
      xml[Body::DES].solicitud(
        "FechaInicial" => start_date,
        "FechaFinal" => end_date,
        "RfcEmisor" => issuing_rfc,
        "RfcSolicitante" => requester_rfc,
        "TipoSolicitud" => request_type
      ) do
        xml[Body::DES].RfcReceptores do
          @recipient_rfcs.each do |rfc|
            xml[Body::DES].RfcReceptor(rfc)
          end
        end
        signature(xml)
      end
    end
  end
end