Class: Travis::Client::WeakEntity

Inherits:
Entity
  • Object
show all
Includes:
NotLoadable
Defined in:
lib/travis/client/weak_entity.rb

Direct Known Subclasses

Cache, Request, Settings

Constant Summary

Constants inherited from Entity

Entity::MAP

Instance Attribute Summary

Attributes inherited from Entity

#attributes, #curry, #id, #session

Class Method Summary collapse

Methods included from NotLoadable

#complete?, #missing?

Methods inherited from Entity

#[], #[]=, aka, #attribute_names, attributes, base_path, #cancelable?, #complete?, has, has_singleton, #include?, #initialize, #inspect, inspect_info, #load, many, #missing?, one, preloadable, preloadable?, relations, #relations, #reload, #restartable?, subclass_for, subclasses, time, #to_h, #update_attributes

Constructor Details

This class inherits a constructor from Travis::Client::Entity

Class Method Details

.cast_id(object) ⇒ Object



20
21
22
23
# File 'lib/travis/client/weak_entity.rb', line 20

def self.cast_id(object)
  return object if id? object
  raise "weak entities do not have id fields"
end

.id?(object) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/travis/client/weak_entity.rb', line 16

def self.id?(object)
  object.nil?
end

.id_fieldObject



12
13
14
# File 'lib/travis/client/weak_entity.rb', line 12

def self.id_field
  raise "weak entities do not have id fields"
end

.weak?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/travis/client/weak_entity.rb', line 8

def self.weak?
  true
end