Module: HalApi::Representer::UriMethods::ClassMethods

Defined in:
lib/hal_api/representer/uri_methods.rb

Instance Method Summary collapse

Instance Method Details



37
38
39
40
41
42
43
44
# File 'lib/hal_api/representer/uri_methods.rb', line 37

def alternate_link
  link :alternate do
    {
      href: alternate_url(model_path(represented)),
      type: 'text/html'
    }
  end
end


33
34
35
# File 'lib/hal_api/representer/uri_methods.rb', line 33

def profile_link
  link(:profile) { profile_url(represented) }
end


15
16
17
18
19
20
21
22
# File 'lib/hal_api/representer/uri_methods.rb', line 15

def self_link
  link(:self) do
    {
      href: self_url(represented),
      profile: profile_url(represented)
    }
  end
end


24
25
26
27
28
29
30
31
# File 'lib/hal_api/representer/uri_methods.rb', line 24

def vary_link
  link(:vary) do
    {
      href: vary_url(represented) + vary_query_params,
      templated: true,
    } if vary_url(represented).present? && vary_params.present?
  end
end