File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
src/Picqer/Carriers/SendCloud Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -250,5 +250,22 @@ public function setEnvironment($environment)
250250 $ this ->environment = $ environment ;
251251 }
252252
253+ /**
254+ * Download a resource.
255+ *
256+ * @param string $url
257+ *
258+ * @return string
259+ */
260+ public function download ($ url )
261+ {
262+ try {
263+ $ result = $ this ->client ()->get ($ url );
264+ } catch (RequestException $ e ) {
265+ throw new SendCloudApiException ('SendCloud error: (no error message provided) ' . $ e ->getResponse ());
266+ }
267+
268+ return $ result ->getBody ()->getContents ();
269+ }
253270}
254271
Original file line number Diff line number Diff line change @@ -16,4 +16,15 @@ class Label extends Model {
1616 'plural ' => 'labels '
1717 ];
1818
19- }
19+ /**
20+ * Returns the label content (PDF) in A6 format.
21+ *
22+ * @return string
23+ */
24+ public function labelPrinterContent ()
25+ {
26+ $ url = str_replace ($ this ->connection ->apiUrl (), '' , $ this ->label_printer );
27+
28+ return $ this ->connection ->download ($ url );
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments