Exception: Travis::Client::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Travis::Client::Error
- Defined in:
- lib/travis/client/error.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
Class Method Summary collapse
- .add_attribute(name) ⇒ Object
- .default_message ⇒ Object
- .default_message=(message) ⇒ Object
- .entity_factory ⇒ Object
- .for_session(session) ⇒ Object
Instance Method Summary collapse
-
#initialize(session, message) ⇒ Error
constructor
A new instance of Error.
- #merge!(data) ⇒ Object
- #to_entity ⇒ Object
- #to_h ⇒ Object
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, ) @entity = self.class.entity_factory.new(session, nil) super() end |
Instance Attribute Details
#entity ⇒ Object (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_message ⇒ Object
20 21 22 |
# File 'lib/travis/client/error.rb', line 20 def self. @default_message ||= superclass. end |
.default_message=(message) ⇒ Object
12 13 14 |
# File 'lib/travis/client/error.rb', line 12 def self.() @default_message = end |
.entity_factory ⇒ Object
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_entity ⇒ Object
43 44 45 |
# File 'lib/travis/client/error.rb', line 43 def to_entity entity end |
#to_h ⇒ Object
39 40 41 |
# File 'lib/travis/client/error.rb', line 39 def to_h entity.to_h end |