Class: SatMx::BulkDownload
- Inherits:
-
Object
- Object
- SatMx::BulkDownload
- Defined in:
- lib/sat_mx/bulk_download.rb
Class Method Summary collapse
Instance Method Summary collapse
- #authenticate ⇒ Object
-
#initialize(xml_auth_body:) ⇒ BulkDownload
constructor
A new instance of BulkDownload.
Constructor Details
#initialize(xml_auth_body:) ⇒ BulkDownload
Returns a new instance of BulkDownload.
25 26 27 |
# File 'lib/sat_mx/bulk_download.rb', line 25 def initialize(xml_auth_body:) @xml_auth_body = xml_auth_body end |
Class Method Details
.authenticate(certificate:, private_key:, id: nil) ⇒ Object
19 20 21 22 23 |
# File 'lib/sat_mx/bulk_download.rb', line 19 def self.authenticate(certificate:, private_key:, id: nil) new( xml_auth_body: XmlAuthBody.new(certificate:, private_key:, id:) ).authenticate end |
Instance Method Details
#authenticate ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sat_mx/bulk_download.rb', line 29 def authenticate response = HTTPX.post( AUTH_URL, headers: HEADERS, body: xml_auth_body.sign ) case response.status when 200..299 Result.new(success?: true, value: response.xml) when 400..599 Result.new(success?: false, value: response.xml) else SatMx::Error end end |