Class: AdSpace::Advertisement

Inherits:
ApplicationRecord show all
Defined in:
app/models/ad_space/advertisement.rb

Instance Method Summary collapse

Instance Method Details

#archived?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


45
46
47
# File 'app/models/ad_space/advertisement.rb', line 45

def custom_ad?
  ad_type == "custom"
end

#dsp_ad?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/ad_space/advertisement.rb', line 41

def dsp_ad?
  ad_type == "dsp"
end

#published?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/models/ad_space/advertisement.rb', line 33

def published?
  published_at.present?
end

#trace_idObject



49
50
51
# File 'app/models/ad_space/advertisement.rb', line 49

def trace_id
  uuid
end