From 3dcd88a884d18ae35979e2bcf211c42d4a5ef7ca Mon Sep 17 00:00:00 2001 From: Steven Bazyl Date: Thu, 4 Oct 2012 15:48:21 -0700 Subject: [PATCH] Expose discovery doc in prep for future doc changes --- lib/google/api_client/discovery/api.rb | 3 +++ lib/google/api_client/discovery/method.rb | 18 +++++++++++------- lib/google/api_client/discovery/resource.rb | 18 +++++++++++------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/lib/google/api_client/discovery/api.rb b/lib/google/api_client/discovery/api.rb index 6d9b07d2a..68dc2cfa0 100644 --- a/lib/google/api_client/discovery/api.rb +++ b/lib/google/api_client/discovery/api.rb @@ -53,6 +53,9 @@ module Google end end end + + # @return [String] unparsed discovery document for the API + attr_reader :discovery_document ## # Returns the id of the service. diff --git a/lib/google/api_client/discovery/method.rb b/lib/google/api_client/discovery/method.rb index 057a1ef0c..76bb741d7 100644 --- a/lib/google/api_client/discovery/method.rb +++ b/lib/google/api_client/discovery/method.rb @@ -45,6 +45,9 @@ module Google @discovery_document = discovery_document end + # @return [String] unparsed discovery document for the method + attr_reader :discovery_document + ## # Returns the API this method belongs to. # @@ -57,13 +60,6 @@ module Google # @return [String] The method identifier. attr_reader :name - ## - # Returns the parsed section of the discovery document that applies to - # this method. - # - # @return [Hash] The method description. - attr_reader :description - ## # Returns the base URI for the method. # @@ -81,6 +77,14 @@ module Google @uri_template = nil end + ## + # Returns a human-readable description of the method. + # + # @return [Hash] The API description. + def description + return @discovery_document['description'] + end + ## # Returns the method ID. # diff --git a/lib/google/api_client/discovery/resource.rb b/lib/google/api_client/discovery/resource.rb index 71515a513..f6493ff40 100644 --- a/lib/google/api_client/discovery/resource.rb +++ b/lib/google/api_client/discovery/resource.rb @@ -58,25 +58,29 @@ module Google end end + # @return [String] unparsed discovery document for the resource + attr_reader :discovery_document + ## # Returns the identifier for the resource. # # @return [String] The resource identifier. attr_reader :name - ## - # Returns the parsed section of the discovery document that applies to - # this resource. - # - # @return [Hash] The resource description. - attr_reader :description - ## # Returns the base URI for this resource. # # @return [Addressable::URI] The base URI that methods are joined to. attr_reader :method_base + ## + # Returns a human-readable description of the resource. + # + # @return [Hash] The API description. + def description + return @discovery_document['description'] + end + ## # Updates the hierarchy of resources and methods with the new base. #