class Safrano::NilNavigationAttribute

Represents a named but nil-valued navigation-attribute of an Entity (usually resulting from a NULL FK db value)

Public Instance Methods

==(other) click to toggle source

for testing purpose (assert_equal …)

# File lib/odata/navigation_attribute.rb, line 114
def ==(other)
  (@nav_parent == other.nav_parent) && (@nav_name == other.nav_name)
end
odata_get(req) click to toggle source
# File lib/odata/navigation_attribute.rb, line 82
def odata_get(req)
  if req.walker.media_value
    Safrano::ErrorNotFound.odata_get
  elsif req.accept?(APPJSON)
    [200, EMPTY_HASH, to_odata_json(service: req.service)]
  else # TODO: other formats
    415
  end
end
odata_post(req) click to toggle source

create the nav. entity

# File lib/odata/navigation_attribute.rb, line 93
def odata_post(req)
  # delegate to the class method
  @nav_klass.odata_create_entity_and_relation(req,
                                              @navattr_reflection,
                                              @nav_parent)
end
odata_put(req) click to toggle source

create the nav. entity

# File lib/odata/navigation_attribute.rb, line 101
def odata_put(req)
  # delegate to the class method
  @nav_klass.odata_create_entity_and_relation(req,
                                              @navattr_reflection,
                                              @nav_parent)
end
to_odata_json(*) click to toggle source

empty output as OData json (v2)

# File lib/odata/navigation_attribute.rb, line 109
def to_odata_json(*)
  { 'd' => EMPTY_HASH }.to_json
end