Class: MrMurano::EventHandler::EventHandlerItem

Inherits:
Item
  • Object
show all
Defined in:
lib/MrMurano/Solution-Services.rb

Overview

EventHandler Specific details on an Item

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aliasString

Already part of Item:

:id
:name
:updated_at

Returns:

  • (String)

    Internal Alias name



469
470
471
# File 'lib/MrMurano/Solution-Services.rb', line 469

def alias
  @alias
end

#created_atString

Returns Timestamp when this was created.

Returns:

  • (String)

    Timestamp when this was created.



479
480
481
# File 'lib/MrMurano/Solution-Services.rb', line 479

def created_at
  @created_at
end

#eventString

Returns Which event triggers this script.

Returns:

  • (String)

    Which event triggers this script.



485
486
487
# File 'lib/MrMurano/Solution-Services.rb', line 485

def event
  @event
end

#phantomBoolean

Returns True if a “phantom”, a script that exists on the server but is just the empty string. You cannot delete these services from the platform without breaking stuff, but we can at least let the user delete these files locally. See: eventhandler.undeletable.

Returns:

  • (Boolean)

    True if a “phantom”, a script that exists on the server but is just the empty string. You cannot delete these services from the platform without breaking stuff, but we can at least let the user delete these files locally. See: eventhandler.undeletable.



495
496
497
# File 'lib/MrMurano/Solution-Services.rb', line 495

def phantom
  @phantom
end

#script_keyObject

(lb): 2018-08-09: This has been missing until now, when the

recently added warning in Item's []= started complaining
about it.

(lb): FIXME/2018-08-09: Do we need to leverage this attribute

at all? For now we're just consuming it from the platform,
but we not using it (though we use script_key elsewhere in
the code).


477
478
479
# File 'lib/MrMurano/Solution-Services.rb', line 477

def script_key
  @script_key
end

#serviceString

Returns Which service triggers this script.

Returns:

  • (String)

    Which service triggers this script.



483
484
485
# File 'lib/MrMurano/Solution-Services.rb', line 483

def service
  @service
end

#solution_idString

Returns The soln’s product.id or application.id (Murano’s api_id).

Returns:

  • (String)

    The soln’s product.id or application.id (Murano’s api_id).



481
482
483
# File 'lib/MrMurano/Solution-Services.rb', line 481

def solution_id
  @solution_id
end

#svc_aliasString

Returns Service alias, e.g., “MrMurano::EventHandler::EventHandlerItem.productproduct.id”.

Returns:

  • (String)

    Service alias, e.g., “MrMurano::EventHandler::EventHandlerItem.productproduct.id”



489
490
491
# File 'lib/MrMurano/Solution-Services.rb', line 489

def svc_alias
  @svc_alias
end

#typeString

Returns For device2 events, the type of event.

Returns:

  • (String)

    For device2 events, the type of event.



487
488
489
# File 'lib/MrMurano/Solution-Services.rb', line 487

def type
  @type
end

#undeletableBoolean

Returns True if a service that should not be deleted remotely.

Returns:

  • (Boolean)

    True if a service that should not be deleted remotely.



497
498
499
# File 'lib/MrMurano/Solution-Services.rb', line 497

def undeletable
  @undeletable
end

Instance Method Details

#reject_ephemeralObject



499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/MrMurano/Solution-Services.rb', line 499

def reject_ephemeral
  super.reject do |attr_key, attr_val|
    [
      # Writeable platform properties:
      #  :alias,
      #  :event,
      #  :service,
      #  :solution_id,
      #  :type,
      # Read-only platform properties:
      :created_at,
      # Local-only attrs:
      :phantom,
      :svc_alias,
      :undeletable,
    ].include?(attr_key) || ((attr_key == :type) && (attr_val.nil?))
  end
end