Class: Fastly::CustomerApi

Inherits:
Object
  • Object
show all
Defined in:
lib/fastly/api/customer_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CustomerApi

Returns a new instance of CustomerApi.



17
18
19
# File 'lib/fastly/api/customer_api.rb', line 17

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



15
16
17
# File 'lib/fastly/api/customer_api.rb', line 15

def api_client
  @api_client
end

Instance Method Details

#delete_customer(opts = {}) ⇒ InlineResponse200

Delete a customer Delete a customer.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • :customer_id (String)

    Alphanumeric string identifying the customer. (required)

Returns:



24
25
26
27
# File 'lib/fastly/api/customer_api.rb', line 24

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

#delete_customer_with_http_info(opts = {}) ⇒ Array<(InlineResponse200, Integer, Hash)>

Delete a customer Delete a customer.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • :customer_id (String)

    Alphanumeric string identifying the customer. (required)

Returns:

  • (Array<(InlineResponse200, Integer, Hash)>)

    InlineResponse200 data, response status code and response headers



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
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/fastly/api/customer_api.rb', line 33

def delete_customer_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.delete_customer ...'
  end
  # unbox the parameters from the hash
  customer_id = opts[:'customer_id']
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.delete_customer"
  end
  # resource path
  local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

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

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse200'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"CustomerApi.delete_customer",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#delete_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_customer(opts = {}) ⇒ CustomerResponse

Get a customer Get a specific customer.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • :customer_id (String)

    Alphanumeric string identifying the customer. (required)

Returns:



87
88
89
90
# File 'lib/fastly/api/customer_api.rb', line 87

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

#get_customer_with_http_info(opts = {}) ⇒ Array<(CustomerResponse, Integer, Hash)>

Get a customer Get a specific customer.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • :customer_id (String)

    Alphanumeric string identifying the customer. (required)

Returns:

  • (Array<(CustomerResponse, Integer, Hash)>)

    CustomerResponse data, response status code and response headers



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

def get_customer_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'
  end
  # unbox the parameters from the hash
  customer_id = opts[:'customer_id']
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.get_customer"
  end
  # resource path
  local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

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

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CustomerResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"CustomerApi.get_customer",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#get_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_logged_in_customer(opts = {}) ⇒ CustomerResponse

Get the logged in customer Get the logged in customer.

Returns:



149
150
151
152
# File 'lib/fastly/api/customer_api.rb', line 149

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

#get_logged_in_customer_with_http_info(opts = {}) ⇒ Array<(CustomerResponse, Integer, Hash)>

Get the logged in customer Get the logged in customer.

Returns:

  • (Array<(CustomerResponse, Integer, Hash)>)

    CustomerResponse data, response status code and response headers



157
158
159
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
196
197
198
199
200
# File 'lib/fastly/api/customer_api.rb', line 157

def get_logged_in_customer_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.get_logged_in_customer ...'
  end
  # unbox the parameters from the hash
  # resource path
  local_var_path = '/current_customer'

  # query parameters
  query_params = opts[:query_params] || {}

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

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CustomerResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"CustomerApi.get_logged_in_customer",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#get_logged_in_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_users(opts = {}) ⇒ Array<SchemasUserResponse>

List users List all users from a specified customer id.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • :customer_id (String)

    Alphanumeric string identifying the customer. (required)

Returns:



206
207
208
209
# File 'lib/fastly/api/customer_api.rb', line 206

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

#list_users_with_http_info(opts = {}) ⇒ Array<(Array<SchemasUserResponse>, Integer, Hash)>

List users List all users from a specified customer id.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • :customer_id (String)

    Alphanumeric string identifying the customer. (required)

Returns:

  • (Array<(Array<SchemasUserResponse>, Integer, Hash)>)

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



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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/fastly/api/customer_api.rb', line 215

def list_users_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.list_users ...'
  end
  # unbox the parameters from the hash
  customer_id = opts[:'customer_id']
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.list_users"
  end
  # resource path
  local_var_path = '/customer/{customer_id}/users'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

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

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<SchemasUserResponse>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"CustomerApi.list_users",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#list_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_customer(opts = {}) ⇒ CustomerResponse

Update a customer Update a customer.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • :customer_id (String)

    Alphanumeric string identifying the customer. (required)

  • :billing_contact_id (String)

    The alphanumeric string representing the primary billing contact.

  • :billing_network_type (String)

    Customer&#39;s current network revenue type.

  • :billing_ref (String)

    Used for adding purchased orders to customer&#39;s account.

  • :can_configure_wordpress (Boolean)

    Whether this customer can view or edit wordpress.

  • :can_reset_passwords (Boolean)

    Whether this customer can reset passwords.

  • :can_upload_vcl (Boolean)

    Whether this customer can upload VCL.

  • :force_2fa (Boolean)

    Specifies whether 2FA is forced or not forced on the customer account. Logs out non-2FA users once 2FA is force enabled.

  • :force_sso (Boolean)

    Specifies whether SSO is forced or not forced on the customer account.

  • :has_account_panel (Boolean)

    Specifies whether the account has access or does not have access to the account panel.

  • :has_improved_events (Boolean)

    Specifies whether the account has access or does not have access to the improved events.

  • :has_improved_ssl_config (Boolean)

    Whether this customer can view or edit the SSL config.

  • :has_openstack_logging (Boolean)

    Specifies whether the account has enabled or not enabled openstack logging.

  • :has_pci (Boolean)

    Specifies whether the account can edit PCI for a service.

  • :has_pci_passwords (Boolean)

    Specifies whether PCI passwords are required for the account.

  • :ip_whitelist (String)

    The range of IP addresses authorized to access the customer account.

  • :legal_contact_id (String)

    The alphanumeric string identifying the account&#39;s legal contact.

  • :name (String)

    The name of the customer, generally the company name.

  • :owner_id (String)

    The alphanumeric string identifying the account owner.

  • :phone_number (String)

    The phone number associated with the account.

  • :postal_address (String)

    The postal address associated with the account.

  • :pricing_plan (String)

    The pricing plan this customer is under.

  • :pricing_plan_id (String)

    The alphanumeric string identifying the pricing plan.

  • :security_contact_id (String)

    The alphanumeric string identifying the account&#39;s security contact.

  • :technical_contact_id (String)

    The alphanumeric string identifying the account&#39;s technical contact.

Returns:



293
294
295
296
# File 'lib/fastly/api/customer_api.rb', line 293

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

#update_customer_with_http_info(opts = {}) ⇒ Array<(CustomerResponse, Integer, Hash)>

Update a customer Update a customer.

Parameters:

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

    a customizable set of options

Options Hash (opts):

  • :customer_id (String)

    Alphanumeric string identifying the customer. (required)

  • :billing_contact_id (String)

    The alphanumeric string representing the primary billing contact.

  • :billing_network_type (String)

    Customer&#39;s current network revenue type.

  • :billing_ref (String)

    Used for adding purchased orders to customer&#39;s account.

  • :can_configure_wordpress (Boolean)

    Whether this customer can view or edit wordpress.

  • :can_reset_passwords (Boolean)

    Whether this customer can reset passwords.

  • :can_upload_vcl (Boolean)

    Whether this customer can upload VCL.

  • :force_2fa (Boolean)

    Specifies whether 2FA is forced or not forced on the customer account. Logs out non-2FA users once 2FA is force enabled.

  • :force_sso (Boolean)

    Specifies whether SSO is forced or not forced on the customer account.

  • :has_account_panel (Boolean)

    Specifies whether the account has access or does not have access to the account panel.

  • :has_improved_events (Boolean)

    Specifies whether the account has access or does not have access to the improved events.

  • :has_improved_ssl_config (Boolean)

    Whether this customer can view or edit the SSL config.

  • :has_openstack_logging (Boolean)

    Specifies whether the account has enabled or not enabled openstack logging.

  • :has_pci (Boolean)

    Specifies whether the account can edit PCI for a service.

  • :has_pci_passwords (Boolean)

    Specifies whether PCI passwords are required for the account.

  • :ip_whitelist (String)

    The range of IP addresses authorized to access the customer account.

  • :legal_contact_id (String)

    The alphanumeric string identifying the account&#39;s legal contact.

  • :name (String)

    The name of the customer, generally the company name.

  • :owner_id (String)

    The alphanumeric string identifying the account owner.

  • :phone_number (String)

    The phone number associated with the account.

  • :postal_address (String)

    The postal address associated with the account.

  • :pricing_plan (String)

    The pricing plan this customer is under.

  • :pricing_plan_id (String)

    The alphanumeric string identifying the pricing plan.

  • :security_contact_id (String)

    The alphanumeric string identifying the account&#39;s security contact.

  • :technical_contact_id (String)

    The alphanumeric string identifying the account&#39;s technical contact.

Returns:

  • (Array<(CustomerResponse, Integer, Hash)>)

    CustomerResponse data, response status code and response headers



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/fastly/api/customer_api.rb', line 326

def update_customer_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomerApi.update_customer ...'
  end
  # unbox the parameters from the hash
  customer_id = opts[:'customer_id']
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.update_customer"
  end
  allowable_values = ["public", "private"]
  if @api_client.config.client_side_validation && opts[:'billing_network_type'] && !allowable_values.include?(opts[:'billing_network_type'])
    fail ArgumentError, "invalid value for \"billing_network_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['billing_contact_id'] = opts[:'billing_contact_id'] if !opts[:'billing_contact_id'].nil?
  form_params['billing_network_type'] = opts[:'billing_network_type'] if !opts[:'billing_network_type'].nil?
  form_params['billing_ref'] = opts[:'billing_ref'] if !opts[:'billing_ref'].nil?
  form_params['can_configure_wordpress'] = opts[:'can_configure_wordpress'] if !opts[:'can_configure_wordpress'].nil?
  form_params['can_reset_passwords'] = opts[:'can_reset_passwords'] if !opts[:'can_reset_passwords'].nil?
  form_params['can_upload_vcl'] = opts[:'can_upload_vcl'] if !opts[:'can_upload_vcl'].nil?
  form_params['force_2fa'] = opts[:'force_2fa'] if !opts[:'force_2fa'].nil?
  form_params['force_sso'] = opts[:'force_sso'] if !opts[:'force_sso'].nil?
  form_params['has_account_panel'] = opts[:'has_account_panel'] if !opts[:'has_account_panel'].nil?
  form_params['has_improved_events'] = opts[:'has_improved_events'] if !opts[:'has_improved_events'].nil?
  form_params['has_improved_ssl_config'] = opts[:'has_improved_ssl_config'] if !opts[:'has_improved_ssl_config'].nil?
  form_params['has_openstack_logging'] = opts[:'has_openstack_logging'] if !opts[:'has_openstack_logging'].nil?
  form_params['has_pci'] = opts[:'has_pci'] if !opts[:'has_pci'].nil?
  form_params['has_pci_passwords'] = opts[:'has_pci_passwords'] if !opts[:'has_pci_passwords'].nil?
  form_params['ip_whitelist'] = opts[:'ip_whitelist'] if !opts[:'ip_whitelist'].nil?
  form_params['legal_contact_id'] = opts[:'legal_contact_id'] if !opts[:'legal_contact_id'].nil?
  form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
  form_params['owner_id'] = opts[:'owner_id'] if !opts[:'owner_id'].nil?
  form_params['phone_number'] = opts[:'phone_number'] if !opts[:'phone_number'].nil?
  form_params['postal_address'] = opts[:'postal_address'] if !opts[:'postal_address'].nil?
  form_params['pricing_plan'] = opts[:'pricing_plan'] if !opts[:'pricing_plan'].nil?
  form_params['pricing_plan_id'] = opts[:'pricing_plan_id'] if !opts[:'pricing_plan_id'].nil?
  form_params['security_contact_id'] = opts[:'security_contact_id'] if !opts[:'security_contact_id'].nil?
  form_params['technical_contact_id'] = opts[:'technical_contact_id'] if !opts[:'technical_contact_id'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CustomerResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"CustomerApi.update_customer",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomerApi#update_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end