Class: Sendly::Rule
- Inherits:
-
Object
- Object
- Sendly::Rule
- Defined in:
- lib/sendly/types.rb
Overview
Rules
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(data) ⇒ Rule
constructor
A new instance of Rule.
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ Rule
Returns a new instance of Rule.
793 794 795 796 797 798 799 800 801 |
# File 'lib/sendly/types.rb', line 793 def initialize(data) @id = data["id"] @name = data["name"] @conditions = data["conditions"] || {} @actions = data["actions"] || {} @priority = data["priority"] @created_at = parse_time(data["createdAt"] || data["created_at"]) @updated_at = parse_time(data["updatedAt"] || data["updated_at"]) end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
791 792 793 |
# File 'lib/sendly/types.rb', line 791 def actions @actions end |
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
791 792 793 |
# File 'lib/sendly/types.rb', line 791 def conditions @conditions end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
791 792 793 |
# File 'lib/sendly/types.rb', line 791 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
791 792 793 |
# File 'lib/sendly/types.rb', line 791 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
791 792 793 |
# File 'lib/sendly/types.rb', line 791 def name @name end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
791 792 793 |
# File 'lib/sendly/types.rb', line 791 def priority @priority end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
791 792 793 |
# File 'lib/sendly/types.rb', line 791 def updated_at @updated_at end |
Instance Method Details
#to_h ⇒ Object
803 804 805 806 807 808 809 |
# File 'lib/sendly/types.rb', line 803 def to_h { id: id, name: name, conditions: conditions, actions: actions, priority: priority, created_at: created_at&.iso8601, updated_at: updated_at&.iso8601 }.compact end |