Class: AdSpace::Advertisement
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- AdSpace::Advertisement
- Defined in:
- app/models/ad_space/advertisement.rb
Instance Method Summary collapse
- #archived? ⇒ Boolean
- #cover_url(size = nil) ⇒ Object
- #custom_ad? ⇒ Boolean
- #dsp_ad? ⇒ Boolean
- #published? ⇒ Boolean
- #trace_id ⇒ Object
Instance Method Details
#archived? ⇒ Boolean
37 38 39 |
# File 'app/models/ad_space/advertisement.rb', line 37 def archived? archived_at.present? end |
#cover_url(size = nil) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'app/models/ad_space/advertisement.rb', line 53 def cover_url(size = nil) if self.splash? return cover_sm.attached? ? cover_sm.url : nil if size == 'little' return cover_md.attached? ? cover_md.url : nil if size == 'middle' return cover_lg.attached? ? cover_lg.url : nil if size == 'large' else cover_base.attached? ? cover_base.url : nil end end |
#custom_ad? ⇒ Boolean
45 46 47 |
# File 'app/models/ad_space/advertisement.rb', line 45 def custom_ad? ad_type == "custom" end |
#dsp_ad? ⇒ Boolean
41 42 43 |
# File 'app/models/ad_space/advertisement.rb', line 41 def dsp_ad? ad_type == "dsp" end |
#published? ⇒ Boolean
33 34 35 |
# File 'app/models/ad_space/advertisement.rb', line 33 def published? published_at.present? end |
#trace_id ⇒ Object
49 50 51 |
# File 'app/models/ad_space/advertisement.rb', line 49 def trace_id uuid end |