Class: Fintoc::V2::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/fintoc/v2/resources/entity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object:, mode:, id:, holder_name:, holder_id:, is_root:, client: nil) ⇒ Entity

Returns a new instance of Entity.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fintoc/v2/resources/entity.rb', line 6

def initialize(
  object:,
  mode:,
  id:,
  holder_name:,
  holder_id:,
  is_root:,
  client: nil,
  **
)
  @object = object
  @mode = mode
  @id = id
  @holder_name = holder_name
  @holder_id = holder_id
  @is_root = is_root
  @client = client
end

Instance Attribute Details

#holder_idObject (readonly)

Returns the value of attribute holder_id.



4
5
6
# File 'lib/fintoc/v2/resources/entity.rb', line 4

def holder_id
  @holder_id
end

#holder_nameObject (readonly)

Returns the value of attribute holder_name.



4
5
6
# File 'lib/fintoc/v2/resources/entity.rb', line 4

def holder_name
  @holder_name
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/fintoc/v2/resources/entity.rb', line 4

def id
  @id
end

#is_rootObject (readonly)

Returns the value of attribute is_root.



4
5
6
# File 'lib/fintoc/v2/resources/entity.rb', line 4

def is_root
  @is_root
end

#modeObject (readonly)

Returns the value of attribute mode.



4
5
6
# File 'lib/fintoc/v2/resources/entity.rb', line 4

def mode
  @mode
end

#objectObject (readonly)

Returns the value of attribute object.



4
5
6
# File 'lib/fintoc/v2/resources/entity.rb', line 4

def object
  @object
end

Instance Method Details

#refreshObject



29
30
31
32
# File 'lib/fintoc/v2/resources/entity.rb', line 29

def refresh
  fresh_entity = @client.entities.get(@id)
  refresh_from_entity(fresh_entity)
end

#to_sObject



25
26
27
# File 'lib/fintoc/v2/resources/entity.rb', line 25

def to_s
  "🏢 #{@holder_name} (#{@id})"
end