Sha256: 55dd5483f3c0b4b0f6af32172d75d4909eb97349ded9e38285eda1571012c6b3

Contents?: true

Size: 1.1 KB

Versions: 15

Compression:

Stored size: 1.1 KB

Contents

class Ey::Core::Client
  class Real
    def create_backup(params={})
      id  = params["id"]
      url = params["url"]

      request(
        :method => :post,
        :path   => "backups/#{id}",
        :url    => url,
        :body   => params,
      )
    end
  end # Real

  class Mock
    def create_backup(params={})
      resource_id = self.uuid

      cluster_id = if params["url"] # provided scope
                     path_params(params["url"])["clusters"]
                   elsif current_server
                     path_params(current_server["cluster"])["clusters"]
                   end
      find(:clusters, cluster_id)


      resource = params["backup"].dup

      resource.merge!(
        "id"         => resource_id,
        "files"      => url_for("/backups/#{resource_id}/files"),
        "cluster"    => url_for("/clusters/#{cluster_id}"),
        "created_at" => Time.now,
        "updated_at" => Time.now,
      )

      self.data[:backups][resource_id] = resource

      response(
        :body   => {"backup" => resource},
        :status => 201,
      )
    end
  end # Mock
end # Ey::Core::Client

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ey-pro-cli-0.0.17 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.16 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.15 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.14 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.13 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.12 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.11 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.10 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.9 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.8 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.7 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.6 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.5 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.4 lib/vendor/core/ey-core/requests/create_backup.rb
ey-pro-cli-0.0.3 lib/vendor/core/ey-core/requests/create_backup.rb