Module: CloudantBackup::Backup
- Included in:
- CloudantBackup
- Defined in:
- lib/cloudant_backup/backup.rb
Instance Attribute Summary collapse
-
#cloudant_host ⇒ Object
Returns the value of attribute cloudant_host.
-
#date_pattern ⇒ Object
Returns the value of attribute date_pattern.
-
#host ⇒ Object
writeonly
Sets the attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#source ⇒ Object
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#cloudant_host ⇒ Object
Returns the value of attribute cloudant_host.
7 8 9 |
# File 'lib/cloudant_backup/backup.rb', line 7 def cloudant_host @cloudant_host end |
#date_pattern ⇒ Object
Returns the value of attribute date_pattern.
7 8 9 |
# File 'lib/cloudant_backup/backup.rb', line 7 def date_pattern @date_pattern end |
#host=(host) ⇒ Object
Sets the attribute host
7 8 9 |
# File 'lib/cloudant_backup/backup.rb', line 7 def host=(value) @host = value end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/cloudant_backup/backup.rb', line 7 def password @password end |
#source ⇒ Object
Returns the value of attribute source.
7 8 9 |
# File 'lib/cloudant_backup/backup.rb', line 7 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
7 8 9 |
# File 'lib/cloudant_backup/backup.rb', line 7 def target @target end |
#user ⇒ Object
Returns the value of attribute user.
7 8 9 |
# File 'lib/cloudant_backup/backup.rb', line 7 def user @user end |
Instance Method Details
#backup ⇒ Object
12 13 14 15 |
# File 'lib/cloudant_backup/backup.rb', line 12 def backup create_target_db replicate end |
#create_target_db ⇒ Object
17 18 19 20 21 |
# File 'lib/cloudant_backup/backup.rb', line 17 def create_target_db make_request(:put, target_db) rescue RestClient::PreconditionFailed # When the db existed already, we're fine with that end |
#initialize ⇒ Object
9 10 |
# File 'lib/cloudant_backup/backup.rb', line 9 def initialize end |
#replicate ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/cloudant_backup/backup.rb', line 23 def replicate data = { source: source_db_url, target: target_db_url }.to_json make_request(:post, "_replicate", data) end |