Sha256: 6cbed9243beeb6f7bdff4ffa6a06e7a6d72f920cda438824c4e53732b068459e

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

module Workarea
  module Listrak
    module Models
      class EventForm
        STATUSES = ['Active', 'Blocked']
        attr_reader :name, :status, :group_ip, :options

        def initialize(name:, status: nil, group_ip: nil, **options)
          @name = name
          @status = status.presence_in(STATUSES) || STATUSES.first
          @group_ip = group_ip
          @options = options
        end

        def to_json
          {
            eventName: name,
            eventGroupId: group_ip,
            status: status
          }.compact.to_json
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workarea-listrak-5.0.4 app/services/workarea/listrak/models/event_form.rb
workarea-listrak-5.0.3 app/services/workarea/listrak/models/event_form.rb
workarea-listrak-5.0.2 app/services/workarea/listrak/models/event_form.rb
workarea-listrak-5.0.1 app/services/workarea/listrak/models/event_form.rb