Class: JSONAPI::CachedResponseFragment::Write
- Inherits:
-
Struct
- Object
- Struct
- JSONAPI::CachedResponseFragment::Write
- Defined in:
- lib/jsonapi/cached_response_fragment.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#context_key ⇒ Object
Returns the value of attribute context_key.
-
#relationship_data ⇒ Object
Returns the value of attribute relationship_data.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#resource_klass ⇒ Object
Returns the value of attribute resource_klass.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
-
#serializer_config_key ⇒ Object
Returns the value of attribute serializer_config_key.
Instance Method Summary collapse
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context
17 18 19 |
# File 'lib/jsonapi/cached_response_fragment.rb', line 17 def context @context end |
#context_key ⇒ Object
Returns the value of attribute context_key
17 18 19 |
# File 'lib/jsonapi/cached_response_fragment.rb', line 17 def context_key @context_key end |
#relationship_data ⇒ Object
Returns the value of attribute relationship_data
17 18 19 |
# File 'lib/jsonapi/cached_response_fragment.rb', line 17 def relationship_data @relationship_data end |
#resource ⇒ Object
Returns the value of attribute resource
17 18 19 |
# File 'lib/jsonapi/cached_response_fragment.rb', line 17 def resource @resource end |
#resource_klass ⇒ Object
Returns the value of attribute resource_klass
17 18 19 |
# File 'lib/jsonapi/cached_response_fragment.rb', line 17 def resource_klass @resource_klass end |
#serializer ⇒ Object
Returns the value of attribute serializer
17 18 19 |
# File 'lib/jsonapi/cached_response_fragment.rb', line 17 def serializer @serializer end |
#serializer_config_key ⇒ Object
Returns the value of attribute serializer_config_key
17 18 19 |
# File 'lib/jsonapi/cached_response_fragment.rb', line 17 def serializer_config_key @serializer_config_key end |
Instance Method Details
#to_key_value ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jsonapi/cached_response_fragment.rb', line 18 def to_key_value (id, cache_key) = resource.cache_id json = serializer.object_hash(resource, relationship_data) cr = CachedResponseFragment.new( resource_klass, id, json['type'], context, resource.fetchable_fields, json['relationships'], json['links'], json['attributes'], json['meta'] ) key = [resource_klass._type, id, cache_key, serializer_config_key, context_key] [key, cr] end |