Class: FidorApi::Message

Inherits:
Connectivity::Resource show all
Extended by:
AmountAttributes, ModelAttribute
Defined in:
lib/fidor_api/message.rb

Defined Under Namespace

Modules: ClientSupport Classes: Attachment

Instance Attribute Summary

Attributes inherited from Connectivity::Resource

#error_keys

Instance Method Summary collapse

Methods included from AmountAttributes

amount_attribute, attributes, extended

Methods inherited from Connectivity::Resource

all, find, #initialize, model_name, #persisted?, #reload, #save, #update_attributes

Constructor Details

This class inherits a constructor from FidorApi::Connectivity::Resource

Instance Method Details

#attachmentObject



21
22
23
24
25
26
27
28
# File 'lib/fidor_api/message.rb', line 21

def attachment
  response = endpoint.for(self).get(action: 'attachment')
  Attachment.new(
    type:     response.headers["content-type"],
    filename: response.headers["content-disposition"][/filename="([^"]+)"/, 1],
    content:  response.body,
  )
end

#contentObject



30
31
32
# File 'lib/fidor_api/message.rb', line 30

def content
  endpoint.for(self).get(action: 'content').body
end