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

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
ActiveModel::Conversion, 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.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/itsf/services/v2/service/base.rb', line 27

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

  @_messages = []
  @errors = ActiveModel::Errors.new(self)

  initialize_instrumenter(options[:instrumenter])
  instrument('initialize.base.service.v2.services.itsf') do
    initialize_attributes if respond_to?(:initialize_attributes, true)
    send_attributes(attributes)
    initialize_response
  end
end

Instance Attribute Details

#_messagesObject (readonly)

Returns the value of attribute _messages.



17
18
19
# File 'lib/itsf/services/v2/service/base.rb', line 17

def _messages
  @_messages
end

#instrumenterObject

Returns the value of attribute instrumenter.



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

def instrumenter
  @instrumenter
end

Class Method Details

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



23
24
25
# File 'lib/itsf/services/v2/service/base.rb', line 23

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

.i18n_scopeObject



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

def self.i18n_scope
  'activerecord'
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


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

def persisted?; false end