Class: CampaignHQ::List
- Inherits:
-
Object
- Object
- CampaignHQ::List
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations
- Defined in:
- lib/campaign_h_q/list.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
- #id ⇒ Object
-
#initialize(params = {}) ⇒ List
constructor
A new instance of List.
- #save ⇒ Object
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
#attributes ⇒ Object (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_json ⇒ Object
28 29 30 |
# File 'lib/campaign_h_q/list.rb', line 28 def as_json attributes end |
#id ⇒ Object
32 33 34 |
# File 'lib/campaign_h_q/list.rb', line 32 def id attributes['id'] end |
#save ⇒ Object
24 25 26 |
# File 'lib/campaign_h_q/list.rb', line 24 def save valid? && persist! end |