X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b8301b0dd57e3a77871af3292bbe275ae92d5d3f..b2343e24a5dc6592a73f5bc2c7e1244a1b3ab9e0:/lib/google/api_client/discovery/api.rb diff --git a/lib/google/api_client/discovery/api.rb b/lib/google/api_client/discovery/api.rb index db5e97ea7c..be83f6279f 100644 --- a/lib/google/api_client/discovery/api.rb +++ b/lib/google/api_client/discovery/api.rb @@ -14,8 +14,8 @@ require 'addressable/uri' - -require 'google/inflection' +require 'multi_json' +require 'active_support/inflector' require 'google/api_client/discovery/resource' require 'google/api_client/discovery/method' require 'google/api_client/discovery/media' @@ -29,13 +29,9 @@ module Google ## # Creates a description of a particular version of a service. # - # @param [String] api - # The identifier for the service. Note that while this frequently - # matches the first segment of all of the service's RPC names, this - # should not be assumed. There is no requirement that these match. - # @param [String] version - # The identifier for the service version. - # @param [Hash] api_description + # @param [String] document_base + # Base URI for the service + # @param [Hash] discovery_document # The section of the discovery document that applies to this service # version. # @@ -43,20 +39,23 @@ module Google def initialize(document_base, discovery_document) @document_base = Addressable::URI.parse(document_base) @discovery_document = discovery_document - metaclass = (class <", self.class.to_s, self.object_id, self.id ) end + + ## + # Marshalling support - serialize the API to a string (doc base + original + # discovery document). + def _dump(level) + MultiJson.dump([@document_base.to_s, @discovery_document]) + end + + ## + # Marshalling support - Restore an API instance from serialized form + def self._load(obj) + new(*MultiJson.load(obj)) + end + end end end