Updating CLI and explorer to match recent changes.
git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@65 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef
This commit is contained in:
parent
ecf330f177
commit
be265da6d4
|
@ -161,6 +161,7 @@ def oauth_login(options={})
|
|||
end
|
||||
|
||||
def execute(options={})
|
||||
require 'signet/oauth_1/client'
|
||||
config_file = File.expand_path('~/.google-api.yaml')
|
||||
signed = File.exist?(config_file)
|
||||
rpcname = ARGV.detect { |p| p =~ /^[a-z0-9_-]+\.[a-z0-9_\.-]+$/i }
|
||||
|
@ -171,7 +172,10 @@ def execute(options={})
|
|||
exit(1)
|
||||
end
|
||||
service_name = options[:service_name] || rpcname[/^([^\.]+)\./, 1]
|
||||
client = Google::APIClient.new(:service => service_name)
|
||||
client = Google::APIClient.new(
|
||||
:service => service_name,
|
||||
:authorization => :oauth_1
|
||||
)
|
||||
if signed
|
||||
if !client.authorization.kind_of?(Signet::OAuth1::Client)
|
||||
STDERR.puts(
|
||||
|
@ -190,7 +194,8 @@ def execute(options={})
|
|||
config["token_credential_secret"]
|
||||
end
|
||||
service_version =
|
||||
options[:service_version] || client.latest_service(service_name).version
|
||||
options[:service_version] ||
|
||||
client.latest_service_version(service_name).version
|
||||
service = client.discovered_service(service_name, service_version)
|
||||
method = service.to_h[rpcname]
|
||||
if !method
|
||||
|
|
|
@ -23,6 +23,8 @@ rescue LoadError
|
|||
exit(1)
|
||||
end
|
||||
|
||||
enable :sessions
|
||||
|
||||
CSS = <<-CSS
|
||||
/* http://meyerweb.com/eric/tools/css/reset/ */
|
||||
/* v1.0 | 20080212 */
|
||||
|
@ -308,7 +310,7 @@ end
|
|||
|
||||
def service(service_name, service_version)
|
||||
unless service_version
|
||||
service_version = client.latest_service(service_name).version
|
||||
service_version = client.latest_service_version(service_name).version
|
||||
end
|
||||
client.discovered_service(service_name, service_version)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue