Class: Collmex::Api::Message

Inherits:
Line
  • Object
show all
Defined in:
lib/collmex/api.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Line

default_hash, hashify, #initialize, #to_a, #to_csv, #to_h, #to_stringified_array

Constructor Details

This class inherits a constructor from Collmex::Api::Line

Class Method Details

.specificationObject



249
250
251
252
253
254
255
256
257
# File 'lib/collmex/api.rb', line 249

def self.specification
    [
      { name: :identifyer       , type: :string    , fix: "MESSAGE"         },
      { name: :type             , type: :string                             },
      { name: :id               , type: :integer                            },
      { name: :text             , type: :string                             },
      { name: :line             , type: :integer                            },
    ]
end

Instance Method Details

#resultObject



268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/collmex/api.rb', line 268

def result
  if @hash.has_key?(:type) && !@hash[:type].empty?
    case @hash[:type]
    when "S" then :success
    when "W" then :warning
    when "E" then :error
    else :undefined
    end
  else
    :undefined
  end
end

#success?Boolean

Returns:

  • (Boolean)


260
261
262
263
264
265
266
# File 'lib/collmex/api.rb', line 260

def success?
  if @hash.has_key?(:type) && !@hash[:type].empty? && @hash[:type] == "S"
    true
  else
    false
  end
end