class ZanoxPublisher::TrackingLink

@attr [Integer] adspace The adspaces' ID for which the tracking link is set @attr [String] ppv The Pay Per View tracking link @attr [String] ppc The Pay Per Click tracking link @attr [String] tpv The True Post View tracking link

Attributes

adspace[R]
ppc[R]
ppv[R]

Public Class Methods

fetch(data = nil) click to toggle source

Fetch all tracking links from Zanox API Response

@param data [Array] the value of the 'trackingLinks' element

@return [Array<TrackingLink>, nil]

# File lib/zanox_publisher/tracking_link.rb, line 13
def fetch(data = nil)
  # To support API of picking categories of hash with [] notation
  return nil if data.nil? or not data.respond_to? :each

  retval = []

  data.each do |tracking_link|
    retval << TrackingLink.new(tracking_link)
  end

  retval
end
new(data = {}) click to toggle source
# File lib/zanox_publisher/tracking_link.rb, line 28
def initialize(data = {})
  @adspace = data.fetch('@adspaceId').to_i
  @ppv     = data.fetch('ppv')
  @ppc     = data.fetch('ppc')
  @tpv     = data.fetch('tpv', nil)
end

Public Instance Methods

to_i() click to toggle source

Returns the adspaceItems' ID as integer representation

@return [Integer]

# File lib/zanox_publisher/tracking_link.rb, line 38
def to_i
  @adspace
end