Class: Nexaas::Async::Collector::AsyncResource
- Inherits:
-
Object
- Object
- Nexaas::Async::Collector::AsyncResource
- Includes:
- ActiveModel::Validations
- Defined in:
- app/models/nexaas/async/collector/async_resource.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#class_method ⇒ Object
Returns the value of attribute class_method.
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#collect_id ⇒ Object
Returns the value of attribute collect_id.
-
#file ⇒ Object
Returns the value of attribute file.
-
#instrumentation_context ⇒ Object
Returns the value of attribute instrumentation_context.
-
#scope_id ⇒ Object
Returns the value of attribute scope_id.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ AsyncResource
constructor
A new instance of AsyncResource.
- #save! ⇒ Object
- #sliced_attributes ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ AsyncResource
Returns a new instance of AsyncResource.
15 16 17 18 19 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 15 def initialize(opts={}) opts.each do |key, value| self.send("#{key}=", value) end end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
8 9 10 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 8 def args @args end |
#class_method ⇒ Object
Returns the value of attribute class_method.
8 9 10 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 8 def class_method @class_method end |
#class_name ⇒ Object
Returns the value of attribute class_name.
8 9 10 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 8 def class_name @class_name end |
#collect_id ⇒ Object
Returns the value of attribute collect_id.
8 9 10 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 8 def collect_id @collect_id end |
#file ⇒ Object
Returns the value of attribute file.
8 9 10 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 8 def file @file end |
#instrumentation_context ⇒ Object
Returns the value of attribute instrumentation_context.
8 9 10 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 8 def instrumentation_context @instrumentation_context end |
#scope_id ⇒ Object
Returns the value of attribute scope_id.
8 9 10 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 8 def scope_id @scope_id end |
Instance Method Details
#save! ⇒ Object
21 22 23 24 25 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 21 def save! initialize_collect_id raise "Nexaas::Async::Collector: invalid fields #{errors..keys.join(', ')}" unless valid? AsyncResourceJob.perform_async(sliced_attributes) end |
#sliced_attributes ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/models/nexaas/async/collector/async_resource.rb', line 27 def sliced_attributes { scope_id: scope_id, class_name: class_name, class_method: class_method, args: args, file: file, collect_id: collect_id, instrumentation_context: instrumentation_context }.reject { |_,v| v.nil? } end |