Class: Nfe::Operations::Base

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/nfe/operations/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(certificate, private_key, use_schema: true) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
# File 'lib/nfe/operations/base.rb', line 8

def initialize(certificate, private_key, use_schema: true)
  @errors = ActiveModel::Errors.new(self)
  @certificate = certificate
  @private_key = private_key
  @use_schema = use_schema
  validate_certificate
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



6
7
8
# File 'lib/nfe/operations/base.rb', line 6

def errors
  @errors
end

#resultObject (readonly)

Returns the value of attribute result.



6
7
8
# File 'lib/nfe/operations/base.rb', line 6

def result
  @result
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
# File 'lib/nfe/operations/base.rb', line 16

def execute
  if errors.empty?
    before_execute
    call_webservice if valid?
  end

  errors.empty?
end