Class: PPC::API::Baidu::Account

Inherits:
PPC::API::Baidu show all
Defined in:
lib/ppc/api/baidu/account.rb

Constant Summary collapse

Service =
'Account'
AccountInfoType =
{
  id:                   :userId,
  balance:              :balance,
  pc_balance:           :pcBalance,
  mobile_balance:       :mobileBalance,
  cost:                 :cost,
  payment:              :payment,
  status:               :userStat,
  budget_type:          :budgetType,
  budget:               :budget,
  region:               :regionTarget,
  exclude_ip:           :excludeIp,
  isdynamic:            :isDynamicCreative,
  isdynamictagsublink:  :isDynamicTagSublink,
  isdynamichotredirect: :isDynamicHotRedirect,
  isdynamictitle:       :isDynamicTitle,
  dynamic_param:        :dynamicCreativeParam,
  open_domains:         :openDomains,
  reg_domain:           :regDomain,
  offline_time:         :budgetOfflineTime,
  weekly_budget:        :weeklyBudget,
  user_level:           :userLevel,
}

Class Method Summary collapse

Methods inherited from PPC::API::Baidu

process, request_uri

Methods included from PPC::API

#make_type, #process, #request, #request_http_body, #request_http_header, #request_uri, #reverse_type

Class Method Details

.info(auth) ⇒ Object



32
33
34
35
36
# File 'lib/ppc/api/baidu/account.rb', line 32

def self.info( auth )
  body = {:accountFields => AccountInfoType.values}
  response = request(auth,Service,'getAccountInfo',body)
  process( response, 'accountInfoType' ){ |x|reverse_type(x)[0] }
end

.update(auth, param = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ppc/api/baidu/account.rb', line 38

def self.update(auth, param = {} )
  """
  update account info
  @ params : account_info_type
  @return : account info_type
  """
  # for account service, there is not bulk operation
  body = { accountInfo: make_type( param )[0] }
  response = request(auth,Service,'updateAccountInfo', body)
  process( response, 'accountInfoType' ){ |x|reverse_type(x)[0] }
end