Class: Workarea::Listrak::Models::EventForm
- Inherits:
-
Object
- Object
- Workarea::Listrak::Models::EventForm
- Defined in:
- app/services/workarea/listrak/models/event_form.rb
Constant Summary collapse
- STATUSES =
['Active', 'Blocked']
Instance Attribute Summary collapse
-
#group_ip ⇒ Object
readonly
Returns the value of attribute group_ip.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(name:, status: nil, group_ip: nil, **options) ⇒ EventForm
constructor
A new instance of EventForm.
- #to_json ⇒ Object
Constructor Details
#initialize(name:, status: nil, group_ip: nil, **options) ⇒ EventForm
Returns a new instance of EventForm.
8 9 10 11 12 13 |
# File 'app/services/workarea/listrak/models/event_form.rb', line 8 def initialize(name:, status: nil, group_ip: nil, **) @name = name @status = status.presence_in(STATUSES) || STATUSES.first @group_ip = group_ip @options = end |
Instance Attribute Details
#group_ip ⇒ Object (readonly)
Returns the value of attribute group_ip.
6 7 8 |
# File 'app/services/workarea/listrak/models/event_form.rb', line 6 def group_ip @group_ip end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'app/services/workarea/listrak/models/event_form.rb', line 6 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'app/services/workarea/listrak/models/event_form.rb', line 6 def @options end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'app/services/workarea/listrak/models/event_form.rb', line 6 def status @status end |
Instance Method Details
#to_json ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/services/workarea/listrak/models/event_form.rb', line 15 def to_json { eventName: name, eventGroupId: group_ip, status: status }.compact.to_json end |