Class: DHS::Item

Inherits:
Proxy show all
Includes:
Create, Destroy, Save, Update, Validation
Defined in:
lib/dhs/item.rb,
lib/dhs/concerns/item/save.rb,
lib/dhs/concerns/item/update.rb,
lib/dhs/concerns/item/destroy.rb,
lib/dhs/concerns/item/validation.rb,
lib/dhs/concerns/item/endpoint_lookup.rb

Overview

An item is a concrete record. It can be part of another proxy like collection.

Defined Under Namespace

Modules: Destroy, EndpointLookup, Save, Update, Validation

Constant Summary

Constants included from Proxy::Accessors

Proxy::Accessors::BLACKLISTED_KEYWORDS

Instance Attribute Summary

Attributes inherited from Proxy

#_data, #_loaded

Instance Method Summary collapse

Methods included from Validation

#valid?

Methods included from Update

#partial_update, #partial_update!, #update, #update!

Methods included from Save

#save, #save!

Methods included from Destroy

#destroy

Methods inherited from Proxy

#initialize, #load!, #record, #reload!

Methods included from Proxy::Create

#create, #create!

Methods included from Proxy::Accessors

#clear_cache!

Constructor Details

This class inherits a constructor from DHS::Proxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, **_keyword_args, &_block) ⇒ Object (protected)



43
44
45
46
# File 'lib/dhs/item.rb', line 43

def method_missing(name, *args, **_keyword_args, &_block)
  return set(name, args) if name.to_s[/=$/]
  get(name, *args)
end

Instance Method Details

#collection?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/dhs/item.rb', line 25

def collection?
  false
end

#item?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/dhs/item.rb', line 29

def item?
  true
end

#respond_to?(sym, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
37
38
39
# File 'lib/dhs/item.rb', line 33

def respond_to?(sym, include_all = false)
  if sym == :to_ary
    false
  else
    super(sym, include_all)
  end
end