Module: Shamu::JsonApi::BuilderMethods::Identifier
- Included in:
- RelationshipBuilder, ResourceBuilder
- Defined in:
- lib/shamu/json_api/builder_methods/identifier.rb
Instance Method Summary collapse
-
#compile ⇒ Hash
The results output as JSON safe hash.
-
#identifier(type, id = :not_set) ⇒ self
Write a resource linkage info.
Instance Method Details
#compile ⇒ Hash
Returns the results output as JSON safe hash.
24 25 26 27 |
# File 'lib/shamu/json_api/builder_methods/identifier.rb', line 24 def compile require_identifier! super end |
#identifier(type, id = :not_set) ⇒ self
Write a resource linkage info.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/shamu/json_api/builder_methods/identifier.rb', line 10 def identifier( type, id = :not_set ) output[:type] = @type = json_type( type ) output[:id] = if id == :not_set type.id if type.respond_to?( :id ) else id.to_s end self end |