class Fastly::DictionaryItemApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/fastly/api/dictionary_item_api.rb, line 17
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

bulk_update_dictionary_item(opts = {}) click to toggle source

Update multiple entries in an edge dictionary Update multiple items in the same dictionary. For faster updates to your service, group your changes into large batches. The maximum batch size is 1000 items. [Contact support](support.fastly.com/) to discuss raising this limit. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [BulkUpdateDictionaryListRequest] :bulk_update_dictionary_list_request @return [InlineResponse200]

# File lib/fastly/api/dictionary_item_api.rb, line 26
def bulk_update_dictionary_item(opts = {})
  data, _status_code, _headers = bulk_update_dictionary_item_with_http_info(opts)
  data
end
bulk_update_dictionary_item_with_http_info(opts = {}) click to toggle source

Update multiple entries in an edge dictionary Update multiple items in the same dictionary. For faster updates to your service, group your changes into large batches. The maximum batch size is 1000 items. [Contact support](support.fastly.com/) to discuss raising this limit. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [BulkUpdateDictionaryListRequest] :bulk_update_dictionary_list_request @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers

# File lib/fastly/api/dictionary_item_api.rb, line 37
def bulk_update_dictionary_item_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DictionaryItemApi.bulk_update_dictionary_item ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  dictionary_id = opts[:'dictionary_id']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling DictionaryItemApi.bulk_update_dictionary_item"
  end
  # verify the required parameter 'dictionary_id' is set
  if @api_client.config.client_side_validation && dictionary_id.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_id' when calling DictionaryItemApi.bulk_update_dictionary_item"
  end
  # resource path
  local_var_path = '/service/{service_id}/dictionary/{dictionary_id}/items'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'dictionary_id' + '}', CGI.escape(dictionary_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/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'bulk_update_dictionary_list_request'])

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

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

  new_options = opts.merge(
    :operation => :"DictionaryItemApi.bulk_update_dictionary_item",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DictionaryItemApi#bulk_update_dictionary_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_dictionary_item(opts = {}) click to toggle source

Create an entry in an edge dictionary Create DictionaryItem given service, dictionary ID, item key, and item value. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :item_key Item key, maximum 256 characters. @option opts [String] :item_value Item value, maximum 8000 characters. @return [DictionaryItemResponse]

# File lib/fastly/api/dictionary_item_api.rb, line 104
def create_dictionary_item(opts = {})
  data, _status_code, _headers = create_dictionary_item_with_http_info(opts)
  data
end
create_dictionary_item_with_http_info(opts = {}) click to toggle source

Create an entry in an edge dictionary Create DictionaryItem given service, dictionary ID, item key, and item value. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :item_key Item key, maximum 256 characters. @option opts [String] :item_value Item value, maximum 8000 characters. @return [Array<(DictionaryItemResponse, Integer, Hash)>] DictionaryItemResponse data, response status code and response headers

# File lib/fastly/api/dictionary_item_api.rb, line 116
def create_dictionary_item_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DictionaryItemApi.create_dictionary_item ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  dictionary_id = opts[:'dictionary_id']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling DictionaryItemApi.create_dictionary_item"
  end
  # verify the required parameter 'dictionary_id' is set
  if @api_client.config.client_side_validation && dictionary_id.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_id' when calling DictionaryItemApi.create_dictionary_item"
  end
  # resource path
  local_var_path = '/service/{service_id}/dictionary/{dictionary_id}/item'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'dictionary_id' + '}', CGI.escape(dictionary_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['item_key'] = opts[:'item_key'] if !opts[:'item_key'].nil?
  form_params['item_value'] = opts[:'item_value'] if !opts[:'item_value'].nil?

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

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

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

  new_options = opts.merge(
    :operation => :"DictionaryItemApi.create_dictionary_item",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DictionaryItemApi#create_dictionary_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_dictionary_item(opts = {}) click to toggle source

Delete an item from an edge dictionary Delete DictionaryItem given service, dictionary ID, and item key. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :dictionary_item_key Item key, maximum 256 characters. (required) @return [InlineResponse200]

# File lib/fastly/api/dictionary_item_api.rb, line 184
def delete_dictionary_item(opts = {})
  data, _status_code, _headers = delete_dictionary_item_with_http_info(opts)
  data
end
delete_dictionary_item_with_http_info(opts = {}) click to toggle source

Delete an item from an edge dictionary Delete DictionaryItem given service, dictionary ID, and item key. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :dictionary_item_key Item key, maximum 256 characters. (required) @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers

# File lib/fastly/api/dictionary_item_api.rb, line 195
def delete_dictionary_item_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DictionaryItemApi.delete_dictionary_item ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  dictionary_id = opts[:'dictionary_id']
  dictionary_item_key = opts[:'dictionary_item_key']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling DictionaryItemApi.delete_dictionary_item"
  end
  # verify the required parameter 'dictionary_id' is set
  if @api_client.config.client_side_validation && dictionary_id.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_id' when calling DictionaryItemApi.delete_dictionary_item"
  end
  # verify the required parameter 'dictionary_item_key' is set
  if @api_client.config.client_side_validation && dictionary_item_key.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_item_key' when calling DictionaryItemApi.delete_dictionary_item"
  end
  # resource path
  local_var_path = '/service/{service_id}/dictionary/{dictionary_id}/item/{dictionary_item_key}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'dictionary_id' + '}', CGI.escape(dictionary_id.to_s)).sub('{' + 'dictionary_item_key' + '}', CGI.escape(dictionary_item_key.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 => :"DictionaryItemApi.delete_dictionary_item",
    :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: DictionaryItemApi#delete_dictionary_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_dictionary_item(opts = {}) click to toggle source

Get an item from an edge dictionary Retrieve a single DictionaryItem given service, dictionary ID and item key. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :dictionary_item_key Item key, maximum 256 characters. (required) @return [DictionaryItemResponse]

# File lib/fastly/api/dictionary_item_api.rb, line 261
def get_dictionary_item(opts = {})
  data, _status_code, _headers = get_dictionary_item_with_http_info(opts)
  data
end
get_dictionary_item_with_http_info(opts = {}) click to toggle source

Get an item from an edge dictionary Retrieve a single DictionaryItem given service, dictionary ID and item key. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :dictionary_item_key Item key, maximum 256 characters. (required) @return [Array<(DictionaryItemResponse, Integer, Hash)>] DictionaryItemResponse data, response status code and response headers

# File lib/fastly/api/dictionary_item_api.rb, line 272
def get_dictionary_item_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DictionaryItemApi.get_dictionary_item ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  dictionary_id = opts[:'dictionary_id']
  dictionary_item_key = opts[:'dictionary_item_key']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling DictionaryItemApi.get_dictionary_item"
  end
  # verify the required parameter 'dictionary_id' is set
  if @api_client.config.client_side_validation && dictionary_id.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_id' when calling DictionaryItemApi.get_dictionary_item"
  end
  # verify the required parameter 'dictionary_item_key' is set
  if @api_client.config.client_side_validation && dictionary_item_key.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_item_key' when calling DictionaryItemApi.get_dictionary_item"
  end
  # resource path
  local_var_path = '/service/{service_id}/dictionary/{dictionary_id}/item/{dictionary_item_key}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'dictionary_id' + '}', CGI.escape(dictionary_id.to_s)).sub('{' + 'dictionary_item_key' + '}', CGI.escape(dictionary_item_key.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] || 'DictionaryItemResponse'

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

  new_options = opts.merge(
    :operation => :"DictionaryItemApi.get_dictionary_item",
    :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: DictionaryItemApi#get_dictionary_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_dictionary_items(opts = {}) click to toggle source

List items in an edge dictionary List of DictionaryItems given service and dictionary ID. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [Integer] :page Current page. @option opts [Integer] :per_page Number of records per page. (default to 20) @option opts [String] :sort Field on which to sort. (default to ‘created’) @option opts [String] :direction Direction in which to sort results. (default to ‘ascend’) @return [Array<DictionaryItemResponse>]

# File lib/fastly/api/dictionary_item_api.rb, line 341
def list_dictionary_items(opts = {})
  data, _status_code, _headers = list_dictionary_items_with_http_info(opts)
  data
end
list_dictionary_items_with_http_info(opts = {}) click to toggle source

List items in an edge dictionary List of DictionaryItems given service and dictionary ID. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [Integer] :page Current page. @option opts [Integer] :per_page Number of records per page. (default to 20) @option opts [String] :sort Field on which to sort. (default to ‘created’) @option opts [String] :direction Direction in which to sort results. (default to ‘ascend’) @return [Array<(Array<DictionaryItemResponse>, Integer, Hash)>] Array<DictionaryItemResponse> data, response status code and response headers

# File lib/fastly/api/dictionary_item_api.rb, line 355
def list_dictionary_items_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DictionaryItemApi.list_dictionary_items ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  dictionary_id = opts[:'dictionary_id']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling DictionaryItemApi.list_dictionary_items"
  end
  # verify the required parameter 'dictionary_id' is set
  if @api_client.config.client_side_validation && dictionary_id.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_id' when calling DictionaryItemApi.list_dictionary_items"
  end
  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling DictionaryItemApi.list_dictionary_items, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling DictionaryItemApi.list_dictionary_items, must be greater than or equal to 1.'
  end

  allowable_values = ["ascend", "descend"]
  if @api_client.config.client_side_validation && opts[:'direction'] && !allowable_values.include?(opts[:'direction'])
    fail ArgumentError, "invalid value for \"direction\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/service/{service_id}/dictionary/{dictionary_id}/items'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'dictionary_id' + '}', CGI.escape(dictionary_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?

  # 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<DictionaryItemResponse>'

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

  new_options = opts.merge(
    :operation => :"DictionaryItemApi.list_dictionary_items",
    :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: DictionaryItemApi#list_dictionary_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_dictionary_item(opts = {}) click to toggle source

Update an entry in an edge dictionary Update DictionaryItem given service, dictionary ID, item key, and item value. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :dictionary_item_key Item key, maximum 256 characters. (required) @option opts [String] :item_key Item key, maximum 256 characters. @option opts [String] :item_value Item value, maximum 8000 characters. @return [DictionaryItemResponse]

# File lib/fastly/api/dictionary_item_api.rb, line 434
def update_dictionary_item(opts = {})
  data, _status_code, _headers = update_dictionary_item_with_http_info(opts)
  data
end
update_dictionary_item_with_http_info(opts = {}) click to toggle source

Update an entry in an edge dictionary Update DictionaryItem given service, dictionary ID, item key, and item value. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :dictionary_item_key Item key, maximum 256 characters. (required) @option opts [String] :item_key Item key, maximum 256 characters. @option opts [String] :item_value Item value, maximum 8000 characters. @return [Array<(DictionaryItemResponse, Integer, Hash)>] DictionaryItemResponse data, response status code and response headers

# File lib/fastly/api/dictionary_item_api.rb, line 447
def update_dictionary_item_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DictionaryItemApi.update_dictionary_item ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  dictionary_id = opts[:'dictionary_id']
  dictionary_item_key = opts[:'dictionary_item_key']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling DictionaryItemApi.update_dictionary_item"
  end
  # verify the required parameter 'dictionary_id' is set
  if @api_client.config.client_side_validation && dictionary_id.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_id' when calling DictionaryItemApi.update_dictionary_item"
  end
  # verify the required parameter 'dictionary_item_key' is set
  if @api_client.config.client_side_validation && dictionary_item_key.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_item_key' when calling DictionaryItemApi.update_dictionary_item"
  end
  # resource path
  local_var_path = '/service/{service_id}/dictionary/{dictionary_id}/item/{dictionary_item_key}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'dictionary_id' + '}', CGI.escape(dictionary_id.to_s)).sub('{' + 'dictionary_item_key' + '}', CGI.escape(dictionary_item_key.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['item_key'] = opts[:'item_key'] if !opts[:'item_key'].nil?
  form_params['item_value'] = opts[:'item_value'] if !opts[:'item_value'].nil?

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

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

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

  new_options = opts.merge(
    :operation => :"DictionaryItemApi.update_dictionary_item",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DictionaryItemApi#update_dictionary_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
upsert_dictionary_item(opts = {}) click to toggle source

Insert or update an entry in an edge dictionary Upsert DictionaryItem given service, dictionary ID, item key, and item value. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :dictionary_item_key Item key, maximum 256 characters. (required) @option opts [String] :item_key Item key, maximum 256 characters. @option opts [String] :item_value Item value, maximum 8000 characters. @return [DictionaryItemResponse]

# File lib/fastly/api/dictionary_item_api.rb, line 522
def upsert_dictionary_item(opts = {})
  data, _status_code, _headers = upsert_dictionary_item_with_http_info(opts)
  data
end
upsert_dictionary_item_with_http_info(opts = {}) click to toggle source

Insert or update an entry in an edge dictionary Upsert DictionaryItem given service, dictionary ID, item key, and item value. @option opts [String] :service_id Alphanumeric string identifying the service. (required) @option opts [String] :dictionary_id Alphanumeric string identifying a Dictionary. (required) @option opts [String] :dictionary_item_key Item key, maximum 256 characters. (required) @option opts [String] :item_key Item key, maximum 256 characters. @option opts [String] :item_value Item value, maximum 8000 characters. @return [Array<(DictionaryItemResponse, Integer, Hash)>] DictionaryItemResponse data, response status code and response headers

# File lib/fastly/api/dictionary_item_api.rb, line 535
def upsert_dictionary_item_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DictionaryItemApi.upsert_dictionary_item ...'
  end
  # unbox the parameters from the hash
  service_id = opts[:'service_id']
  dictionary_id = opts[:'dictionary_id']
  dictionary_item_key = opts[:'dictionary_item_key']
  # verify the required parameter 'service_id' is set
  if @api_client.config.client_side_validation && service_id.nil?
    fail ArgumentError, "Missing the required parameter 'service_id' when calling DictionaryItemApi.upsert_dictionary_item"
  end
  # verify the required parameter 'dictionary_id' is set
  if @api_client.config.client_side_validation && dictionary_id.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_id' when calling DictionaryItemApi.upsert_dictionary_item"
  end
  # verify the required parameter 'dictionary_item_key' is set
  if @api_client.config.client_side_validation && dictionary_item_key.nil?
    fail ArgumentError, "Missing the required parameter 'dictionary_item_key' when calling DictionaryItemApi.upsert_dictionary_item"
  end
  # resource path
  local_var_path = '/service/{service_id}/dictionary/{dictionary_id}/item/{dictionary_item_key}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'dictionary_id' + '}', CGI.escape(dictionary_id.to_s)).sub('{' + 'dictionary_item_key' + '}', CGI.escape(dictionary_item_key.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['item_key'] = opts[:'item_key'] if !opts[:'item_key'].nil?
  form_params['item_value'] = opts[:'item_value'] if !opts[:'item_value'].nil?

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

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

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

  new_options = opts.merge(
    :operation => :"DictionaryItemApi.upsert_dictionary_item",
    :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: DictionaryItemApi#upsert_dictionary_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end