Class: BitBalloon::Site

Inherits:
Model
  • Object
show all
Defined in:
lib/bitballoon/site.rb

Instance Attribute Summary

Attributes inherited from Model

#attributes, #client, #prefix

Instance Method Summary collapse

Methods inherited from Model

#collection, collection, #destroy, fields, #initialize, #path, #process, #refresh

Constructor Details

This class inherits a constructor from BitBalloon::Model

Instance Method Details

#deploysObject



56
57
58
# File 'lib/bitballoon/site.rb', line 56

def deploys
  Deploys.new(client, path)
end

#destroy!Object



35
36
37
38
# File 'lib/bitballoon/site.rb', line 35

def destroy!
  client.request(:delete, path)
  true
end

#error?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/bitballoon/site.rb', line 14

def error?
  state == "error"
end

#filesObject



48
49
50
# File 'lib/bitballoon/site.rb', line 48

def files
  Files.new(client, path)
end

#formsObject



40
41
42
# File 'lib/bitballoon/site.rb', line 40

def forms
  Forms.new(client, path)
end

#ready?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/bitballoon/site.rb', line 10

def ready?
  state == "current"
end

#snippetsObject



52
53
54
# File 'lib/bitballoon/site.rb', line 52

def snippets
  Snippets.new(client, path)
end

#submissionsObject



44
45
46
# File 'lib/bitballoon/site.rb', line 44

def submissions
  Submissions.new(client, path)
end

#update(attributes) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/bitballoon/site.rb', line 25

def update(attributes)
  response = client.request(:put, path, :body => mutable_attributes(attributes))
  process(response.parsed)
  if attributes[:zip] || attributes[:dir]
    deploy = deploys.create(attributes)
    self.deploy_id = deploy.id
  end
  self
end

#wait_for_ready(timeout = 900, &block) ⇒ Object



18
19
20
21
22
23
# File 'lib/bitballoon/site.rb', line 18

def wait_for_ready(timeout = 900, &block)
  deploy = deploys.get(deploy_id)
  raise "Error fetching deploy #{deploy_id}" unless deploy
  deploy.wait_for_ready(timeout, &block)
  self
end