Class: Bunq::Attachments
- Inherits:
-
Object
- Object
- Bunq::Attachments
- Defined in:
- lib/bunq/attachments.rb
Instance Method Summary collapse
- #create(binary_payload, description, mime_type) ⇒ Object
-
#initialize(parent_resource) ⇒ Attachments
constructor
A new instance of Attachments.
Constructor Details
#initialize(parent_resource) ⇒ Attachments
Returns a new instance of Attachments.
7 8 9 |
# File 'lib/bunq/attachments.rb', line 7 def initialize(parent_resource) @resource = parent_resource.append('/attachment') end |
Instance Method Details
#create(binary_payload, description, mime_type) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/bunq/attachments.rb', line 11 def create(binary_payload, description, mime_type) custom_headers = { Bunq::Header::CONTENT_TYPE => mime_type, Bunq::Header::ATTACHMENT_DESCRIPTION => description, } payload = Base64.decode64(binary_payload) @resource.with_session { @resource.post(payload, custom_headers: custom_headers) }['Response'] end |