Class: PureCloud::DownloadsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/purecloud/api/downloads_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DownloadsApi

Returns a new instance of DownloadsApi.



7
8
9
# File 'lib/purecloud/api/downloads_api.rb', line 7

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



5
6
7
# File 'lib/purecloud/api/downloads_api.rb', line 5

def api_client
  @api_client
end

Instance Method Details

#get_callback(opts = {}) ⇒ nil

OAuth Callback used during code authorization grant flow.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :code (String)
  • :state (String)

Returns:

  • (nil)


17
18
19
20
# File 'lib/purecloud/api/downloads_api.rb', line 17

def get_callback(opts = {})
  get_callback_with_http_info(opts)
  return nil
end

#get_callback_with_http_info(opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

OAuth Callback used during code authorization grant flow.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :code (String)
  • :state (String)

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/purecloud/api/downloads_api.rb', line 28

def get_callback_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DownloadsApi#get_callback ..."
  end
  
  # resource path
  path = "/api/v2/downloads/callback".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'code'] = opts[:'code'] if opts[:'code']
  query_params[:'state'] = opts[:'state'] if opts[:'state']

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['PureCloud Auth']
  data, status_code, headers = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DownloadsApi#get_callback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_download_id(download_id, opts = {}) ⇒ UrlResponse

Issues a redirect to a signed secure download URL for specified download this method will issue a redirect to the url to the content

Parameters:

  • download_id

    Download ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :content_disposition (String)

Returns:



78
79
80
81
# File 'lib/purecloud/api/downloads_api.rb', line 78

def get_download_id(download_id, opts = {})
  data, status_code, headers = get_download_id_with_http_info(download_id, opts)
  return data
end

#get_download_id_with_http_info(download_id, opts = {}) ⇒ Array<(UrlResponse, Fixnum, Hash)>

Issues a redirect to a signed secure download URL for specified download this method will issue a redirect to the url to the content

Parameters:

  • download_id

    Download ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :content_disposition (String)

Returns:

  • (Array<(UrlResponse, Fixnum, Hash)>)

    UrlResponse data, response status code and response headers



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/purecloud/api/downloads_api.rb', line 89

def get_download_id_with_http_info(download_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DownloadsApi#get_download_id ..."
  end
  
  # verify the required parameter 'download_id' is set
  fail "Missing the required parameter 'download_id' when calling get_download_id" if download_id.nil?
  
  # resource path
  path = "/api/v2/downloads/{downloadId}".sub('{format}','json').sub('{' + 'downloadId' + '}', download_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'contentDisposition'] = opts[:'content_disposition'] if opts[:'content_disposition']

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  

  auth_names = ['PureCloud Auth']
  data, status_code, headers = @api_client.call_api(:GET, path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'UrlResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DownloadsApi#get_download_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end