Class: Crowbar::Client::Request::Backup::Upload

Inherits:
Crowbar::Client::Request::Base show all
Defined in:
lib/crowbar/client/request/backup/upload.rb

Overview

Implementation for the backup upload request

Instance Attribute Summary

Attributes inherited from Crowbar::Client::Request::Base

#attrs, #request

Instance Method Summary collapse

Methods inherited from Crowbar::Client::Request::Base

#initialize, #params, #process

Constructor Details

This class inherits a constructor from Crowbar::Client::Request::Base

Instance Method Details

#contentObject



38
39
40
41
42
43
44
# File 'lib/crowbar/client/request/backup/upload.rb', line 38

def content
  super.easy_merge!(
    backup: {
      file: attrs.file
    }
  )
end

#headersHash

Override the request headers

Returns:

  • (Hash)

    the headers for the request



32
33
34
35
36
# File 'lib/crowbar/client/request/backup/upload.rb', line 32

def headers
  super.easy_merge!(
    Crowbar::Client::Util::ApiVersion.new(Config.apiversion).headers
  )
end

#methodSymbol

HTTP method that gets used by the request

Returns:

  • (Symbol)

    the method for the request



51
52
53
# File 'lib/crowbar/client/request/backup/upload.rb', line 51

def method
  :post
end

#urlString

Path to the API endpoint for the request

Returns:

  • (String)

    path to the API endpoint



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/crowbar/client/request/backup/upload.rb', line 60

def url
  case Config.apiversion
  when 1.0
    [
      "utils",
      "backups",
      "upload"
    ]
  when 2.0
    [
      "api",
      "crowbar",
      "backups",
      "upload"
    ]
  end.join("/")
end