class Tankerkoenig::Response

Attributes

data[R]
license[R]
message[R]
ok[R]
result[RW]
status[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/tankerkoenig/response.rb, line 6
def initialize(attributes)
  @ok = !attributes[:ok].nil? ? attributes[:ok] : false
  @license = attributes[:license] || ''
  @data = attributes[:data] || ''
  @status = attributes[:status] || ''
  if @ok
    @message = attributes[:message] || ''
  else
    @message = attributes[:message] || 'an error occured'
  end
  @result = []
end

Public Instance Methods

any?() click to toggle source
# File lib/tankerkoenig/response.rb, line 27
def any?
  @result != [] && @result != nil
end
error?() click to toggle source
# File lib/tankerkoenig/response.rb, line 23
def error?
  !@ok
end
success?() click to toggle source
# File lib/tankerkoenig/response.rb, line 19
def success?
  @ok
end