class DealervaultApi::Delivery
Constants
- VALID_PARAMETERS
- VALID_VALUES
Attributes
api_client[RW]
Public Class Methods
new(api_client)
click to toggle source
# File lib/dealervault_api/api/delivery.rb, line 22 def initialize(api_client) @api_client = api_client @jwt = self.jwt_token end
Public Instance Methods
create(program_id, rooftop_id, file_type, delivery_type, options={})
click to toggle source
POST - Initiate a dealer delivery
# File lib/dealervault_api/api/delivery.rb, line 60 def create(program_id, rooftop_id, file_type, delivery_type, options={}) local_var_path = "delivery" options.merge!({type: delivery_type}) options = whitelist_params(options, VALID_PARAMETERS, :create) body = { programId: program_id, rooftopId: rooftop_id, fileType: file_type, options: options } body = @api_client.call_api(:POST, local_var_path, headers: {'X-Jwt-Token' => @jwt}, body: body) body end
data_set(request_id, page_size, params={})
click to toggle source
GET - Retrieves a paged data set.
# File lib/dealervault_api/api/delivery.rb, line 53 def data_set(request_id, page_size, params={}) local_var_path = "delivery" params.merge!({requestId: request_id, pageSize: page_size}) @api_client.call_api(:GET, local_var_path, headers: {'X-Jwt-Token' => @jwt}, query_params: params) end
feeds(program_id, compare_date, file_type_code='SL',params={} )
click to toggle source
GET - Retrieve feeds which DealerVault received updated data since the provided compare date.
# File lib/dealervault_api/api/delivery.rb, line 41 def feeds(program_id, compare_date, file_type_code='SL',params={} ) local_var_path = "vendor/#{program_id}/feeds/updated-data" if compare_date.class == DateTime compare_date = compare_date.to_time end params.merge!({fileTypeCode: file_type_code, compareDate: compare_date.utc.strftime("%FT%T%:z")}) params = whitelist_params(params, VALID_PARAMETERS, :feeds) @api_client.call_api(:GET, local_var_path, headers: {'X-Jwt-Token' => @jwt}, query_params: params) end
information(request_id)
click to toggle source
GET - Gets information about a delivery.
# File lib/dealervault_api/api/delivery.rb, line 35 def information(request_id) local_var_path = "delivery/#{request_id}" @api_client.call_api(:GET, local_var_path, headers: {'X-Jwt-Token' => @jwt}) end
jwt_token()
click to toggle source
GET - Acquires a JWT token for authentication. Token will be valid for 30 minutes.
# File lib/dealervault_api/api/delivery.rb, line 28 def jwt_token local_var_path = 'token' body = @api_client.call_api(:GET, local_var_path) body['token'] end
whitelist_params(params, valid_params, key)
click to toggle source
# File lib/dealervault_api/api/delivery.rb, line 78 def whitelist_params(params, valid_params, key) params.slice(*valid_params[key]) end