Class: Bluevia::AdResponse

Inherits:
Array
  • Object
show all
Defined in:
lib/bluevia/ad_response.rb

Overview

Wrapper to fetch in an easy way the image or the text ad

Instance Method Summary collapse

Instance Method Details

#imageObject

Fetch the image ad



16
17
18
19
20
21
22
# File 'lib/bluevia/ad_response.rb', line 16

def image
  val = self.find_all{|item| item["type_name"].eql?("image")}
  if val.instance_of?(Array) and val.length > 0
    val = val[0]
  end
  val
end

#textObject

Fetch the text ad



27
28
29
30
31
32
33
# File 'lib/bluevia/ad_response.rb', line 27

def text
  val = self.find_all{|item| item["type_name"].eql?("text")}
  if val.instance_of?(Array) and val.length > 0
    val = val[0]
  end
  val
end