Class: PPC::API::Sogou::Account

Inherits:
PPC::API::Sogou show all
Defined in:
lib/ppc/api/sogou/account.rb

Constant Summary collapse

Service =
'Account'
AccountType =
{
  id:           :accountid,
  balance:      :balance,
  cost:         :total_cost,
  payment:      :total_pay,
  budget_type:  :type,
  budget:       :budget,
  region:       :regions,
  exclude_ip:   :excludeIps,
  open_domains: :domains,
  offline_time: :budgetOfflineTime,
  opt:          :opt,
}

Class Method Summary collapse

Methods inherited from PPC::API::Sogou

debug_print, process, request

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



22
23
24
25
# File 'lib/ppc/api/sogou/account.rb', line 22

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

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



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ppc/api/sogou/account.rb', line 27

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 = { accountInfoType: make_type( param )[0] }
  response = request(auth,Service,'updateAccountInfo', body)
  process( response, 'accountInfoType' ){ |x|reverse_type(x)[0] }
end