Sha256: fd004aba96f079f228481cdb91a9281537cfb007178c6f3376da201e631c090a

Contents?: true

Size: 636 Bytes

Versions: 14

Compression:

Stored size: 636 Bytes

Contents

module Shamu
  module JsonApi
    module BuilderMethods
      module Link
        # Write a link  to another resource.
        #
        # @param [String,Symbol] name of the link.
        # @param [String] url
        # @param [Hash] meta optional additional meta information.
        # @return [self]
        def link( name, url, meta: nil )
          links = ( output[:links] ||= {} )

          if meta # rubocop:disable Style/ConditionalAssignment
            links[ name.to_sym ] = { href: url, meta: meta }
          else
            links[ name.to_sym ] = url
          end

          self
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shamu-0.0.24 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.21 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.20 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.19 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.18 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.17 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.15 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.14 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.13 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.11 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.9 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.8 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.7 lib/shamu/json_api/builder_methods/link.rb
shamu-0.0.5 lib/shamu/json_api/builder_methods/link.rb