Class: SendWithUs::File

Inherits:
Object
  • Object
show all
Defined in:
lib/send_with_us/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_data, opts = {}) ⇒ File

Returns a new instance of File.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/send_with_us/file.rb', line 5

def initialize(file_data, opts = {})
  @attachment = if file_data.is_a?(String)
                  SendWithUs::Attachment.new(file_data)
                else
                  if file_data[:data] and file_data[:id]
                    file_data
                  else
                    SendWithUs::Attachment.new(file_data[:attachment], file_data[:filename])
                  end
                end
end

Instance Attribute Details

#attachmentObject

Returns the value of attribute attachment.



3
4
5
# File 'lib/send_with_us/file.rb', line 3

def attachment
  @attachment
end

Instance Method Details

#to_hObject



17
18
19
# File 'lib/send_with_us/file.rb', line 17

def to_h
  attachment.to_h
end