Class: CampaignHQ::List

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations
Defined in:
lib/campaign_h_q/list.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ List

Returns a new instance of List.



16
17
18
# File 'lib/campaign_h_q/list.rb', line 16

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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



14
15
16
# File 'lib/campaign_h_q/list.rb', line 14

def attributes
  @attributes
end

Class Method Details

.create(params = {}) ⇒ Object



20
21
22
# File 'lib/campaign_h_q/list.rb', line 20

def self.create(params = {})
  new(params).tap(&:save)
end

Instance Method Details

#as_jsonObject



28
29
30
# File 'lib/campaign_h_q/list.rb', line 28

def as_json
  attributes
end

#idObject



32
33
34
# File 'lib/campaign_h_q/list.rb', line 32

def id
  attributes['id']
end

#saveObject



24
25
26
# File 'lib/campaign_h_q/list.rb', line 24

def save
  valid? && persist!
end