Class: Itsf::Services::V2::Service::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
ActiveModel::Validations
Defined in:
lib/itsf/services/v2/service/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, *args) ⇒ Base

Returns a new instance of Base.



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/itsf/services/v2/service/base.rb', line 23

def initialize(attributes = {}, *args)
  options = args.extract_options!
  options.reverse_merge!({ :instrumenter => ActiveSupport::Notifications })

  @errors  = ActiveModel::Errors.new(self)

  initialize_instrumenter(options[:instrumenter])
  instrument('initialize.export_to_sap.payment.dzb') do
    initialize_attributes if respond_to?(:initialize_attributes)
    set_attributes(attributes)
    initialize_response
  end
end

Instance Attribute Details

#instrumenterObject

Returns the value of attribute instrumenter.



12
13
14
# File 'lib/itsf/services/v2/service/base.rb', line 12

def instrumenter
  @instrumenter
end

Class Method Details

.call(attributes = {}, *args) ⇒ Object



19
20
21
# File 'lib/itsf/services/v2/service/base.rb', line 19

def self.call(attributes = {}, *args)
  new(attributes, *args).send(:do_work)
end

.i18n_scopeObject



15
16
17
# File 'lib/itsf/services/v2/service/base.rb', line 15

def self.i18n_scope
  'activerecord'
end