Class: Morpheus::WhitelabelSettingsInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::WhitelabelSettingsInterface
- Defined in:
- lib/morpheus/api/whitelabel_settings_interface.rb
Instance Method Summary collapse
- #base_path ⇒ Object
- #download_image(image_type, outfile, params = {}) ⇒ Object
- #get(params = {}) ⇒ Object
- #reset_image(image_type, params = {}) ⇒ Object
- #update(payload, params = {}) ⇒ Object
- #update_images(payload, params = {}) ⇒ Object
Instance Method Details
#base_path ⇒ Object
5 6 7 |
# File 'lib/morpheus/api/whitelabel_settings_interface.rb', line 5 def base_path "/api/whitelabel-settings" end |
#download_image(image_type, outfile, params = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/morpheus/api/whitelabel_settings_interface.rb', line 34 def download_image(image_type, outfile, params={}) url = "#{base_path}/images/#{image_type}" headers = { params: params, :authorization => "Bearer #{@access_token}" } opts = {method: :get, url: url, headers: headers, timeout: 172800} if @dry_run return opts end http_response = nil File.open(outfile, 'w') {|f| block = proc { |response| response.read_body do |chunk| # writing to #{outfile} ..." f.write chunk end } opts[:block_response] = block http_response = Morpheus::RestClient.execute(opts) } http_response end |
#get(params = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/morpheus/api/whitelabel_settings_interface.rb', line 9 def get(params={}) url = base_path headers = { params: params, authorization: "Bearer #{@access_token}" } execute(method: :get, url: url, headers: headers) end |
#reset_image(image_type, params = {}) ⇒ Object
28 29 30 31 32 |
# File 'lib/morpheus/api/whitelabel_settings_interface.rb', line 28 def reset_image(image_type, params={}) url = "#{base_path}/images/#{image_type}" headers = { params: params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :delete, url: url, headers: headers) end |
#update(payload, params = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/morpheus/api/whitelabel_settings_interface.rb', line 15 def update(payload, params={}) url = base_path headers = { params: params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } execute(method: :put, url: url, headers: headers, payload: payload.to_json) end |
#update_images(payload, params = {}) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/morpheus/api/whitelabel_settings_interface.rb', line 21 def update_images(payload, params={}) url = "#{base_path}/images" headers = { params: params, :authorization => "Bearer #{@access_token}" } payload[:multipart] = true execute(method: :post, url: url, headers: headers, payload: payload) end |