Module: JsonapiCompliable

Defined in:
lib/jsonapi_compliable.rb,
lib/jsonapi_compliable/base.rb,
lib/jsonapi_compliable/query.rb,
lib/jsonapi_compliable/rails.rb,
lib/jsonapi_compliable/scope.rb,
lib/jsonapi_compliable/errors.rb,
lib/jsonapi_compliable/version.rb,
lib/jsonapi_compliable/resource.rb,
lib/jsonapi_compliable/sideload.rb,
lib/jsonapi_compliable/stats/dsl.rb,
lib/jsonapi_compliable/util/hash.rb,
lib/jsonapi_compliable/scoping/base.rb,
lib/jsonapi_compliable/scoping/sort.rb,
lib/jsonapi_compliable/adapters/null.rb,
lib/jsonapi_compliable/stats/payload.rb,
lib/jsonapi_compliable/util/sideload.rb,
lib/jsonapi_compliable/scoping/filter.rb,
lib/jsonapi_compliable/scoping/paginate.rb,
lib/jsonapi_compliable/adapters/abstract.rb,
lib/jsonapi_compliable/util/field_params.rb,
lib/jsonapi_compliable/extensions/temp_id.rb,
lib/jsonapi_compliable/scoping/filterable.rb,
lib/jsonapi_compliable/util/include_params.rb,
lib/jsonapi_compliable/util/render_options.rb,
lib/jsonapi_compliable/scoping/extra_fields.rb,
lib/jsonapi_compliable/adapters/active_record.rb,
lib/jsonapi_compliable/scoping/default_filter.rb,
lib/jsonapi_compliable/util/relationship_payload.rb,
lib/jsonapi_compliable/extensions/extra_attribute.rb,
lib/jsonapi_compliable/extensions/boolean_attribute.rb,
lib/jsonapi_compliable/adapters/active_record_sideloading.rb

Defined Under Namespace

Modules: Adapters, Base, Errors, Extensions, Rails, Scoping, SerializableTempId, Stats, Util Classes: Deserializer, Query, Resource, Scope, Sideload

Constant Summary

VERSION =
"0.10.0"

Class Method Summary collapse

Class Method Details

.contextObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
# File 'lib/jsonapi_compliable.rb', line 48

def self.context
  Thread.current[:context] ||= {}
end

.context=(val) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



53
54
55
# File 'lib/jsonapi_compliable.rb', line 53

def self.context=(val)
  Thread.current[:context] = val
end

.included(klass) ⇒ Object



41
42
43
44
45
# File 'lib/jsonapi_compliable.rb', line 41

def self.included(klass)
  klass.instance_eval do
    include Base
  end
end

.with_context(obj, namespace) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



58
59
60
61
62
63
64
65
66
# File 'lib/jsonapi_compliable.rb', line 58

def self.with_context(obj, namespace)
  begin
    prior = self.context
    self.context = { object: obj, namespace: namespace }
    yield
  ensure
    self.context = prior
  end
end