Class: Flapjack::Gateways::JSONAPI::Data::JoinDescriptor
- Inherits:
-
Object
- Object
- Flapjack::Gateways::JSONAPI::Data::JoinDescriptor
- Defined in:
- lib/flapjack/gateways/jsonapi/data/join_descriptor.rb
Instance Attribute Summary collapse
-
#association_data ⇒ Object
Returns the value of attribute association_data.
-
#delete ⇒ Object
readonly
Returns the value of attribute delete.
-
#descriptions ⇒ Object
readonly
Returns the value of attribute descriptions.
-
#get ⇒ Object
readonly
Returns the value of attribute get.
-
#includable ⇒ Object
readonly
Returns the value of attribute includable.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
-
#post ⇒ Object
readonly
Returns the value of attribute post.
Instance Method Summary collapse
- #data_klass ⇒ Object
-
#initialize(opts = {}) ⇒ JoinDescriptor
constructor
A new instance of JoinDescriptor.
- #lock_klasses ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ JoinDescriptor
Returns a new instance of JoinDescriptor.
16 17 18 19 20 21 22 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 16 def initialize(opts = {}) @association_data = nil %w{post get patch delete number link includable type klass callback_classes descriptions}.each do |a| instance_variable_set("@#{a}", opts[a.to_sym]) end @callback_classes ||= [] end |
Instance Attribute Details
#association_data ⇒ Object
Returns the value of attribute association_data.
14 15 16 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 14 def association_data @association_data end |
#delete ⇒ Object (readonly)
Returns the value of attribute delete.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def delete @delete end |
#descriptions ⇒ Object (readonly)
Returns the value of attribute descriptions.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def descriptions @descriptions end |
#get ⇒ Object (readonly)
Returns the value of attribute get.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def get @get end |
#includable ⇒ Object (readonly)
Returns the value of attribute includable.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def includable @includable end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def klass @klass end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def link @link end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def number @number end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def patch @patch end |
#post ⇒ Object (readonly)
Returns the value of attribute post.
13 14 15 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 13 def post @post end |
Instance Method Details
#data_klass ⇒ Object
33 34 35 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 33 def data_klass @association_data.nil? ? @klass : @association_data.data_klass end |
#lock_klasses ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 24 def lock_klasses if @association_data.nil? [@klass] | @callback_classes else [@association_data.data_klass] | @association_data. | @callback_classes end end |
#type ⇒ Object
37 38 39 |
# File 'lib/flapjack/gateways/jsonapi/data/join_descriptor.rb', line 37 def type @association_data.nil? ? @type : data_klass.short_model_name.singular end |