Module: Immobilienscout24::Api::Attachment
- Included in:
- Immobilienscout24::Api
- Defined in:
- lib/immobilienscout24/api/attachment.rb
Overview
Methods for the Attachment API
For all methods you must provide the immoscout estate id in the options hash.
Per default the client will use the current user (‘me`). If you want to use an other user then you have to provide the id in the options hash.
Instance Method Summary collapse
-
#attachment(id, options = {}) ⇒ Hashie::Mash
Get an attachment by id.
-
#attachment_endpoint(resource, options = {}) ⇒ String
Generates the attachment endpoint.
-
#attachments(options = {}) ⇒ Hashie::Mash
Get a list of all attachments.
-
#create_attachment(metadata, attachment, options = {}) ⇒ Hashie::Mash
Create an attachment.
-
#delete_attachment(id, options = {}) ⇒ Hashie::Mash
Delete an attachment.
- #estate_attachment_endpoint(estate, resource, options = {}) ⇒ Object
-
#update_attachment(id, attachment, options = {}) ⇒ Hashie::Mash
Update an attachment.
Instance Method Details
#attachment(id, options = {}) ⇒ Hashie::Mash
Get an attachment by id
40 41 42 |
# File 'lib/immobilienscout24/api/attachment.rb', line 40 def (id, = {}) get ("/attachment/#{id}", ) end |
#attachment_endpoint(resource, options = {}) ⇒ String
Generates the attachment endpoint
94 95 96 97 |
# File 'lib/immobilienscout24/api/attachment.rb', line 94 def (resource, = {}) estate = .fetch(:estate) (estate, resource, ) end |
#attachments(options = {}) ⇒ Hashie::Mash
Get a list of all attachments
28 29 30 |
# File 'lib/immobilienscout24/api/attachment.rb', line 28 def ( = {}) get ("/attachment", ) end |
#create_attachment(metadata, attachment, options = {}) ⇒ Hashie::Mash
Create an attachment
53 54 55 56 57 58 59 60 |
# File 'lib/immobilienscout24/api/attachment.rb', line 53 def (, , = {}) = ::Immobilienscout24::Helper::Attachment.new() multipart = {metadata: , attachment: .build} (multipart: true) do |client| client.post ("/attachment", ), multipart end end |
#delete_attachment(id, options = {}) ⇒ Hashie::Mash
Delete an attachment
83 84 85 |
# File 'lib/immobilienscout24/api/attachment.rb', line 83 def (id, = {}) delete ("/attachment/#{id}", ) end |
#estate_attachment_endpoint(estate, resource, options = {}) ⇒ Object
99 100 101 |
# File 'lib/immobilienscout24/api/attachment.rb', line 99 def (estate, resource, = {}) [real_estate_endpoint("/realestate/#{estate}", ), resource].join end |
#update_attachment(id, attachment, options = {}) ⇒ Hashie::Mash
Update an attachment
71 72 73 |
# File 'lib/immobilienscout24/api/attachment.rb', line 71 def (id, , = {}) put ("/attachment/#{id}", ), end |