Class: APIQL::HashEntity

Inherits:
Entity
  • Object
show all
Defined in:
lib/apiql.rb

Instance Attribute Summary

Attributes inherited from Entity

#object

Instance Method Summary collapse

Methods inherited from Entity

all, create, destroy, find, #initialize, #render, update

Constructor Details

This class inherits a constructor from APIQL::Entity

Instance Method Details

#authorize!(*args) ⇒ Object



539
# File 'lib/apiql.rb', line 539

def authorize!(*args); end

#get_field(field, params = nil) ⇒ Object



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# File 'lib/apiql.rb', line 541

def get_field(field, params = nil)
  o = nil

  field.split('.').each do |name|
    if o.nil?
      o = object[name.to_sym] || object[name.to_s]
      break if o.nil?
    else
      if o.respond_to?(name) && (o.methods - Object.methods).include?(name.to_sym)
        o = o.public_send(name)
      else
        o = nil
        break
      end
    end
  end

  o
end