Skip to content

Commit

Permalink
gree, mixi methods now accepts app_id.
Browse files Browse the repository at this point in the history
  • Loading branch information
xanagi committed Aug 26, 2011
1 parent 88e25ab commit 435699f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
7 changes: 7 additions & 0 deletions lib/opensocial-wap/oauth/helpers/basic_helper.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ def self.api_endpoint(arg = nil)
@api_endpoint if @api_endpoint @api_endpoint if @api_endpoint
end end


def self.app_id(arg = nil)
if arg
@app_id = arg
end
@app_id if @app_id
end

def self.proxy_class(arg = nil) def self.proxy_class(arg = nil)
if arg if arg
@proxy_class = arg @proxy_class = arg
Expand Down
11 changes: 1 addition & 10 deletions lib/opensocial-wap/oauth/helpers/mobage_helper.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module OpensocialWap::OAuth::Helpers


# mobage 用 oauthヘルパー. # mobage 用 oauthヘルパー.
# バッチタイプ(mobageではTrusted モデル)のリクエスト時には、xoauth_requestor_id # バッチタイプ(mobageではTrusted モデル)のリクエスト時には、xoauth_requestor_id
# としてapp_id を渡すところ、BasicHelper と異なる. # としてapp_id を渡すところが、BasicHelper と異なる.
class MobageHelper < BasicHelper class MobageHelper < BasicHelper


def authorization_header(api_request, options = nil) def authorization_header(api_request, options = nil)
Expand All @@ -17,14 +17,5 @@ def authorization_header(api_request, options = nil)
oauth_client_helper = ::OAuth::Client::Helper.new(api_request, opts.merge(options)) oauth_client_helper = ::OAuth::Client::Helper.new(api_request, opts.merge(options))
oauth_client_helper.header oauth_client_helper.header
end end

private

def self.app_id(arg = nil)
if arg
@app_id = arg
end
@app_id if @app_id
end
end end
end end
2 changes: 2 additions & 0 deletions lib/opensocial-wap/platform/gree.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ def gree(config, &block)


consumer_key = @consumer_key consumer_key = @consumer_key
consumer_secret = @consumer_secret consumer_secret = @consumer_secret
app_id = @app_id
container_host = @sandbox ? 'mgadget-sb.gree.jp' : "mgadget.gree.jp" container_host = @sandbox ? 'mgadget-sb.gree.jp' : "mgadget.gree.jp"
api_endpoint = @sandbox ? 'http://os-sb.gree.jp/api/rest/' : "http://os.gree.jp/api/rest/" api_endpoint = @sandbox ? 'http://os-sb.gree.jp/api/rest/' : "http://os.gree.jp/api/rest/"


OpensocialWap::OAuth::Helpers::BasicHelper.configure do OpensocialWap::OAuth::Helpers::BasicHelper.configure do
consumer_key consumer_key consumer_key consumer_key
consumer_secret consumer_secret consumer_secret consumer_secret
api_endpoint api_endpoint api_endpoint api_endpoint
app_id app_id
end end
@config.opensocial_wap.oauth = OpensocialWap::Config::OAuth.configure do @config.opensocial_wap.oauth = OpensocialWap::Config::OAuth.configure do
helper_class OpensocialWap::OAuth::Helpers::BasicHelper helper_class OpensocialWap::OAuth::Helpers::BasicHelper
Expand Down
2 changes: 2 additions & 0 deletions lib/opensocial-wap/platform/mixi.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ def mixi(config, &block)


consumer_key = @consumer_key consumer_key = @consumer_key
consumer_secret = @consumer_secret consumer_secret = @consumer_secret
app_id = @app_id
container_host = @access_from_pc ? 'ma.test.mixi.net' : 'ma.mixi.net' container_host = @access_from_pc ? 'ma.test.mixi.net' : 'ma.mixi.net'


OpensocialWap::OAuth::Helpers::BasicHelper.configure do OpensocialWap::OAuth::Helpers::BasicHelper.configure do
proxy_class OpensocialWap::OAuth::RequestProxy::OAuthRackRequestProxyForMixi proxy_class OpensocialWap::OAuth::RequestProxy::OAuthRackRequestProxyForMixi
consumer_key consumer_key consumer_key consumer_key
consumer_secret consumer_secret consumer_secret consumer_secret
api_endpoint 'http://api.mixi-platform.com/os/0.8/' api_endpoint 'http://api.mixi-platform.com/os/0.8/'
app_id app_id
end end
@config.opensocial_wap.oauth = OpensocialWap::Config::OAuth.configure do @config.opensocial_wap.oauth = OpensocialWap::Config::OAuth.configure do
helper_class OpensocialWap::OAuth::Helpers::BasicHelper helper_class OpensocialWap::OAuth::Helpers::BasicHelper
Expand Down
2 changes: 1 addition & 1 deletion lib/opensocial-wap/version.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,3 @@
module OpensocialWap module OpensocialWap
VERSION = "0.0.3" VERSION = "0.0.4"
end end
4 changes: 2 additions & 2 deletions spec/rails3/app_root/Gemfile.lock
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH PATH
remote: ../../../ remote: ../../../
specs: specs:
opensocial-wap (0.0.1) opensocial-wap (0.0.3)
oauth oauth
rack (>= 1.2.1) rack (>= 1.2.1)


Expand Down Expand Up @@ -68,7 +68,7 @@ GEM
treetop (~> 1.4.8) treetop (~> 1.4.8)
mime-types (1.16) mime-types (1.16)
nokogiri (1.4.4) nokogiri (1.4.4)
oauth (0.4.4) oauth (0.4.5)
polyglot (0.3.1) polyglot (0.3.1)
rack (1.2.1) rack (1.2.1)
rack-mount (0.6.13) rack-mount (0.6.13)
Expand Down

0 comments on commit 435699f

Please sign in to comment.