Class: Nucleo::Models::ChangeTypes::Base

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/nucleo/models/change_types/base.rb

Direct Known Subclasses

Seo::Base

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Nucleo::Models::RuleType::Base

Return an instance of the Rule Type domain model

Parameters:

  • attributes (Hash) (defaults to: {})


12
13
14
# File 'lib/nucleo/models/change_types/base.rb', line 12

def initialize(attributes={})
  @attributes = attributes
end

Instance Method Details

#<=>(other) ⇒ Object



16
17
18
# File 'lib/nucleo/models/change_types/base.rb', line 16

def <=>(other)
  self.created_at <=> other.created_at
end

#categoryString

Returns the category of the rule

Returns:

  • (String)


51
52
53
# File 'lib/nucleo/models/change_types/base.rb', line 51

def category
  @attributes['category']
end

#contextString

Returns the context of the rule

Returns:

  • (String)


44
45
46
# File 'lib/nucleo/models/change_types/base.rb', line 44

def context
  @attributes['context']
end

#created_atDateTime

Returns the created at timestamp of the rule.

Returns:

  • (DateTime)


66
67
68
69
70
71
72
# File 'lib/nucleo/models/change_types/base.rb', line 66

def created_at
  begin
    DateTime.parse(@attributes['created_at'])
  rescue
    nil
  end
end

#idString

Returns the ID of the rule

Returns:

  • (String)


23
24
25
# File 'lib/nucleo/models/change_types/base.rb', line 23

def id
  @attributes['id']
end

#page_idString

Returns the associated page id

Returns:

  • (String)


37
38
39
# File 'lib/nucleo/models/change_types/base.rb', line 37

def page_id
  @attributes['page_id']
end

#site_idString

Returns the associated site id

Returns:

  • (String)


30
31
32
# File 'lib/nucleo/models/change_types/base.rb', line 30

def site_id
  @attributes['site_id']
end

#typeString

Returns the type of the rule

Returns:

  • (String)


58
59
60
# File 'lib/nucleo/models/change_types/base.rb', line 58

def type
  @attributes['type']
end