Class: BitBalloon::Deploys
- Inherits:
-
CollectionProxy
- Object
- CollectionProxy
- BitBalloon::Deploys
- Defined in:
- lib/bitballoon/deploys.rb
Instance Attribute Summary
Attributes inherited from CollectionProxy
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
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bitballoon/deploys.rb', line 7 def create(attributes) if attributes[:dir] response = client.request(:post, path, :body => JSON.generate({:files => inventory(attributes[:dir]), :draft => attributes[:draft] || false}), :headers => {"Content-Type" => "application/json"} ) Deploy.new(client, response.parsed).tap do |deploy| deploy.upload_dir(attributes[:dir]) end elsif attributes[:zip] request_path = attributes[:draft] ? "#{path}?draft=true" : path response = client.request(:post, request_path, :body => ::File.read(attributes[:zip]), :headers => {"Content-Type" => "application/zip"} ) Deploy.new(client, response.parsed) else raise "Need dir or zip to create a deploy" end end |
#draft(attributes) ⇒ Object
28 29 30 |
# File 'lib/bitballoon/deploys.rb', line 28 def draft(attributes) create(attributes.merge(:draft => true)) end |