Class: Acquia::Cloud::Site
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Entity
Instance Method Summary collapse
- #copy_files(from, to) ⇒ Object
- #database(name) ⇒ Object
- #databases ⇒ Object
- #environment(name) ⇒ Object
- #environments ⇒ Object
-
#initialize(cloud, name) ⇒ Site
constructor
A new instance of Site.
- #production_mode ⇒ Object
- #task(id) ⇒ Object
- #tasks ⇒ Object
- #title ⇒ Object
- #unix_username ⇒ Object
- #uuid ⇒ Object
- #vcs_type ⇒ Object
- #vcs_url ⇒ Object
Methods inherited from Entity
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
#name ⇒ Object (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 |
#databases ⇒ Object
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 |
#environments ⇒ Object
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_mode ⇒ Object
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 |
#tasks ⇒ Object
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 |
#title ⇒ Object
34 35 36 |
# File 'lib/acquia/cloud/site.rb', line 34 def title data['title'] end |
#unix_username ⇒ Object
30 31 32 |
# File 'lib/acquia/cloud/site.rb', line 30 def unix_username data['unix_username'] end |
#uuid ⇒ Object
38 39 40 |
# File 'lib/acquia/cloud/site.rb', line 38 def uuid data['uuid'] end |
#vcs_type ⇒ Object
18 19 20 |
# File 'lib/acquia/cloud/site.rb', line 18 def vcs_type data['vcs_type'].to_sym end |
#vcs_url ⇒ Object
22 23 24 |
# File 'lib/acquia/cloud/site.rb', line 22 def vcs_url data['vcs_url'] end |