Class: SubskribeSandboxClient::AttachmentsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/subskribe_sandbox/api/attachments_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AttachmentsApi

Returns a new instance of AttachmentsApi.



19
20
21
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_attachment_to_account(account_id, opts = {}) ⇒ Attachment

Add an attachment Attaches a document to the specified account. The post body should contain the body of the document that is to be attached. On success the Id of the attachment is returned.

Parameters:

  • account_id

    id of the account to attach the document to

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

    the optional parameters

Options Hash (opts):

  • :file (File)
  • :file_name (String)

    name to associate with the attachment

  • :description (String)

    description of the document

  • :size (Integer)

    size in bytes of the document

  • :tag (String)

    tag to apply to the attachment

Returns:



32
33
34
35
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 32

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#add_attachment_to_account_with_http_info(account_id, opts = {}) ⇒ Array<(Attachment, Fixnum, Hash)>

Add an attachment Attaches a document to the specified account. The post body should contain the body of the document that is to be attached. On success the Id of the attachment is returned.

Parameters:

  • account_id

    id of the account to attach the document to

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

    the optional parameters

Options Hash (opts):

  • :file (File)
  • :file_name (String)

    name to associate with the attachment

  • :description (String)

    description of the document

  • :size (Integer)

    size in bytes of the document

  • :tag (String)

    tag to apply to the attachment

Returns:

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

    Attachment data, response status code and response headers



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 47

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentsApi.add_attachment_to_account ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AttachmentsApi.add_attachment_to_account"
  end
  if @api_client.config.client_side_validation && opts[:'tag'] && !['MASTER_SUBSCRIPTION_AGREEMENT', 'STATEMENT_OF_WORK', 'ORDER_FORM', 'OTHER'].include?(opts[:'tag'])
    fail ArgumentError, 'invalid value for "tag", must be one of MASTER_SUBSCRIPTION_AGREEMENT, STATEMENT_OF_WORK, ORDER_FORM, OTHER'
  end
  # resource path
  local_var_path = '/attachments/account/{accountId}'.sub('{' + 'accountId' + '}', .to_s)

  # query parameters
  query_params = {}
  query_params[:'fileName'] = opts[:'file_name'] if !opts[:'file_name'].nil?
  query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Attachment')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentsApi#add_attachment_to_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_attachment_from_account(attachment_id, opts = {}) ⇒ nil

Delete an attachment Unattaches and deletes the specified document

Parameters:

  • attachment_id

    id of the attachment

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

    the optional parameters

Returns:

  • (nil)


99
100
101
102
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 99

def (attachment_id, opts = {})
  (attachment_id, opts)
  nil
end

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

Delete an attachment Unattaches and deletes the specified document

Parameters:

  • attachment_id

    id of the attachment

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
135
136
137
138
139
140
141
142
143
144
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 109

def (attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentsApi.delete_attachment_from_account ...'
  end
  # verify the required parameter 'attachment_id' is set
  if @api_client.config.client_side_validation && attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentsApi.delete_attachment_from_account"
  end
  # resource path
  local_var_path = '/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', attachment_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_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: AttachmentsApi#delete_attachment_from_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_attachment(attachment_id, opts = {}) ⇒ nil

Get attachment contents Gets the contents of the specified attachment

Parameters:

  • attachment_id

    id of the attachment

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

    the optional parameters

Returns:

  • (nil)


150
151
152
153
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 150

def get_attachment(attachment_id, opts = {})
  get_attachment_with_http_info(attachment_id, opts)
  nil
end

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

Get attachment contents Gets the contents of the specified attachment

Parameters:

  • attachment_id

    id of the attachment

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 160

def get_attachment_with_http_info(attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentsApi.get_attachment ...'
  end
  # verify the required parameter 'attachment_id' is set
  if @api_client.config.client_side_validation && attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'attachment_id' when calling AttachmentsApi.get_attachment"
  end
  # resource path
  local_var_path = '/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', attachment_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_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: AttachmentsApi#get_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_account_attachments(account_id, opts = {}) ⇒ Array<Attachment>

Get attachments for an account Lists all the documents attached to an account

Parameters:

  • account_id

    id of the attachment

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

    the optional parameters

Returns:



201
202
203
204
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 201

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#list_account_attachments_with_http_info(account_id, opts = {}) ⇒ Array<(Array<Attachment>, Fixnum, Hash)>

Get attachments for an account Lists all the documents attached to an account

Parameters:

  • account_id

    id of the attachment

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

    the optional parameters

Returns:

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

    Array<Attachment> data, response status code and response headers



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 211

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentsApi.list_account_attachments ...'
  end
  # verify the required parameter 'account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'account_id' when calling AttachmentsApi.list_account_attachments"
  end
  # resource path
  local_var_path = '/attachments/account/{accountId}'.sub('{' + 'accountId' + '}', .to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Attachment>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentsApi#list_account_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#modify_attachment(opts = {}) ⇒ Attachment

Update the details of an attachment Updates the details of the specified document

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Attachment)

    json representing the attachment

Returns:



253
254
255
256
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 253

def modify_attachment(opts = {})
  data, _status_code, _headers = modify_attachment_with_http_info(opts)
  data
end

#modify_attachment_with_http_info(opts = {}) ⇒ Array<(Attachment, Fixnum, Hash)>

Update the details of an attachment Updates the details of the specified document

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Attachment)

    json representing the attachment

Returns:

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

    Attachment data, response status code and response headers



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/subskribe_sandbox/api/attachments_api.rb', line 263

def modify_attachment_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AttachmentsApi.modify_attachment ...'
  end
  # resource path
  local_var_path = '/attachments'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Attachment')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AttachmentsApi#modify_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end