Class: BitBalloon::Sites

Inherits:
CollectionProxy show all
Defined in:
lib/bitballoon/sites.rb

Instance Attribute Summary

Attributes inherited from CollectionProxy

#client, #prefix

Instance Method Summary collapse

Methods inherited from CollectionProxy

#all, #each, #get, #initialize, model, #model, path, #path

Constructor Details

This class inherits a constructor from BitBalloon::CollectionProxy

Instance Method Details

#create(attributes = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/bitballoon/sites.rb', line 8

def create(attributes = {})
  response = client.request(:post, path, :body => Site.new(client, {}).send(:mutable_attributes, attributes))
  Site.new(client, response.parsed).tap do |site|
    if attributes[:zip] || attributes[:dir]
      deploy = site.deploys.create(attributes)
      site.deploy_id = deploy.id
    end
  end
end