Sha256: 4e91ebd0748dc2d4f742d1c2cd033ba212aa2a537bfd082471287a92a2829f8c

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

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

        def self.info( auth )
          response = request(auth,Service,'getAccountInfo' )
          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,'updateAccountInfo', 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/sogou/account.rb
ppc-2.0.4 lib/ppc/api/sogou/account.rb
ppc-2.0.3 lib/ppc/api/sogou/account.rb
ppc-2.0.2 lib/ppc/api/sogou/account.rb
ppc-2.0.1 lib/ppc/api/sogou/account.rb
ppc-2.0.0 lib/ppc/api/sogou/account.rb