Class: Facturae::Subject

Inherits:
Object
  • Object
show all
Includes:
Validatable
Defined in:
lib/facturae/models/subject.rb

Overview

Represents a legal subject, either an individual or a legal entity.

Constant Summary collapse

INDIVIDUAL =
:individual
:legal
SUBJECT_TYPES =
[INDIVIDUAL, LEGAL].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validatable

#errors, #valid?

Constructor Details

#initialize(type:, name_field1:, name_field2: nil, name_field3: nil, address_in_spain: Address.new) ⇒ Subject

Returns a new instance of Subject.



24
25
26
27
28
29
30
# File 'lib/facturae/models/subject.rb', line 24

def initialize(type:, name_field1:, name_field2: nil, name_field3: nil, address_in_spain: Address.new)
  @type = type
  @name_field1 = name_field1
  @name_field2 = name_field2
  @name_field3 = name_field3
  @address_in_spain = address_in_spain
end

Instance Attribute Details

#address_in_spainFacturae::Address

The address in Spain.

Returns:



10
11
12
# File 'lib/facturae/models/subject.rb', line 10

def address_in_spain
  @address_in_spain
end

#name_field1String

The first name field.

Returns:

  • (String)

    the current value of name_field1



10
11
12
# File 'lib/facturae/models/subject.rb', line 10

def name_field1
  @name_field1
end

#name_field2String

The second name field.

Returns:

  • (String)

    the current value of name_field2



10
11
12
# File 'lib/facturae/models/subject.rb', line 10

def name_field2
  @name_field2
end

#name_field3Object

Returns the value of attribute name_field3.



17
18
19
# File 'lib/facturae/models/subject.rb', line 17

def name_field3
  @name_field3
end

#overseas_addressFacturae::Address

The overseas address. Optional.

Returns:



10
11
12
# File 'lib/facturae/models/subject.rb', line 10

def overseas_address
  @overseas_address
end

#typeSymbol

The type of subject.

Returns:

  • (Symbol)

    the current value of type



10
11
12
# File 'lib/facturae/models/subject.rb', line 10

def type
  @type
end