Module: RoadForest::Augment::Affordance::GrantTokens

Included in:
Links, PayloadAugmentation, Remove
Defined in:
lib/roadforest/augment/affordance.rb

Instance Method Summary collapse

Instance Method Details

#each_grant_token(method, term) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/roadforest/augment/affordance.rb', line 10

def each_grant_token(method, term)
  grant_route = term.router.mapped_route_for_name(term.route.name, :perm, {})
  term.resource.required_grants(method).each do |grant|
    grant_path = grant_route.build_path(:grant_name => grant)
    yield ::RDF::URI.new(canonical_uri.join(grant_path)) #XXX magical route name
  end
rescue KeyError
  term.resource.required_grants(method).each do |grant|
    yield grant
  end
end