Sha256: f014e813f3a28b3888f7708b47fd855e341a5e78be874ffed4771c99772f4964

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

module PPC
  module API
    class Sm
      class Account < Sm
        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,
        }
        @map = AccountType

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

        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

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ppc-2.0.5 lib/ppc/api/sm/account.rb
ppc-2.0.4 lib/ppc/api/sm/account.rb
ppc-2.0.3 lib/ppc/api/sm/account.rb
ppc-2.0.2 lib/ppc/api/sm/account.rb
ppc-2.0.1 lib/ppc/api/sm/account.rb
ppc-2.0.0 lib/ppc/api/sm/account.rb