Class: SatMx::DownloadRequest Private

Inherits:
Object
  • Object
show all
Defined in:
lib/sat_mx/download_request.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.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(download_request_body:, client:) ⇒ DownloadRequest

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 DownloadRequest.



27
28
29
30
# File 'lib/sat_mx/download_request.rb', line 27

def initialize(download_request_body:, client:)
  @download_request_body = download_request_body
  @client = client
end

Class Method Details

.call(start_date:, end_date:, request_type:, issuing_rfc:, recipient_rfcs:, requester_rfc:, access_token:, certificate:, private_key:) ⇒ Object

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.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sat_mx/download_request.rb', line 4

def self.call(start_date:,
  end_date:,
  request_type:,
  issuing_rfc:,
  recipient_rfcs:,
  requester_rfc:,
  access_token:,
  certificate:,
  private_key:)
  new(
    download_request_body: DownloadRequestBody.new(
      start_date:,
      end_date:,
      request_type:,
      issuing_rfc:,
      recipient_rfcs:,
      requester_rfc:,
      certificate:
    ),
    client: Client.new(private_key:, access_token:)
  ).call
end

Instance Method Details

#callObject

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.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sat_mx/download_request.rb', line 32

def call
  response = client.download_request(download_request_body.generate)

  case response.status
  when 200..299
    check_body_status response.xml
  when 400..599
    Result.new(success?: false, value: nil, xml: response.xml)
  else
    SatMx::Error
  end
end