Class: SwaggerClient::FacetsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_client/api/facets_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FacetsApi

Returns a new instance of FacetsApi.



19
20
21
# File 'lib/swagger_client/api/facets_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/swagger_client/api/facets_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_facets(api_key, fields, opts = {}) ⇒ Array<FacetItem>

Facets

Merged with the /search API - Please check the ‘facets’ parameter to the Search API above

Get the facets for the given simple filter criteria (by given VIN’s basic specification, Or by Year, Make, Model, Trim criteria) and facet fields

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • fields

    Comma separated list of fields to generate facets for. Supported fields are - year, make, model, trim, exterior_color, interior_color, drivetrain, vehicle_type, car_type, body_style, body_subtype, doors

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

    the optional parameters

Options Hash (opts):

  • :vin (String)

    VIN as a reference to the type of car for which facets data is to be returned

  • :year (String)

    Year of the car

  • :make (String)

    Make of the car

  • :model (String)

    Model of the Car

  • :trim (String)

    Trim of the Car

Returns:



34
35
36
37
# File 'lib/swagger_client/api/facets_api.rb', line 34

def get_facets(api_key, fields, opts = {})
  data, status_code, headers = get_facets_with_http_info(api_key, fields, opts)
  return data
end

#get_facets_with_http_info(api_key, fields, opts = {}) ⇒ Array<(Array<FacetItem>, Fixnum, Hash)>

Facets

Merged with the /search API - Please check the &#39;facets&#39; parameter to the Search API above

Get the facets for the given simple filter criteria (by given VIN&#39;s basic specification, Or by Year, Make, Model, Trim criteria) and facet fields

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • fields

    Comma separated list of fields to generate facets for. Supported fields are - year, make, model, trim, exterior_color, interior_color, drivetrain, vehicle_type, car_type, body_style, body_subtype, doors

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

    the optional parameters

Options Hash (opts):

  • :vin (String)

    VIN as a reference to the type of car for which facets data is to be returned

  • :year (String)

    Year of the car

  • :make (String)

    Make of the car

  • :model (String)

    Model of the Car

  • :trim (String)

    Trim of the Car

Returns:

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

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



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
94
95
96
97
98
99
100
101
102
103
# File 'lib/swagger_client/api/facets_api.rb', line 50

def get_facets_with_http_info(api_key, fields, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: FacetsApi#get_facets ..."
  end
  
  # verify the required parameter 'api_key' is set
  fail "Missing the required parameter 'api_key' when calling get_facets" if api_key.nil?
  
  # verify the required parameter 'fields' is set
  fail "Missing the required parameter 'fields' when calling get_facets" if fields.nil?
  
  # resource path
  local_var_path = "/facets".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'api_key'] = api_key
  query_params[:'fields'] = fields
  query_params[:'vin'] = opts[:'vin'] if opts[:'vin']
  query_params[:'year'] = opts[:'year'] if opts[:'year']
  query_params[:'make'] = opts[:'make'] if opts[:'make']
  query_params[:'model'] = opts[:'model'] if opts[:'model']
  query_params[:'trim'] = opts[:'trim'] if opts[:'trim']

  # 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 = []
  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 = []
  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<FacetItem>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FacetsApi#get_facets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end