Class: Mondo::Attachment

Inherits:
Resource show all
Defined in:
lib/api/mondo/attachment.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#client, #raw_data

Instance Method Summary collapse

Methods inherited from Resource

boolean_accessor, boolean_reader, date_accessor, date_writer, #initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from Mondo::Resource

Instance Attribute Details

#external_idObject

Returns the value of attribute external_id.



3
4
5
# File 'lib/api/mondo/attachment.rb', line 3

def external_id
  @external_id
end

#file_typeObject

Returns the value of attribute file_type.



3
4
5
# File 'lib/api/mondo/attachment.rb', line 3

def file_type
  @file_type
end

#file_urlObject

Returns the value of attribute file_url.



3
4
5
# File 'lib/api/mondo/attachment.rb', line 3

def file_url
  @file_url
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/api/mondo/attachment.rb', line 3

def id
  @id
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/api/mondo/attachment.rb', line 3

def type
  @type
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/api/mondo/attachment.rb', line 3

def url
  @url
end

#user_idObject

Returns the value of attribute user_id.



3
4
5
# File 'lib/api/mondo/attachment.rb', line 3

def user_id
  @user_id
end

Instance Method Details

#deregisterObject



14
15
16
# File 'lib/api/mondo/attachment.rb', line 14

def deregister
  self.client.api_post("attachment/deregister", id: self.id)
end

#registerObject

Raises:



8
9
10
11
12
# File 'lib/api/mondo/attachment.rb', line 8

def register
	raise  ClientError.new("You have already registered this attachment") unless self.id.nil?

	self.client.api_post("attachment/register", registration_data)
end

#registration_dataObject



18
19
20
21
22
23
24
# File 'lib/api/mondo/attachment.rb', line 18

def registration_data
  {
    external_id: self.external_id,
    file_url: self.file_url,
    file_type: self.file_type,
  }
end