make methods private
This commit is contained in:
parent
60ce5bb082
commit
9ddc8b85dc
|
@ -29,7 +29,6 @@ module Google
|
||||||
# @return [Object] Storage object.
|
# @return [Object] Storage object.
|
||||||
attr_accessor :store
|
attr_accessor :store
|
||||||
|
|
||||||
|
|
||||||
# @return [Signet::OAuth2::Client]
|
# @return [Signet::OAuth2::Client]
|
||||||
attr_reader :authorization
|
attr_reader :authorization
|
||||||
|
|
||||||
|
@ -43,9 +42,16 @@ module Google
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Attempt to read in credentials from the specified store.
|
# Write the credentials to the specified store.
|
||||||
def load_credentials
|
#
|
||||||
store.load_credentials
|
# @params [Signet::OAuth2::Client] authorization
|
||||||
|
# Optional authorization instance. If not provided, the authorization
|
||||||
|
# already associated with this instance will be written.
|
||||||
|
def write_credentials(authorization=nil)
|
||||||
|
@authorization = authorization if authorization
|
||||||
|
if @authorization.refresh_token
|
||||||
|
store.write_credentials(credentials_hash)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorize
|
def authorize
|
||||||
|
@ -64,6 +70,14 @@ module Google
|
||||||
self.write_credentials
|
self.write_credentials
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
##
|
||||||
|
# Attempt to read in credentials from the specified store.
|
||||||
|
def load_credentials
|
||||||
|
store.load_credentials
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# @return [Hash] with credentials
|
# @return [Hash] with credentials
|
||||||
def credentials_hash
|
def credentials_hash
|
||||||
|
@ -78,19 +92,6 @@ module Google
|
||||||
:issued_at => @authorization.issued_at.to_i
|
:issued_at => @authorization.issued_at.to_i
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# Write the credentials to the specified store.
|
|
||||||
#
|
|
||||||
# @params [Signet::OAuth2::Client] authorization
|
|
||||||
# Optional authorization instance. If not provided, the authorization
|
|
||||||
# already associated with this instance will be written.
|
|
||||||
def write_credentials(authorization=nil)
|
|
||||||
@authorization = authorization if authorization
|
|
||||||
if @authorization.refresh_token
|
|
||||||
store.write_credentials(credentials_hash)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue