/ppc

Gem for search engine account management.

Primary LanguageRubyGNU General Public License v2.0GPL-2.0

ppc

ppc for 'pay per click'. This is a toolkit designed to provide consitent search engine account managing experience.

##How to use it ?

Create an account:

param = {}
param[:se] = 'baidu'
param[:username] = 'username'
param[:password] = 'password'
param[:token] = 'token'
# if it is  qihu account
# param[:cipherkey] = 'cipherkey'
# param[:cipheriv] = 'cipheriv'
account = ::PPC::Operaion::account.new(param)

###Get objects info:

# get account info
account.info()[:result]

#get group info
group = account.get_group( {group_id} )
group.info()[:result]

###Add keywords: keyword1 = { keyword: 'ppc', group_id: 123, price:0.6, match_type:'wide'} keyword2 = { keyword: 'test_ppc', group_id: 123, price:0.6, match_type:'exact'} account.add_keyword( [keyword1, keyword2] )

###Another way to add keyword: # no need to enter group_id keyword1 = { keyword: 'ppc', price:0.6, match_type:'wide'} keyword2 = { keyword: 'test_ppc', price:0.6, match_type:'exact'} group = account.get_group( group_id )[:result][0] group.add_keyword( [ keyword1, keyword2 ] )


#API:

Return values:

All mehtods return a hash:

{
    succ: boolean,          # true if operation success else false
    failure: Array,         # failures info if operation false, else nil
    result: Array or hash   # Response body. Account service returns a hash, 
                            # others return Array of hash
}

###API casting: In each service class ::PPC::API::#{SE}::#{Service} there is a member map casting PPC API to Search engine Service API, For example:

::PPC::API::Baidu::Keyword.map  = [
        [:id,:keywordId],
        [:group_id,:adgroupId],
        [:keyword,:keyword],
        [:price,:price],
        [:pc_destination,:pcDestinationUrl],
        [:mobile_destination,:mobileDestinationUrl],
        [:match_type,:matchType],
        [:phrase_type,:phraseType],
        [:status,:status],
        [:pause,:pause]
     ]

ppc API keys are at the left side while search engine API keys are at the right side.

For more info please have a look into files in /ppc/api/