Class: PPC::API::Sm::Account

Inherits:
PPC::API::Sm show all
Defined in:
lib/ppc/api/sm/account.rb

Constant Summary collapse

Service =
'account'
AccountType =
{
  id:             :userId,
  name:           :userName,
  balance:        :balance,
  cost:           :cost,
  payment:        :payment,
  budget_type:    :budgetType,
  budget:         :budget,
  region:         :regionTarget,
  exclude_ip:     :excludeIp,
  open_domains:   :openDomains,
  reg_domain:     :regDomain,
  offline_time:   :budgetOfflineTime,
  weekly_budget:  :weeklyBudget,
  status:         :userStat,
}

Class Method Summary collapse

Methods inherited from PPC::API::Sm

process, request_uri

Methods included from PPC::API

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

Class Method Details

.info(auth) ⇒ Object



25
26
27
28
# File 'lib/ppc/api/sm/account.rb', line 25

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

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



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ppc/api/sm/account.rb', line 30

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, 'updateAccount', body)
  process( response, 'accountInfoType' ){ |x|reverse_type(x)[0] }
end