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



22
23
24
25
26
# File 'lib/travis/client/weak_entity.rb', line 22

def self.cast_id(object)
  return object if id? object

  raise 'weak entities do not have id fields'
end

.id?(object) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/travis/client/weak_entity.rb', line 18

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

.id_fieldObject



14
15
16
# File 'lib/travis/client/weak_entity.rb', line 14

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

.weak?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/travis/client/weak_entity.rb', line 10

def self.weak?
  true
end