Class: Eversign::Models::File

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/eversign/models/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ File

Returns a new instance of File.



11
12
13
# File 'lib/eversign/models/file.rb', line 11

def initialize(name=nil)
	self.name = name
end

Instance Attribute Details

#file_base64Object

Returns the value of attribute file_base64.



7
8
9
# File 'lib/eversign/models/file.rb', line 7

def file_base64
  @file_base64
end

#file_idObject

Returns the value of attribute file_id.



7
8
9
# File 'lib/eversign/models/file.rb', line 7

def file_id
  @file_id
end

#file_urlObject

Returns the value of attribute file_url.



7
8
9
# File 'lib/eversign/models/file.rb', line 7

def file_url
  @file_url
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/eversign/models/file.rb', line 7

def name
  @name
end

#pagesObject

Returns the value of attribute pages.



7
8
9
# File 'lib/eversign/models/file.rb', line 7

def pages
  @pages
end

#total_pagesObject

Returns the value of attribute total_pages.



7
8
9
# File 'lib/eversign/models/file.rb', line 7

def total_pages
  @total_pages
end

Instance Method Details

#only_one_optionObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/eversign/models/file.rb', line 15

def only_one_option()
  error = false
  if file_id && !file_id.empty?
    error = file_url || file_base64
  elsif file_url && !file_url.empty?
    error = file_id || file_base64
  elsif file_base64 && !file_base64.empty?
    error = file_id || file_url
  else
    error = true
  end
  errors.add('Please provide only one file option') if error
end