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.
-
#ledger ⇒ Object
readonly
Returns the value of attribute ledger.
-
#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(args = {}) ⇒ ResourcesBuilder
constructor
A new instance of ResourcesBuilder.
- #resource ⇒ Object
- #resources ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ ResourcesBuilder
Returns a new instance of ResourcesBuilder.
13 14 15 16 17 18 19 20 21 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 13 def initialize(args = {}) @all_resources = {} @ledger = args.fetch(:ledger) @cast = args.fetch(:cast, true) @data = Util::HashHelpers.deep_symbolize_keys(args.fetch(:data)) @ignore_unrecognized_attributes = args.fetch(:ignore_unrecognized_attributes, false) @root_resource_external_id = args.fetch(:root_resource_external_id) @root_resource_type = args.fetch(: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 |
#ledger ⇒ Object (readonly)
Returns the value of attribute ledger.
6 7 8 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 6 def ledger @ledger 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
23 24 25 26 27 28 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 23 def resource @resource ||= build_resource( external_id: root_resource_external_id, type: root_resource_type ) end |
#resources ⇒ Object
30 31 32 33 34 35 |
# File 'lib/ledger_sync/util/resources_builder.rb', line 30 def resources @resources ||= begin resource @all_resources.values end end |