Class: Sendly::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/sendly/types.rb

Overview

============================================================================

Rules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Rule

Returns a new instance of Rule.



941
942
943
944
945
946
947
948
949
# File 'lib/sendly/types.rb', line 941

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

#actionsObject (readonly)

Returns the value of attribute actions.



939
940
941
# File 'lib/sendly/types.rb', line 939

def actions
  @actions
end

#conditionsObject (readonly)

Returns the value of attribute conditions.



939
940
941
# File 'lib/sendly/types.rb', line 939

def conditions
  @conditions
end

#created_atObject (readonly)

Returns the value of attribute created_at.



939
940
941
# File 'lib/sendly/types.rb', line 939

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



939
940
941
# File 'lib/sendly/types.rb', line 939

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



939
940
941
# File 'lib/sendly/types.rb', line 939

def name
  @name
end

#priorityObject (readonly)

Returns the value of attribute priority.



939
940
941
# File 'lib/sendly/types.rb', line 939

def priority
  @priority
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



939
940
941
# File 'lib/sendly/types.rb', line 939

def updated_at
  @updated_at
end

Instance Method Details

#to_hObject



951
952
953
954
955
956
957
# File 'lib/sendly/types.rb', line 951

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