Class: LedgerSync::Util::ResourcesBuilder
- Inherits:
-
Object
- Object
- LedgerSync::Util::ResourcesBuilder
- Defined in:
- lib/ledger_sync/util/resources_builder.rb
Instance Attribute Summary collapse
-
#cast ⇒ Object
readonly
Returns the value of attribute cast.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#ignore_unrecognized_attributes ⇒ Object
readonly
Returns the value of attribute ignore_unrecognized_attributes.
-
#root_resource_external_id ⇒ Object
readonly
Returns the value of attribute root_resource_external_id.
-
#root_resource_type ⇒ Object
readonly
Returns the value of attribute root_resource_type.
Instance Method Summary collapse
-
#initialize(cast: true, data:, ignore_unrecognized_attributes: false, root_resource_external_id:, root_resource_type:) ⇒ ResourcesBuilder
constructor
A new instance of ResourcesBuilder.
- #resource ⇒ Object
- #resources ⇒ Object
Constructor Details
#initialize(cast: true, data:, ignore_unrecognized_attributes: false, root_resource_external_id:, root_resource_type:) ⇒ ResourcesBuilder
Returns a new instance of ResourcesBuilder.
12 13 14 15 16 17 18 19 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 12 def initialize(cast: true, data:, ignore_unrecognized_attributes: false, root_resource_external_id:, root_resource_type:) @all_resources = {} @cast = cast @data = Util::HashHelpers.deep_symbolize_keys(data) @ignore_unrecognized_attributes = ignore_unrecognized_attributes @root_resource_external_id = root_resource_external_id @root_resource_type = root_resource_type end |
Instance Attribute Details
#cast ⇒ Object (readonly)
Returns the value of attribute cast.
6 7 8 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 6 def cast @cast end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 6 def data @data end |
#ignore_unrecognized_attributes ⇒ Object (readonly)
Returns the value of attribute ignore_unrecognized_attributes.
6 7 8 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 6 def ignore_unrecognized_attributes @ignore_unrecognized_attributes end |
#root_resource_external_id ⇒ Object (readonly)
Returns the value of attribute root_resource_external_id.
6 7 8 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 6 def root_resource_external_id @root_resource_external_id end |
#root_resource_type ⇒ Object (readonly)
Returns the value of attribute root_resource_type.
6 7 8 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 6 def root_resource_type @root_resource_type end |
Instance Method Details
#resource ⇒ Object
21 22 23 24 25 26 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 21 def resource @resource ||= build_resource( external_id: root_resource_external_id, type: root_resource_type ) end |
#resources ⇒ Object
28 29 30 31 32 33 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 28 def resources @resources ||= begin resource @all_resources.values end end |