Class: JSONAPIonify::Api::Resource::Builders::ResourceIdentiferBuilder
- Inherits:
-
BaseBuilder
- Object
- BaseBuilder
- JSONAPIonify::Api::Resource::Builders::ResourceIdentiferBuilder
- Includes:
- IdentityHelper
- Defined in:
- lib/jsonapionify/api/resource/builders/resource_identifer_builder.rb
Direct Known Subclasses
Constant Summary
Constants included from Structure
Instance Attribute Summary collapse
-
#example_id ⇒ Object
readonly
Returns the value of attribute example_id.
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
Attributes inherited from BaseBuilder
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(resource, instance:) ⇒ ResourceIdentiferBuilder
constructor
A new instance of ResourceIdentiferBuilder.
Methods included from IdentityHelper
Methods inherited from BaseBuilder
Constructor Details
#initialize(resource, instance:) ⇒ ResourceIdentiferBuilder
Returns a new instance of ResourceIdentiferBuilder.
9 10 11 12 13 |
# File 'lib/jsonapionify/api/resource/builders/resource_identifer_builder.rb', line 9 def initialize(resource, instance:) super(resource) @instance = instance @example_id = resource.generate_id end |
Instance Attribute Details
#example_id ⇒ Object (readonly)
Returns the value of attribute example_id.
6 7 8 |
# File 'lib/jsonapionify/api/resource/builders/resource_identifer_builder.rb', line 6 def example_id @example_id end |
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
6 7 8 |
# File 'lib/jsonapionify/api/resource/builders/resource_identifer_builder.rb', line 6 def instance @instance end |
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/jsonapionify/api/resource/builders/resource_identifer_builder.rb', line 15 def build return nil unless instance Objects::ResourceIdentifier.new.tap do |resource| resource[:type] = resource_type (id = build_id) && resource[:id] = id end end |