Exception: RallyUp::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rally_up.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



56
57
58
59
60
# File 'lib/rally_up.rb', line 56

def initialize(response)
  @body = response.body
  @code = response.code
  super
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



54
55
56
# File 'lib/rally_up.rb', line 54

def body
  @body
end

#codeObject

Returns the value of attribute code.



54
55
56
# File 'lib/rally_up.rb', line 54

def code
  @code
end

Instance Method Details

#as_jsonObject



66
67
68
# File 'lib/rally_up.rb', line 66

def as_json
  { error: to_s }
end

#messageObject



62
63
64
# File 'lib/rally_up.rb', line 62

def message
  "#{code} #{body}"
end

#to_sObject



70
71
72
# File 'lib/rally_up.rb', line 70

def to_s
  "#{self.class}: #{message}"
end