Class: SatMx::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/sat_mx/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(private_key:, access_token:) ⇒ Client

Returns a new instance of Client.



9
10
11
12
# File 'lib/sat_mx/client.rb', line 9

def initialize(private_key:, access_token:)
  @private_key = private_key
  @access_token = access_token
end

Instance Method Details

#authenticate(payload) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/sat_mx/client.rb', line 14

def authenticate(payload)
  HTTPX.post(
    "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/Autenticacion/Autenticacion.svc",
    headers: {
      "SOAPAction" => "http://DescargaMasivaTerceros.gob.mx/IAutenticacion/Autentica"
    }.merge(HEADERS),
    body: sign(payload)
  )
end

#download_petition(payload) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/sat_mx/client.rb', line 46

def download_petition(payload)
  HTTPX.post(
    "https://cfdidescargamasiva.clouda.sat.gob.mx/DescargaMasivaService.svc",
    headers: {
      "SOAPAction" => "http://DescargaMasivaTerceros.sat.gob.mx/IDescargaMasivaTercerosService/Descargar"
    }.merge(authorization)
    .merge(HEADERS),
    body: sign(payload)
  )
end

#download_request(payload) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/sat_mx/client.rb', line 24

def download_request(payload)
  HTTPX.post(
    "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/SolicitaDescargaService.svc",
    headers: {
      "SOAPAction" => "http://DescargaMasivaTerceros.sat.gob.mx/ISolicitaDescargaService/SolicitaDescarga"
    }.merge(authorization)
    .merge(HEADERS),
    body: sign(payload)
  )
end

#verify_request(payload) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/sat_mx/client.rb', line 35

def verify_request(payload)
  HTTPX.post(
    "https://cfdidescargamasivasolicitud.clouda.sat.gob.mx/VerificaSolicitudDescargaService.svc",
    headers: {
      "SOAPAction" => "http://DescargaMasivaTerceros.sat.gob.mx/IVerificaSolicitudDescargaService/VerificaSolicitudDescarga"
    }.merge(authorization)
    .merge(HEADERS),
    body: sign(payload)
  )
end