Class: Zanox::AdMedium

Inherits:
Item
  • Object
show all
Defined in:
lib/zanox/resources/admedium.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Hashable

#to_hash

Constructor Details

#initialize(data) ⇒ AdMedium

  • pid (Integer) AdMedium ID

  • name (String) The name of the admedium

  • adrank (String) The adrank of the admedium

  • type (String) The type of the admedium (html, script, image, imagetext, text)

  • program (String) The program of the admedium

  • title (String) The title of the admedium

  • description (String) The description of the admedium

  • category (String) The category of the admedium (GET /admedia/categories/program/id)

  • tracking_links (Hash[]) The list of the tracking links for the admedium



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/zanox/resources/admedium.rb', line 40

def initialize(data)
  @pid            = data['@id'].to_i
  @name           = data['name']
  @adrank         = data['adrank']
  @type           = data['admediumType']
  @program        = {
    id:   data['program']['@id'].to_i,
    name: data['program']['$']
  }
  @title          = data['title']
  @description    = data['description']
  @category       = parse_category(data)
  @tracking_links = parse_tracking_links(data)
end

Instance Attribute Details

#adrankObject (readonly)

Returns the value of attribute adrank.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def adrank
  @adrank
end

#categoryObject (readonly)

Returns the value of attribute category.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def category
  @category
end

#descriptionObject (readonly)

Returns the value of attribute description.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def name
  @name
end

#pidObject (readonly)

Returns the value of attribute pid.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def pid
  @pid
end

#programObject (readonly)

Returns the value of attribute program.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def program
  @program
end

#titleObject (readonly)

Returns the value of attribute title.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def title
  @title
end

Returns the value of attribute tracking_links.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def tracking_links
  @tracking_links
end

#typeObject (readonly)

Returns the value of attribute type.



27
28
29
# File 'lib/zanox/resources/admedium.rb', line 27

def type
  @type
end

Class Method Details

.find(args = {}) ⇒ Object



56
57
58
59
# File 'lib/zanox/resources/admedium.rb', line 56

def find(args = {})
  response = API.request(:admedia, args)
  [response.admedium_items].flatten.map { |admedium| new(admedium) }
end