Class: Tidas::ErrorResult

Inherits:
Object
  • Object
show all
Defined in:
lib/tidas/error_result.rb

Direct Known Subclasses

ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ErrorResult

:nodoc:



7
8
9
10
# File 'lib/tidas/error_result.rb', line 7

def initialize(attributes = {}) # :nodoc:
  @tidas_id = attributes[:tidas_id]
  @errors   = Array(attributes[:errors])
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/tidas/error_result.rb', line 5

def errors
  @errors
end

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/tidas/error_result.rb', line 5

def message
  @message
end

#tidas_idObject (readonly)

Returns the value of attribute tidas_id.



5
6
7
# File 'lib/tidas/error_result.rb', line 5

def tidas_id
  @tidas_id
end

Instance Method Details

#msgObject



16
17
18
# File 'lib/tidas/error_result.rb', line 16

def msg
  @errors.first
end

#success?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/tidas/error_result.rb', line 12

def success?
  false
end

#to_jsonObject



20
21
22
23
24
25
26
27
# File 'lib/tidas/error_result.rb', line 20

def to_json
  {
    error_result: {
      tidas_id: @tidas_id,
      errors: @errors.map(&:to_s)
    }
  }.to_json
end