Class: Acquia::Cloud::Site

Inherits:
Entity
  • Object
show all
Defined in:
lib/acquia/cloud/site.rb

Instance Attribute Summary collapse

Attributes inherited from Entity

#url

Instance Method Summary collapse

Methods inherited from Entity

#refresh

Constructor Details

#initialize(cloud, name) ⇒ Site

Returns a new instance of Site.



8
9
10
11
12
# File 'lib/acquia/cloud/site.rb', line 8

def initialize(cloud, name)
  @cloud = cloud
  @name = name
  @url = "/sites/#{name}"
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/acquia/cloud/site.rb', line 6

def name
  @name
end

Instance Method Details

#copy_files(from, to) ⇒ Object



42
43
44
# File 'lib/acquia/cloud/site.rb', line 42

def copy_files(from, to)
  Task.new @cloud, @name, @cloud.api.post("#{@url}/files-copy/#{from}/#{to}")
end

#database(name) ⇒ Object



62
63
64
# File 'lib/acquia/cloud/site.rb', line 62

def database(name)
  Database.new(@cloud, @name, {'name' => name}).refresh
end

#databasesObject



56
57
58
59
60
# File 'lib/acquia/cloud/site.rb', line 56

def databases
  @cloud.api.get("#{@url}/dbs").map do |db|
    Database.new(@cloud, @name, db)
  end
end

#environment(name) ⇒ Object



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

def environment(name)
  Environment.new(@cloud, @name, {'name' => name}).refresh
end

#environmentsObject



46
47
48
49
50
# File 'lib/acquia/cloud/site.rb', line 46

def environments
  @cloud.api.get("#{@url}/envs").map do |environment|
    Environment.new(@cloud, @name, environment)
  end
end

#production_modeObject



26
27
28
# File 'lib/acquia/cloud/site.rb', line 26

def production_mode
  data['production_mode'].to_i != 0
end

#task(id) ⇒ Object



72
73
74
# File 'lib/acquia/cloud/site.rb', line 72

def task(id)
  Task.new(@cloud, @name, {'id' => id}).refresh
end

#tasksObject



66
67
68
69
70
# File 'lib/acquia/cloud/site.rb', line 66

def tasks
  @cloud.api.get("#{@url}/tasks").map do |task|
    Task.new(@cloud, @name, task)
  end
end

#titleObject



34
35
36
# File 'lib/acquia/cloud/site.rb', line 34

def title
  data['title']
end

#unix_usernameObject



30
31
32
# File 'lib/acquia/cloud/site.rb', line 30

def unix_username
  data['unix_username']
end

#uuidObject



38
39
40
# File 'lib/acquia/cloud/site.rb', line 38

def uuid
  data['uuid']
end

#vcs_typeObject



18
19
20
# File 'lib/acquia/cloud/site.rb', line 18

def vcs_type
  data['vcs_type'].to_sym
end

#vcs_urlObject



22
23
24
# File 'lib/acquia/cloud/site.rb', line 22

def vcs_url
  data['vcs_url']
end