Module: Jat::Plugins::JsonApi::Map::InstanceMethods
- Included in:
- Jat::Plugins::JsonApi::Map
- Defined in:
- lib/jat/plugins/json_api/lib/map.rb
Constant Summary collapse
- EXPOSED_TYPES =
{all: :all, default: :default, none: :none}.freeze
Instance Attribute Summary collapse
-
#exposed ⇒ Object
readonly
Returns the value of attribute exposed.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
-
#jat_class ⇒ Object
readonly
Returns the value of attribute jat_class.
Instance Method Summary collapse
Instance Attribute Details
#exposed ⇒ Object (readonly)
Returns the value of attribute exposed.
35 36 37 |
# File 'lib/jat/plugins/json_api/lib/map.rb', line 35 def exposed @exposed end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
35 36 37 |
# File 'lib/jat/plugins/json_api/lib/map.rb', line 35 def fields @fields end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
35 36 37 |
# File 'lib/jat/plugins/json_api/lib/map.rb', line 35 def includes @includes end |
#jat_class ⇒ Object (readonly)
Returns the value of attribute jat_class.
35 36 37 |
# File 'lib/jat/plugins/json_api/lib/map.rb', line 35 def jat_class @jat_class end |
Instance Method Details
#initialize(exposed, fields, includes) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/jat/plugins/json_api/lib/map.rb', line 39 def initialize(exposed, fields, includes) @jat_class = self.class.jat_class @exposed = EXPOSED_TYPES.fetch(exposed) @fields = fields @includes = includes end |
#to_h ⇒ Object
46 47 48 49 50 |
# File 'lib/jat/plugins/json_api/lib/map.rb', line 46 def to_h map = {} append_map(map, jat_class) map end |