class ZanoxPublisher::Profile

Profile information

Get and update your profile information

@attr [Integer] id The profileItem's identifer from Zanox @attr [Fixnum] adrank The adrank @attr [String] first_name The first name of the profile holder @attr [String] last_name The last name of the profile holder @attr [String] email The email address of the profile @attr [String] country The country of the profile @attr [String] street1 The first adress line @attr [String] city The city of the profile @attr [String] zipcode The zip code of the profile @attr [String] login_name The login name of the profile @attr [String] user_name The user name of the profile @attr [String] title The title of the profile holder @attr [String] currency The currency of the account @attr [String] language The language setting of the account @attr [String] fax The fax number of the profile holder @attr [String] mobile The mobile number of the profile holder @attr [String] phone The phone number of the profile holder @attr [String] street2 The second adress line @attr [String] company The company to which the profile belongs @attr [Boolean] is_advertiser The account is an advertiser account @attr [Boolean] is_sublogin The account is a sublogin of a main account

Constants

RESOURCE_PATH

Attributes

adrank[RW]
city[RW]
company[RW]
country[RW]
currency[RW]
email[RW]
fax[RW]
firstName[RW]
first_name[RW]
id[RW]
isAdvertiser[RW]
isSublogin[RW]
is_advertiser[RW]
is_sublogin[RW]
language[RW]
lastName[RW]
last_name[RW]
loginName[RW]
login_name[RW]
mobile[RW]
phone[RW]
street1[RW]
street2[RW]
title[RW]
userName[RW]
user_name[RW]
zipcode[RW]

Public Class Methods

all() click to toggle source

Get all profiles associated to the connect ID.

This is equivalent to the Zanox API method getProfiles. The method documentation can be found under {developer.zanox.com/web/guest/publisher-api-2011/get-profiles}.

Authentication: Requires signature.

@return [Array<Profile>]

@example

profiles = ZanoxPublisher::Profile.all #=> [#<Profile ...>]
profile  = profiles.first #=> #<Profile ...>
# File lib/zanox_publisher/profile.rb, line 43
def all
  response = self.connection.signature_get()
  data = response.fetch('profileItem')
  profiles = []

  data.each do |profile|
    profiles << Profile.new(profile)
  end

  profiles
end
connection() click to toggle source

A connection instance with Profiles' relative_path

@return [Connection]

# File lib/zanox_publisher/profile.rb, line 72
def connection
  @connection ||= Connection.new(RESOURCE_PATH)
end
first() click to toggle source

Get the first profiles' information.

This gives convenient access to your main profile, as often the Zanox API getProfiles method will only return one profileItem.

@return [Profile]

@example

my_profile = ZanoxPublisher::Profile.first #=> #<Profile ...>
# File lib/zanox_publisher/profile.rb, line 65
def first
  Profile.all.first
end
new(data = {}) click to toggle source

TODO: PUT {developer.zanox.com/web/guest/publisher-api-2011/put-profiles}

# File lib/zanox_publisher/profile.rb, line 79
def initialize(data = {})
  @id           = data.fetch('@id').to_i
  @adrank       = data.fetch('adrank')
  @firstName    = data.fetch('firstName')
  @lastName     = data.fetch('lastName')
  @email        = data.fetch('email')
  @country      = data.fetch('country')
  @street1      = data.fetch('street1')
  @city         = data.fetch('city')
  @zipcode      = data.fetch('zipcode')
  @loginName    = data.fetch('loginName')
  @userName     = data.fetch('userName')
  @isAdvertiser = data.fetch('isAdvertiser')
  @isSublogin   = data.fetch('isSublogin')
  # Optionally returned data
  @title        = data.fetch('title', nil)
  @currency     = data.fetch('currency', nil)
  @language     = data.fetch('language', nil)
  @fax          = data.fetch('fax', nil)
  @mobile       = data.fetch('mobile', nil)
  @phone        = data.fetch('phone', nil)
  @street2      = data.fetch('street2', nil)
  @company      = data.fetch('company', nil)
end

Public Instance Methods

to_i() click to toggle source

Returns the profileItems' ID as integer representation

@return [Integer]

# File lib/zanox_publisher/profile.rb, line 107
def to_i
  @id
end