Exception: Travis::Client::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/travis/client/error.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, message) ⇒ Error

Returns a new instance of Error.



30
31
32
33
# File 'lib/travis/client/error.rb', line 30

def initialize(session, message)
  @entity = self.class.entity_factory.new(session, nil)
  super(message)
end

Instance Attribute Details

#entityObject (readonly)

Returns the value of attribute entity.



28
29
30
# File 'lib/travis/client/error.rb', line 28

def entity
  @entity
end

Class Method Details

.add_attribute(name) ⇒ Object



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

def self.add_attribute(name)
  entity_factory.add_attribute(name)
  define_method(name) { entity.public_send(name) } unless method_defined? name
end

.default_messageObject



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

def self.default_message
  @default_message ||= superclass.default_message
end

.default_message=(message) ⇒ Object



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

def self.default_message=(message)
  @default_message = message
end

.entity_factoryObject



24
25
26
# File 'lib/travis/client/error.rb', line 24

def self.entity_factory
  @entity_factory ||= Class.new(superclass.entity_factory)
end

.for_session(session) ⇒ Object



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

def self.for_session(session)
  self
end

Instance Method Details

#merge!(data) ⇒ Object



35
36
37
# File 'lib/travis/client/error.rb', line 35

def merge!(data)
  entity.merge!(data)
end

#to_entityObject



43
44
45
# File 'lib/travis/client/error.rb', line 43

def to_entity
  entity
end

#to_hObject



39
40
41
# File 'lib/travis/client/error.rb', line 39

def to_h
  entity.to_h
end