lib/googleauth/client_id.rb in googleauth-0.6.2 vs lib/googleauth/client_id.rb in googleauth-0.6.3
- old
+ new
@@ -26,10 +26,11 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'multi_json'
+require 'googleauth/credentials_loader'
module Google
module Auth
# Representation of an application's identity for user authorization
# flows.
@@ -61,26 +62,27 @@
# Secret associated with the client ID
# @note Direction instantion is discouraged to avoid embedding IDs
# & secrets in source. See {#from_file} to load from
# `client_secrets.json` files.
def initialize(id, secret)
+ CredentialsLoader.warn_if_cloud_sdk_credentials id
raise 'Client id can not be nil' if id.nil?
raise 'Client secret can not be nil' if secret.nil?
@id = id
@secret = secret
end
- # Constructs a Client ID from a JSON file downloaed from the
+ # Constructs a Client ID from a JSON file downloaded from the
# Google Developers Console.
#
# @param [String, File] file
# Path of file to read from
# @return [Google::Auth::ClientID]
def self.from_file(file)
raise 'File can not be nil.' if file.nil?
File.open(file.to_s) do |f|
json = f.read
- config = MultiJson.load(json)
+ config = MultiJson.load json
from_hash(config)
end
end
# Constructs a Client ID from a previously loaded JSON file. The hash