Sha256: 6786b3e5009bb80318d96ee86d74e7255f3f498ec8f1d2ac29e3b09da1eb70f2

Contents?: true

Size: 1.27 KB

Versions: 14

Compression:

Stored size: 1.27 KB

Contents

module Fog
  module DNS
    class Google
      ##
      # Fetches the representation of an existing Change.
      #
      # @see https://developers.google.com/cloud-dns/api/v1beta1/changes/get
      class Real
        def get_change(zone_name_or_id, identity)
          api_method = @dns.changes.get
          parameters = {
            'project' => @project,
            'managedZone' => zone_name_or_id,
            'changeId' => identity,
          }

          request(api_method, parameters)
        end
      end

      class Mock
        def get_change(zone_name_or_id, identity)
          if self.data[:managed_zones].has_key?(zone_name_or_id)
            zone = self.data[:managed_zones][zone_name_or_id]
          else
            zone = self.data[:managed_zones].values.find { |zone| zone['name'] = zone_name_or_id }
          end

          unless zone
            raise Fog::Errors::NotFound, "The 'parameters.managedZone' resource named '#{zone_name_or_id}' does not exist."
          end

          unless data = self.data[:changes][zone['id']].find { |c| c['id'] == identity }
            raise Fog::Errors::NotFound, "The 'parameters.changeId' resource named '#{identity}' does not exist."
          end

          build_excon_response(data)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
fog-google-0.0.9 lib/fog/google/requests/dns/get_change.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-google-0.0.7/lib/fog/google/requests/dns/get_change.rb
fog-google-0.0.7 lib/fog/google/requests/dns/get_change.rb
fog-google-0.0.6 lib/fog/google/requests/dns/get_change.rb
fog-google-0.0.5 lib/fog/google/requests/dns/get_change.rb
fog-google-0.0.4 lib/fog/google/requests/dns/get_change.rb
fog-google-0.0.3 lib/fog/google/requests/dns/get_change.rb
fog-google-0.0.2 lib/fog/google/requests/dns/get_change.rb
fog-1.29.0 lib/fog/google/requests/dns/get_change.rb
fog-1.28.0 lib/fog/google/requests/dns/get_change.rb
fog-1.27.0 lib/fog/google/requests/dns/get_change.rb
fog-1.26.0 lib/fog/google/requests/dns/get_change.rb
fog-1.25.0 lib/fog/google/requests/dns/get_change.rb
nsidc-fog-1.24.1 lib/fog/google/requests/dns/get_change.rb