Class: Inttegro::Resources::FileLinks
- Inherits:
-
Object
- Object
- Inttegro::Resources::FileLinks
- Defined in:
- lib/inttegro/resources/file_links.rb
Instance Method Summary collapse
- #create(payload, idempotency_key: nil) ⇒ Object
-
#initialize(http) ⇒ FileLinks
constructor
A new instance of FileLinks.
- #lookup(id:) ⇒ Object
- #open(url, save_to: nil) ⇒ Object
- #page(payload = {}) ⇒ Object
- #revoke(payload, idempotency_key: nil) ⇒ Object
Constructor Details
#initialize(http) ⇒ FileLinks
Returns a new instance of FileLinks.
7 8 9 |
# File 'lib/inttegro/resources/file_links.rb', line 7 def initialize(http) @http = T.let(http, Inttegro::HTTPClient) end |
Instance Method Details
#create(payload, idempotency_key: nil) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/inttegro/resources/file_links.rb', line 11 def create(payload, idempotency_key: nil) @http.post_model( "/file_links/create", Inttegro::FileLinkCreation, payload, headers: headers(idempotency_key) ) end |
#lookup(id:) ⇒ Object
20 21 22 |
# File 'lib/inttegro/resources/file_links.rb', line 20 def lookup(id:) @http.post_resource("/file_links/lookup", Inttegro::FileLink, :file_link, { id: id }) end |
#open(url, save_to: nil) ⇒ Object
35 36 37 38 39 |
# File 'lib/inttegro/resources/file_links.rb', line 35 def open(url, save_to: nil) download = @http.get_binary_public(url) download.save_to(save_to) if save_to download end |
#page(payload = {}) ⇒ Object
24 25 26 |
# File 'lib/inttegro/resources/file_links.rb', line 24 def page(payload = {}) @http.post_resource("/file_links/page", Inttegro::FileLinkPage, :page, payload || {}) end |