Class: Einvoice::Tradevan::Result

Inherits:
Result
  • Object
show all
Defined in:
lib/einvoice/tradevan/result.rb

Instance Attribute Summary

Attributes inherited from Result

#response

Instance Method Summary collapse

Methods inherited from Result

#initialize

Constructor Details

This class inherits a constructor from Einvoice::Result

Instance Method Details

#dataObject



16
17
18
19
20
21
22
# File 'lib/einvoice/tradevan/result.rb', line 16

def data
  if response.is_a? ActiveModel::Errors
    nil
  else
    response && response["Message"]
  end
end

#errorsObject



4
5
6
7
8
9
10
# File 'lib/einvoice/tradevan/result.rb', line 4

def errors
  if response.is_a? ActiveModel::Errors
    response.full_messages.join('; ')
  else
    response && response["Message"]
  end
end

#successful?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/einvoice/tradevan/result.rb', line 12

def successful?
  response && !response.is_a?(ActiveModel::Errors) && response["Success"] == 'Y'
end