qihu360 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +18 -0
 - data/.rspec +3 -0
 - data/.rvmrc +62 -0
 - data/Gemfile +12 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +69 -0
 - data/Rakefile +1 -0
 - data/lib/qihu/auth.rb +47 -0
 - data/lib/qihu/dianjing/api/account.rb +8 -0
 - data/lib/qihu/dianjing/api/base.rb +44 -0
 - data/lib/qihu/dianjing/api/campaign.rb +8 -0
 - data/lib/qihu/dianjing/api/creative.rb +8 -0
 - data/lib/qihu/dianjing/api/group.rb +8 -0
 - data/lib/qihu/dianjing/api/keyword.rb +8 -0
 - data/lib/qihu/dianjing/api/report.rb +8 -0
 - data/lib/qihu/dianjing/api/tool.rb +8 -0
 - data/lib/qihu/dianjing/client.rb +68 -0
 - data/lib/qihu/dianjing.rb +15 -0
 - data/lib/qihu/version.rb +3 -0
 - data/lib/qihu.rb +3 -0
 - data/qihu360.gemspec +27 -0
 - data/spec/qihu/auth_spec.rb +47 -0
 - data/spec/qihu/dianjing/client_spec.rb +29 -0
 - data/spec/spec_helper.rb +1 -0
 - metadata +141 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 75934d4a842a4445106351a4edc180730f4f7a41
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0de587d05e405d23a6046d67dbfbe443f4a7783d
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3b395d6b45abc7a5b133c0ffd3a340f17281f92c22218b16f01825610d4f7b7c04c3c2acd0e88ebc264e5611881a6518890b584b39db69d76ab97f871c99f3b8
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2c0355500aee76b999069411976d2095a663349d1fcfc790f81a3a4069e4540ba4612c16d6b710f4b8f55b7f82950f77af149e6b37e1e4516afe49af782d30a9
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.rvmrc
    ADDED
    
    | 
         @@ -0,0 +1,62 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env bash
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # This is an RVM Project .rvmrc file, used to automatically load the ruby
         
     | 
| 
      
 4 
     | 
    
         
            +
            # development environment upon cd'ing into the directory
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
         
     | 
| 
      
 7 
     | 
    
         
            +
            # Only full ruby name is supported here, for short names use:
         
     | 
| 
      
 8 
     | 
    
         
            +
            #     echo "rvm use 2.0.0" > .rvmrc
         
     | 
| 
      
 9 
     | 
    
         
            +
            environment_id="ruby-2.0.0-p247@test"
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            # Uncomment the following lines if you want to verify rvm version per project
         
     | 
| 
      
 12 
     | 
    
         
            +
            # rvmrc_rvm_version="1.22.1 (master)" # 1.10.1 seems like a safe start
         
     | 
| 
      
 13 
     | 
    
         
            +
            # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | __rvm_awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
         
     | 
| 
      
 14 
     | 
    
         
            +
            #   echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
         
     | 
| 
      
 15 
     | 
    
         
            +
            #   return 1
         
     | 
| 
      
 16 
     | 
    
         
            +
            # }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            # First we attempt to load the desired environment directly from the environment
         
     | 
| 
      
 19 
     | 
    
         
            +
            # file. This is very fast and efficient compared to running through the entire
         
     | 
| 
      
 20 
     | 
    
         
            +
            # CLI and selector. If you want feedback on which environment was used then
         
     | 
| 
      
 21 
     | 
    
         
            +
            # insert the word 'use' after --create as this triggers verbose mode.
         
     | 
| 
      
 22 
     | 
    
         
            +
            if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
         
     | 
| 
      
 23 
     | 
    
         
            +
              && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
         
     | 
| 
      
 24 
     | 
    
         
            +
            then
         
     | 
| 
      
 25 
     | 
    
         
            +
              \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
         
     | 
| 
      
 26 
     | 
    
         
            +
              for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"*
         
     | 
| 
      
 27 
     | 
    
         
            +
              do
         
     | 
| 
      
 28 
     | 
    
         
            +
                if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]]
         
     | 
| 
      
 29 
     | 
    
         
            +
                then \. "${__hook}" || true
         
     | 
| 
      
 30 
     | 
    
         
            +
                fi
         
     | 
| 
      
 31 
     | 
    
         
            +
              done
         
     | 
| 
      
 32 
     | 
    
         
            +
              unset __hook
         
     | 
| 
      
 33 
     | 
    
         
            +
              if (( ${rvm_use_flag:=1} >= 2 )) # display only when forced
         
     | 
| 
      
 34 
     | 
    
         
            +
              then
         
     | 
| 
      
 35 
     | 
    
         
            +
                if [[ $- == *i* ]] # check for interactive shells
         
     | 
| 
      
 36 
     | 
    
         
            +
                then printf "%b" "Using: \E[32m$GEM_HOME\E[0m
         
     | 
| 
      
 37 
     | 
    
         
            +
            " # show the user the ruby and gemset they are using in green
         
     | 
| 
      
 38 
     | 
    
         
            +
                else printf "%b" "Using: $GEM_HOME
         
     | 
| 
      
 39 
     | 
    
         
            +
            " # don't use colors in non-interactive shells
         
     | 
| 
      
 40 
     | 
    
         
            +
                fi
         
     | 
| 
      
 41 
     | 
    
         
            +
              fi
         
     | 
| 
      
 42 
     | 
    
         
            +
            else
         
     | 
| 
      
 43 
     | 
    
         
            +
              # If the environment file has not yet been created, use the RVM CLI to select.
         
     | 
| 
      
 44 
     | 
    
         
            +
              rvm --create  "$environment_id" || {
         
     | 
| 
      
 45 
     | 
    
         
            +
                echo "Failed to create RVM environment '${environment_id}'."
         
     | 
| 
      
 46 
     | 
    
         
            +
                return 1
         
     | 
| 
      
 47 
     | 
    
         
            +
              }
         
     | 
| 
      
 48 
     | 
    
         
            +
            fi
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            # If you use bundler, this might be useful to you:
         
     | 
| 
      
 51 
     | 
    
         
            +
            # if [[ -s Gemfile ]] && {
         
     | 
| 
      
 52 
     | 
    
         
            +
            #   ! builtin command -v bundle >/dev/null ||
         
     | 
| 
      
 53 
     | 
    
         
            +
            #   builtin command -v bundle | GREP_OPTIONS="" \grep $rvm_path/bin/bundle >/dev/null
         
     | 
| 
      
 54 
     | 
    
         
            +
            # }
         
     | 
| 
      
 55 
     | 
    
         
            +
            # then
         
     | 
| 
      
 56 
     | 
    
         
            +
            #   printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
         
     | 
| 
      
 57 
     | 
    
         
            +
            #   gem install bundler
         
     | 
| 
      
 58 
     | 
    
         
            +
            # fi
         
     | 
| 
      
 59 
     | 
    
         
            +
            # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
         
     | 
| 
      
 60 
     | 
    
         
            +
            # then
         
     | 
| 
      
 61 
     | 
    
         
            +
            #   bundle install | GREP_OPTIONS="" \grep -vE '^Using|Your bundle is complete'
         
     | 
| 
      
 62 
     | 
    
         
            +
            # fi
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2013 icyleaf
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,69 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Qihu360
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            整合 `open.360.cn` 的一些业务 `Ruby` 封装。
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            - OAuth2 的封装
         
     | 
| 
      
 6 
     | 
    
         
            +
            - 点睛营销平台(广告竞价排名系统) API 
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## 安装
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            在你项目的 `Gemfile` 文件添加下行内容:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                gem 'qihu360'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            保存后执行:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            或者直接执行下行命令安装:
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                $ gem install qihu360
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ## 代码实例
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ### 验证 OAuth 2
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                # 处理 oauth2
         
     | 
| 
      
 29 
     | 
    
         
            +
                auth = Qihu::Auth.new(id:'xxx', secret:'yyy')
         
     | 
| 
      
 30 
     | 
    
         
            +
                
         
     | 
| 
      
 31 
     | 
    
         
            +
                # 默认 redirect_uri 是 oob
         
     | 
| 
      
 32 
     | 
    
         
            +
                auth_url = auth.authorize_url() 
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                # 设置回调网址和验证界面模式 
         
     | 
| 
      
 35 
     | 
    
         
            +
                auth_url = auth.authorize_url(redirect_uri:'http://icyleaf.com', display:'desktop')
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                # 获取的 access token
         
     | 
| 
      
 38 
     | 
    
         
            +
                auth.get_token('code')
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            #### 使用 access token 初始化
         
     | 
| 
      
 42 
     | 
    
         
            +
              
         
     | 
| 
      
 43 
     | 
    
         
            +
              auth = Qihu::Auth.new(id:'xxx', secret:'yyy', token:{
         
     | 
| 
      
 44 
     | 
    
         
            +
                  :access_token => 'zzz', :refresh_token => 'qqq', :expires_at => 36000
         
     | 
| 
      
 45 
     | 
    
         
            +
              })
         
     | 
| 
      
 46 
     | 
    
         
            +
              
         
     | 
| 
      
 47 
     | 
    
         
            +
              // 或者这样传递 access token
         
     | 
| 
      
 48 
     | 
    
         
            +
              auth.get_token_from_hash(:access_token => 'zzz', :refresh_token => 'qqq', :expires_at => 36000)
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            ### 调用广告系统接口
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                # 初始化必须传入获得 access token 的 Qihu::Auth 实例
         
     | 
| 
      
 53 
     | 
    
         
            +
                client = Qihu::DianJing::Client(auth)
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                # 请求 account 的账户信息,默认返回 json 格式
         
     | 
| 
      
 56 
     | 
    
         
            +
                response = client.account.getInfo 
         
     | 
| 
      
 57 
     | 
    
         
            +
                # 除了驼峰调用模式,下划线同样适用
         
     | 
| 
      
 58 
     | 
    
         
            +
                response = client.account.get_info
         
     | 
| 
      
 59 
     | 
    
         
            +
                
         
     | 
| 
      
 60 
     | 
    
         
            +
                # 创建一个计划
         
     | 
| 
      
 61 
     | 
    
         
            +
                response = client.campign.add(name:'Beijing', budget:10000)
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            ## 贡献代码
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            1. Fork 本仓库
         
     | 
| 
      
 66 
     | 
    
         
            +
            2. 创建你自己的 feature 分支 (`git checkout -b my-new-feature`)
         
     | 
| 
      
 67 
     | 
    
         
            +
            3. 提交你的代码 (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 68 
     | 
    
         
            +
            4. 提交你的分支 (`git push origin my-new-feature`)
         
     | 
| 
      
 69 
     | 
    
         
            +
            5. 创建一个新的 Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "bundler/gem_tasks"
         
     | 
    
        data/lib/qihu/auth.rb
    ADDED
    
    | 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'oauth2'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Qihu
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Auth
         
     | 
| 
      
 5 
     | 
    
         
            +
                attr_reader :oauth2, :access_token, :refresh_token, :expires_at, :expires_in
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_accessor :token, :redirect_uri
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def initialize(client_id, client_secret, token={}, redirect_uri='oob', site='https://openapi.360.cn')
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @redirect_uri = redirect_uri
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @oauth2 = OAuth2::Client.new(client_id, client_secret,
         
     | 
| 
      
 11 
     | 
    
         
            +
                    :site => site,
         
     | 
| 
      
 12 
     | 
    
         
            +
                    :authorize_url => '/oauth2/authorize',
         
     | 
| 
      
 13 
     | 
    
         
            +
                    :token_url => '/oauth2/access_token',
         
     | 
| 
      
 14 
     | 
    
         
            +
                    :ssl => {:verify => false},
         
     | 
| 
      
 15 
     | 
    
         
            +
                  )
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  if token
         
     | 
| 
      
 18 
     | 
    
         
            +
                    @token = OAuth2::AccessToken.from_hash(@oauth2, token)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def authorize_url(options={})
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @redirect_uri = options[:redirect_uri] if options[:redirect_uri]
         
     | 
| 
      
 24 
     | 
    
         
            +
                  scope = options[:scope] ? options[:scope] : 'basic'
         
     | 
| 
      
 25 
     | 
    
         
            +
                  display = options[:display] ? options[:display] : 'default'
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  @oauth2.auth_code.authorize_url(:redirect_uri => @redirect_uri, :scope => scope, :display => display)
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                def get_token(code, redirect_uri='')
         
     | 
| 
      
 31 
     | 
    
         
            +
                  @redirect_uri = redirect_uri unless redirect_uri.empty?
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @token = @oauth2.auth_code.get_token(code, :redirect_uri => @redirect_uri)
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  @refresh_token = @token.refresh_token
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @expires_at = @token.expires_at
         
     | 
| 
      
 36 
     | 
    
         
            +
                  @expires_in = @token.expires_in
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @access_token = @token.token
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  return self
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                def get_token_from_hash(token={})
         
     | 
| 
      
 43 
     | 
    
         
            +
                  @token = OAuth2::AccessToken.from_hash(@oauth2, token)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  return self
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,44 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Qihu
         
     | 
| 
      
 2 
     | 
    
         
            +
              module DianJing
         
     | 
| 
      
 3 
     | 
    
         
            +
                module API
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Base
         
     | 
| 
      
 5 
     | 
    
         
            +
                    def initialize(client, options={})
         
     | 
| 
      
 6 
     | 
    
         
            +
                      @client = client
         
     | 
| 
      
 7 
     | 
    
         
            +
                    end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    def method_missing(name, *args, &block)
         
     | 
| 
      
 10 
     | 
    
         
            +
                      if name.match(/_/)
         
     | 
| 
      
 11 
     | 
    
         
            +
                        name = name.to_s.split('_').each_with_index.map{|k, i| (i > 0) ? k.capitalize : k}.join("")
         
     | 
| 
      
 12 
     | 
    
         
            +
                      end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                      params = {
         
     | 
| 
      
 15 
     | 
    
         
            +
                        :format => 'json'
         
     | 
| 
      
 16 
     | 
    
         
            +
                      }.merge(args[0])
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 19 
     | 
    
         
            +
                        method = name.match(/^get/) ? :get : :post
         
     | 
| 
      
 20 
     | 
    
         
            +
                        uri_path = uri_path(name)
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                        @client.auth.token.request(method, uri_path, :headers => client_headers, :params => params)
         
     | 
| 
      
 23 
     | 
    
         
            +
                      rescue OAuth2::Error
         
     | 
| 
      
 24 
     | 
    
         
            +
                        raise "Invaild API: #{@client.site}/#{uri_path}"
         
     | 
| 
      
 25 
     | 
    
         
            +
                      end
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                    protected
         
     | 
| 
      
 29 
     | 
    
         
            +
                      def client_headers
         
     | 
| 
      
 30 
     | 
    
         
            +
                        {
         
     | 
| 
      
 31 
     | 
    
         
            +
                          :apiKey => @client.auth.token.client.id,
         
     | 
| 
      
 32 
     | 
    
         
            +
                          :accessToken => @client.auth.token.token,
         
     | 
| 
      
 33 
     | 
    
         
            +
                          :serveToken => Time.now.to_i.to_s,
         
     | 
| 
      
 34 
     | 
    
         
            +
                        }
         
     | 
| 
      
 35 
     | 
    
         
            +
                      end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                      def uri_path(uri)
         
     | 
| 
      
 38 
     | 
    
         
            +
                        class_name = self.class.name.split("::")[-1].downcase
         
     | 
| 
      
 39 
     | 
    
         
            +
                        "#{@client.version}/#{class_name}/#{uri}"
         
     | 
| 
      
 40 
     | 
    
         
            +
                      end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,68 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'oauth2'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Qihu
         
     | 
| 
      
 4 
     | 
    
         
            +
              module DianJing
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Client
         
     | 
| 
      
 6 
     | 
    
         
            +
                  attr_reader :auth
         
     | 
| 
      
 7 
     | 
    
         
            +
                  attr_accessor :version, :site, :uri
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def initialize(auth, options={})
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @site = options[:site] ? options[:site] : 'https://api.e.360.cn'
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @version = options[:version] ? options[:version] : '1.0'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    if auth.is_a?(Qihu::Auth)
         
     | 
| 
      
 14 
     | 
    
         
            +
                      auth.token.client.site = @site
         
     | 
| 
      
 15 
     | 
    
         
            +
                      @auth = auth
         
     | 
| 
      
 16 
     | 
    
         
            +
                    else
         
     | 
| 
      
 17 
     | 
    
         
            +
                      raise 'auth must be "DianJing::Auth" instance.'
         
     | 
| 
      
 18 
     | 
    
         
            +
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  def authorize_url(redirect_uri:'', scope:'basic', display:'default')
         
     | 
| 
      
 22 
     | 
    
         
            +
                    @redirect_uri = redirect_uri unless redirect_uri.empty?
         
     | 
| 
      
 23 
     | 
    
         
            +
                    @oauth2.auth_code.authorize_url(:redirect_uri => @redirect_uri, :scope => scope, :display => display)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def get_token(code, redirect_uri:'')
         
     | 
| 
      
 27 
     | 
    
         
            +
                    @redirect_uri = redirect_uri unless redirect_uri.empty?
         
     | 
| 
      
 28 
     | 
    
         
            +
                    @token = @oauth2.auth_code.get_token(code, :redirect_uri => @redirect_uri)
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                    @token = _get_api_token(@token.token)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def account
         
     | 
| 
      
 34 
     | 
    
         
            +
                    @account ||= Qihu::DianJing::API::Account.new(self)
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  def campaign
         
     | 
| 
      
 38 
     | 
    
         
            +
                    @campaign ||= Qihu::DianJing::API::Campaign.new(self)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  def group
         
     | 
| 
      
 42 
     | 
    
         
            +
                    @group ||= Qihu::DianJing::API::Group.new(self)
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  def creative
         
     | 
| 
      
 46 
     | 
    
         
            +
                    @creative ||= Qihu::DianJing::API::Creative.new(self)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def keyword
         
     | 
| 
      
 50 
     | 
    
         
            +
                    @keyword ||= Qihu::DianJing::API::Keyword.new(self)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  def report
         
     | 
| 
      
 54 
     | 
    
         
            +
                    @report ||= Qihu::DianJing::API::Report.new(self)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  def tool
         
     | 
| 
      
 58 
     | 
    
         
            +
                    @tool ||= Qihu::DianJing::API::Tool.new(self)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                  private
         
     | 
| 
      
 62 
     | 
    
         
            +
                    def _get_api_token(access_token)
         
     | 
| 
      
 63 
     | 
    
         
            +
                      @oauth2.site = @site
         
     | 
| 
      
 64 
     | 
    
         
            +
                      @token = OAuth2::AccessToken.new(@oauth2, access_token)
         
     | 
| 
      
 65 
     | 
    
         
            +
                    end
         
     | 
| 
      
 66 
     | 
    
         
            +
                end
         
     | 
| 
      
 67 
     | 
    
         
            +
              end
         
     | 
| 
      
 68 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Qihu
         
     | 
| 
      
 2 
     | 
    
         
            +
              module DianJing
         
     | 
| 
      
 3 
     | 
    
         
            +
              end
         
     | 
| 
      
 4 
     | 
    
         
            +
            end
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            require "qihu/dianjing/client"
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            require "qihu/dianjing/api/base"
         
     | 
| 
      
 9 
     | 
    
         
            +
            require "qihu/dianjing/api/account"
         
     | 
| 
      
 10 
     | 
    
         
            +
            require "qihu/dianjing/api/campaign"
         
     | 
| 
      
 11 
     | 
    
         
            +
            require "qihu/dianjing/api/group"
         
     | 
| 
      
 12 
     | 
    
         
            +
            require "qihu/dianjing/api/creative"
         
     | 
| 
      
 13 
     | 
    
         
            +
            require "qihu/dianjing/api/keyword"
         
     | 
| 
      
 14 
     | 
    
         
            +
            require "qihu/dianjing/api/report"
         
     | 
| 
      
 15 
     | 
    
         
            +
            require "qihu/dianjing/api/tool"
         
     | 
    
        data/lib/qihu/version.rb
    ADDED
    
    
    
        data/lib/qihu.rb
    ADDED
    
    
    
        data/qihu360.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'qihu/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "qihu360"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = Qihu::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["icyleaf"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["icyleaf.cn@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.description   = %q{Qihu 360.cn OAuth2 & Dianjing(Advertising system) API wrapper}
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = %q{Qihu 360.cn OAuth2 & Dianjing API wrapper}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.homepage      = "https://github.com/icyleaf/qihu360"
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              spec.files         = `git ls-files`.split($/)
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.3"
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency "rake"
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_dependency "oauth2", "~> 0.9.2"
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_dependency "multi_json", "~> 1.0"
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_dependency "multi_xml", "~> 0.5"
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Qihu::Auth do
         
     | 
| 
      
 4 
     | 
    
         
            +
              client_id     = ""
         
     | 
| 
      
 5 
     | 
    
         
            +
              client_secret = ""
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              subject do
         
     | 
| 
      
 8 
     | 
    
         
            +
                Qihu::Auth.new(client_id, client_secret)
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              describe "#初始化" do
         
     | 
| 
      
 12 
     | 
    
         
            +
                it "检查 OAuth2 client id 和 secret" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  expect(subject.oauth2.id).to eq(client_id)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  expect(subject.oauth2.secret).to eq(client_secret)
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                it "检查 OAuth2 域名" do
         
     | 
| 
      
 18 
     | 
    
         
            +
                  expect(subject.oauth2.site).to eq('https://openapi.360.cn')
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                it "检查 redirect_uri" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  expect(subject.redirect_uri).to eq('oob')
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                it "是否可以设置 redirect_uri" do
         
     | 
| 
      
 26 
     | 
    
         
            +
                  subject.redirect_uri = "http://icyleaf.com"
         
     | 
| 
      
 27 
     | 
    
         
            +
                  expect(subject.redirect_uri).to eq("http://icyleaf.com")
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                it "是否关闭了 ssl 的验证" do
         
     | 
| 
      
 31 
     | 
    
         
            +
                  expect(subject.oauth2.connection.ssl).to eq({:verify => false})
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              describe "#验证" do
         
     | 
| 
      
 36 
     | 
    
         
            +
                it "检查默认的 /oauth2/authorize 路径" do
         
     | 
| 
      
 37 
     | 
    
         
            +
                  expect(subject.authorize_url).to match("https://openapi.360.cn/oauth2/authorize")
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                it "是否可以设置 authorize_url" do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  expect(subject.authorize_url :display => 'desktop').to match('display=desktop')
         
     | 
| 
      
 42 
     | 
    
         
            +
                  expect(subject.authorize_url :scope => 'all').to match('scope=all')
         
     | 
| 
      
 43 
     | 
    
         
            +
                  expect(subject.authorize_url :redirect_uri => 'icyleaf.com').to match('redirect_uri=icyleaf.com')
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Qihu::DianJing::Client do
         
     | 
| 
      
 4 
     | 
    
         
            +
              client_id     = ""
         
     | 
| 
      
 5 
     | 
    
         
            +
              client_secret = ""
         
     | 
| 
      
 6 
     | 
    
         
            +
              access_token  = ""
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              subject do
         
     | 
| 
      
 9 
     | 
    
         
            +
                auth = Qihu::Auth.new(client_id, client_secret, token={
         
     | 
| 
      
 10 
     | 
    
         
            +
                  :access_token => access_token,
         
     | 
| 
      
 11 
     | 
    
         
            +
                })
         
     | 
| 
      
 12 
     | 
    
         
            +
                Qihu::DianJing::Client.new(auth)
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              describe "#初始化" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                it "检查 api 版本和域名" do
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expect(subject.version).to eq('1.0')
         
     | 
| 
      
 18 
     | 
    
         
            +
                  expect(subject.site).to eq('https://api.e.360.cn')
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                it "是否可以设置 api 版本和域名" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  subject.version = '2.0'
         
     | 
| 
      
 23 
     | 
    
         
            +
                  expect(subject.version).to eq("2.0")
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  subject.site = "http://api.360.cn"
         
     | 
| 
      
 26 
     | 
    
         
            +
                  expect(subject.site).to eq("http://api.360.cn")
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'qihu'
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,141 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: qihu360
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.12
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - icyleaf
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-08-22 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.3'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.3'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: oauth2
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 0.9.2
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 0.9.2
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: multi_json
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: multi_xml
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0.5'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0.5'
         
     | 
| 
      
 83 
     | 
    
         
            +
            description: Qihu 360.cn OAuth2 & Dianjing(Advertising system) API wrapper
         
     | 
| 
      
 84 
     | 
    
         
            +
            email:
         
     | 
| 
      
 85 
     | 
    
         
            +
            - icyleaf.cn@gmail.com
         
     | 
| 
      
 86 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 87 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 88 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 89 
     | 
    
         
            +
            files:
         
     | 
| 
      
 90 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 91 
     | 
    
         
            +
            - .rspec
         
     | 
| 
      
 92 
     | 
    
         
            +
            - .rvmrc
         
     | 
| 
      
 93 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 94 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 95 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 96 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 97 
     | 
    
         
            +
            - lib/qihu.rb
         
     | 
| 
      
 98 
     | 
    
         
            +
            - lib/qihu/auth.rb
         
     | 
| 
      
 99 
     | 
    
         
            +
            - lib/qihu/dianjing.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - lib/qihu/dianjing/api/account.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - lib/qihu/dianjing/api/base.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib/qihu/dianjing/api/campaign.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - lib/qihu/dianjing/api/creative.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
            - lib/qihu/dianjing/api/group.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - lib/qihu/dianjing/api/keyword.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - lib/qihu/dianjing/api/report.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - lib/qihu/dianjing/api/tool.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - lib/qihu/dianjing/client.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - lib/qihu/version.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - qihu360.gemspec
         
     | 
| 
      
 111 
     | 
    
         
            +
            - spec/qihu/auth_spec.rb
         
     | 
| 
      
 112 
     | 
    
         
            +
            - spec/qihu/dianjing/client_spec.rb
         
     | 
| 
      
 113 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 114 
     | 
    
         
            +
            homepage: https://github.com/icyleaf/qihu360
         
     | 
| 
      
 115 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 116 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 117 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 118 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 119 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 120 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 121 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 122 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 123 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 124 
     | 
    
         
            +
              - - '>='
         
     | 
| 
      
 125 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 126 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 127 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 128 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 129 
     | 
    
         
            +
              - - '>='
         
     | 
| 
      
 130 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 131 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 132 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 133 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 134 
     | 
    
         
            +
            rubygems_version: 2.0.7
         
     | 
| 
      
 135 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 136 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 137 
     | 
    
         
            +
            summary: Qihu 360.cn OAuth2 & Dianjing API wrapper
         
     | 
| 
      
 138 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 139 
     | 
    
         
            +
            - spec/qihu/auth_spec.rb
         
     | 
| 
      
 140 
     | 
    
         
            +
            - spec/qihu/dianjing/client_spec.rb
         
     | 
| 
      
 141 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |