Module: Shamu::JsonApi::BuilderMethods::Link
- Included in:
- Shamu::JsonApi::BaseBuilder, ErrorBuilder
- Defined in:
- lib/shamu/json_api/builder_methods/link.rb
Instance Method Summary collapse
-
#link(name, url, meta: nil) ⇒ self
Write a link to another resource.
Instance Method Details
#link(name, url, meta: nil) ⇒ self
Write a link to another resource.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/shamu/json_api/builder_methods/link.rb', line 11 def link( name, url, meta: nil ) links = ( output[:links] ||= {} ) if # rubocop:disable Style/ConditionalAssignment links[ name.to_sym ] = { href: url, meta: } else links[ name.to_sym ] = url end self end |