Class: RoadForest::Augment::Affordance::PayloadAugmentation

Inherits:
RoadForest::Augment::Augmentation show all
Includes:
GrantTokens
Defined in:
lib/roadforest/augment/affordance.rb

Direct Known Subclasses

Create, Update

Instance Method Summary collapse

Methods included from GrantTokens

#each_grant_token

Methods inherited from RoadForest::Augment::Augmentation

#canonical_uri, #initialize, object_follows, object_precedes, register_for_objects, register_for_subjects, #router, subject_follows, subject_precedes

Constructor Details

This class inherits a constructor from RoadForest::Augment::Augmentation

Instance Method Details

#affordance_typeObject



86
87
88
# File 'lib/roadforest/augment/affordance.rb', line 86

def affordance_type

end

#applicable?(resource) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/roadforest/augment/affordance.rb', line 82

def applicable?(resource)

end

#apply(term) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/roadforest/augment/affordance.rb', line 94

def apply(term)
  resource = term.resource
  if applicable?(resource)
    node = ::RDF::Node.new
    yield [node, ::RDF.type, affordance_type]
    yield [node, Af.target, term.uri]
    each_grant_token(http_method, term) do |token|
      yield [node, Af.authorizedBy, token]
    end
    payload = get_payload(resource)
    unless payload.nil?
      yield [node, Af.payload, payload.root]
      unless payload.graph.nil?
        payload.graph.each_statement do |stmt|
          yield stmt
        end
      end
    end
  end
end

#get_payload(resource) ⇒ Object



78
79
80
# File 'lib/roadforest/augment/affordance.rb', line 78

def get_payload(resource)

end