class Qihu::DianJing::Client
Attributes
auth[R]
site[RW]
uri[RW]
version[RW]
Public Class Methods
new(auth, options={})
click to toggle source
# File lib/qihu/dianjing/client.rb, line 9 def initialize(auth, options={}) @site = options[:site] ? options[:site] : 'https://api.e.360.cn' @version = options[:version] ? options[:version] : '1.0' if auth.is_a?(Qihu::Auth) auth.token.client.site = @site @auth = auth else raise 'auth must be "DianJing::Auth" instance.' end end
Public Instance Methods
account()
click to toggle source
# File lib/qihu/dianjing/client.rb, line 33 def account @account ||= Qihu::DianJing::API::Account.new(self) end
campaign()
click to toggle source
# File lib/qihu/dianjing/client.rb, line 37 def campaign @campaign ||= Qihu::DianJing::API::Campaign.new(self) end
creative()
click to toggle source
# File lib/qihu/dianjing/client.rb, line 45 def creative @creative ||= Qihu::DianJing::API::Creative.new(self) end
get_token(code, redirect_uri:'')
click to toggle source
# File lib/qihu/dianjing/client.rb, line 26 def get_token(code, redirect_uri:'') @redirect_uri = redirect_uri unless redirect_uri.empty? @token = @oauth2.auth_code.get_token(code, :redirect_uri => @redirect_uri) @token = _get_api_token(@token.token) end
group()
click to toggle source
# File lib/qihu/dianjing/client.rb, line 41 def group @group ||= Qihu::DianJing::API::Group.new(self) end
keyword()
click to toggle source
# File lib/qihu/dianjing/client.rb, line 49 def keyword @keyword ||= Qihu::DianJing::API::Keyword.new(self) end
report()
click to toggle source
# File lib/qihu/dianjing/client.rb, line 53 def report @report ||= Qihu::DianJing::API::Report.new(self) end
tool()
click to toggle source
# File lib/qihu/dianjing/client.rb, line 57 def tool @tool ||= Qihu::DianJing::API::Tool.new(self) end
Private Instance Methods
_get_api_token(access_token)
click to toggle source
# File lib/qihu/dianjing/client.rb, line 62 def _get_api_token(access_token) @oauth2.site = @site @token = OAuth2::AccessToken.new(@oauth2, access_token) end