| POST | /v1/OnlineShowroom/Stock | Search for Online Showroom Stock | Calls Vehicle Data API online showroom stock endpoint and searches for vehicles given a list of retailers. The results are used to populate the Online Showroom Stock datatable grid in OneAdmin |
|---|
# frozen_string_literal: true
# encoding: utf-8
require 'json'
require 'servicestack'
class StockDataRow
include ServiceStack::DTO
# @return [String]
attr_accessor :commission_number
# @return [String]
attr_accessor :description
# @return [String]
attr_accessor :sales_description_long
# @return [String]
attr_accessor :model
# @return [String]
attr_accessor :colour
# @return [String]
attr_accessor :colour_group
# @return [String]
attr_accessor :fuel_type
# @return [String]
attr_accessor :transmission
# @return [String]
attr_accessor :transmission_type
# @return [String]
attr_accessor :packages
# @return [String]
attr_accessor :lines
# @return [String]
attr_accessor :upholstery
# @return [String]
attr_accessor :upholstery_code
# @return [String]
attr_accessor :display_stock_agent
# @return [String]
attr_accessor :location
# @return [String]
attr_accessor :vin
# @return [String]
attr_accessor :vid
# @return [String]
attr_accessor :vehicle_type
# @return [String]
attr_accessor :vehicle_class
# @return [DateTime]
attr_accessor :creation_date
# @return [DateTime]
attr_accessor :last_updated
# @return [DateTime]
attr_accessor :port_arrival_date
# @return [BigDecimal]
attr_accessor :combined_gross_offer_value
# @return [String]
attr_accessor :current_location
# @return [TrueClass]
attr_accessor :not_visible_online_showroom
# @return [String]
attr_accessor :nvos_reason
# @return [TrueClass]
attr_accessor :nvos_reason_one_admin_excluded
# @return [TrueClass]
attr_accessor :nvos_reason_linked_to_back_order
# @return [TrueClass]
attr_accessor :included_after_deduplication
# @return [TrueClass]
attr_accessor :unique
# @return [TrueClass]
attr_accessor :duplicate
# @return [Integer]
attr_accessor :duplicate_group
# @return [TrueClass]
attr_accessor :lowest_comm
# @return [String]
attr_accessor :rule
# @return [String]
attr_accessor :fin
# @return [String]
attr_accessor :chassis_number
# @return [String]
attr_accessor :model_year
# @return [String]
attr_accessor :model_year_code
# @return [String]
attr_accessor :half_model_year_code
# @return [String]
attr_accessor :full_model_year_code
# @return [String]
attr_accessor :body_style
# @return [String]
attr_accessor :engine
# @return [String]
attr_accessor :cesar_id_ship_to_party
# @return [String]
attr_accessor :vehicle_usage_code
# @return [BigDecimal]
attr_accessor :acceleration
# @return [Integer]
attr_accessor :boot_capacity
# @return [BigDecimal]
attr_accessor :top_speed
# @return [String]
attr_accessor :drive_concept
# @return [BigDecimal]
attr_accessor :combustion_power_hp
# @return [BigDecimal]
attr_accessor :electric_power_kw
# @return [BigDecimal]
attr_accessor :electric_power_hp
# @return [BigDecimal]
attr_accessor :combined_power_kw
# @return [BigDecimal]
attr_accessor :combined_power_h_p
# @return [TrueClass]
attr_accessor :under_offer
# @return [TrueClass]
attr_accessor :is_sellable
# @return [TrueClass]
attr_accessor :mbuk_secured
# @return [TrueClass]
attr_accessor :is_display_stock
# @return [TrueClass]
attr_accessor :is_specialist_car
# @return [String]
attr_accessor :account
# @return [String]
attr_accessor :product_range
# @return [TrueClass]
attr_accessor :is_a_m_g
# @return [BigDecimal]
attr_accessor :actual_price
# @return [BigDecimal]
attr_accessor :retail_price__ex_v_a_t
# @return [BigDecimal]
attr_accessor :retail_price__inc_v_a_t
# @return [BigDecimal]
attr_accessor :otr
# @return [String]
attr_accessor :nst
# @return [String]
attr_accessor :bm7_n_s_t
# @return [BigDecimal]
attr_accessor :electric_range
# @return [BigDecimal]
attr_accessor :electric_consumption
# @return [BigDecimal]
attr_accessor :emission
# @return [String]
attr_accessor :emission_directive
# @return [String]
attr_accessor :emission_combined
# @return [String]
attr_accessor :emission_extra_urban
# @return [String]
attr_accessor :emission_urban
# @return [String]
attr_accessor :energy_efficiency_class
# @return [String]
attr_accessor :wltp_emission_combined
# @return [String]
attr_accessor :wltp_combined
# @return [String]
attr_accessor :wltp_low
# @return [String]
attr_accessor :wltp_medium
# @return [String]
attr_accessor :wltp_high
# @return [String]
attr_accessor :wltp_extra_high
# @return [BigDecimal]
attr_accessor :total_money_offers_excl_discretionary
# @return [BigDecimal]
attr_accessor :discretionary_money_offer
# @return [BigDecimal]
attr_accessor :total_money_offers_incl_discretionary
# @return [Integer]
attr_accessor :non_discretionary_n_m_o_count
# @return [Integer]
attr_accessor :non_discretionary_m_o_count
# @return [Integer]
attr_accessor :discretionary_n_m_o_count
# @return [Integer]
attr_accessor :discretionary_m_o_count
# @return [BigDecimal]
attr_accessor :total_offer_v_i_p_amount
# @return [String]
attr_accessor :stock_level_indicator
# @return [DateTime]
attr_accessor :confirmed_production_date
# @return [DateTime]
attr_accessor :forecasted_arrival_date
def self.properties
{
commission_number: { name: 'commissionNumber' },
description: { name: 'description' },
sales_description_long: { name: 'salesDescriptionLong' },
model: { name: 'model' },
colour: { name: 'colour' },
colour_group: { name: 'colourGroup' },
fuel_type: { name: 'fuelType' },
transmission: { name: 'transmission' },
transmission_type: { name: 'transmissionType' },
packages: { name: 'packages' },
lines: { name: 'lines' },
upholstery: { name: 'upholstery' },
upholstery_code: { name: 'upholsteryCode' },
display_stock_agent: { name: 'displayStockAgent' },
location: { name: 'location' },
vin: { name: 'vin' },
vid: { name: 'vid' },
vehicle_type: { name: 'vehicleType' },
vehicle_class: { name: 'vehicleClass' },
creation_date: { name: 'creationDate', type: DateTime },
last_updated: { name: 'lastUpdated', type: DateTime },
port_arrival_date: { name: 'portArrivalDate', type: DateTime },
combined_gross_offer_value: { name: 'combinedGrossOfferValue' },
current_location: { name: 'currentLocation' },
not_visible_online_showroom: { name: 'notVisibleOnlineShowroom' },
nvos_reason: { name: 'nvosReason' },
nvos_reason_one_admin_excluded: { name: 'nvosReasonOneAdminExcluded' },
nvos_reason_linked_to_back_order: { name: 'nvosReasonLinkedToBackOrder' },
included_after_deduplication: { name: 'includedAfterDeduplication' },
unique: { name: 'unique' },
duplicate: { name: 'duplicate' },
duplicate_group: { name: 'duplicateGroup' },
lowest_comm: { name: 'lowestComm' },
rule: { name: 'rule' },
fin: { name: 'fin' },
chassis_number: { name: 'chassisNumber' },
model_year: { name: 'modelYear' },
model_year_code: { name: 'modelYearCode' },
half_model_year_code: { name: 'halfModelYearCode' },
full_model_year_code: { name: 'fullModelYearCode' },
body_style: { name: 'bodyStyle' },
engine: { name: 'engine' },
cesar_id_ship_to_party: { name: 'cesarIdShipToParty' },
vehicle_usage_code: { name: 'vehicleUsageCode' },
acceleration: { name: 'acceleration' },
boot_capacity: { name: 'bootCapacity' },
top_speed: { name: 'topSpeed' },
drive_concept: { name: 'driveConcept' },
combustion_power_hp: { name: 'combustionPowerHp' },
electric_power_kw: { name: 'electricPowerKw' },
electric_power_hp: { name: 'electricPowerHp' },
combined_power_kw: { name: 'combinedPowerKw' },
combined_power_h_p: { name: 'combinedPowerHP' },
under_offer: { name: 'underOffer' },
is_sellable: { name: 'isSellable' },
mbuk_secured: { name: 'mbukSecured' },
is_display_stock: { name: 'isDisplayStock' },
is_specialist_car: { name: 'isSpecialistCar' },
account: { name: 'account' },
product_range: { name: 'productRange' },
is_a_m_g: { name: 'isAMG' },
actual_price: { name: 'actualPrice' },
retail_price__ex_v_a_t: { name: 'retailPrice_ExVAT' },
retail_price__inc_v_a_t: { name: 'retailPrice_IncVAT' },
otr: { name: 'otr' },
nst: { name: 'nst' },
bm7_n_s_t: { name: 'bm7NST' },
electric_range: { name: 'electricRange' },
electric_consumption: { name: 'electricConsumption' },
emission: { name: 'emission' },
emission_directive: { name: 'emissionDirective' },
emission_combined: { name: 'emissionCombined' },
emission_extra_urban: { name: 'emissionExtraUrban' },
emission_urban: { name: 'emissionUrban' },
energy_efficiency_class: { name: 'energyEfficiencyClass' },
wltp_emission_combined: { name: 'wltpEmissionCombined' },
wltp_combined: { name: 'wltpCombined' },
wltp_low: { name: 'wltpLow' },
wltp_medium: { name: 'wltpMedium' },
wltp_high: { name: 'wltpHigh' },
wltp_extra_high: { name: 'wltpExtraHigh' },
total_money_offers_excl_discretionary: { name: 'totalMoneyOffersExclDiscretionary' },
discretionary_money_offer: { name: 'discretionaryMoneyOffer' },
total_money_offers_incl_discretionary: { name: 'totalMoneyOffersInclDiscretionary' },
non_discretionary_n_m_o_count: { name: 'nonDiscretionaryNMOCount' },
non_discretionary_m_o_count: { name: 'nonDiscretionaryMOCount' },
discretionary_n_m_o_count: { name: 'discretionaryNMOCount' },
discretionary_m_o_count: { name: 'discretionaryMOCount' },
total_offer_v_i_p_amount: { name: 'totalOfferVIPAmount' },
stock_level_indicator: { name: 'stockLevelIndicator' },
confirmed_production_date: { name: 'confirmedProductionDate', type: DateTime },
forecasted_arrival_date: { name: 'forecastedArrivalDate', type: DateTime },
}
end
end
class OnlineShowroomStockResponse
include ServiceStack::DTO
# @return [Integer]
attr_accessor :total_vehicles
# @return [List]
attr_accessor :vehicles
def self.properties
{
total_vehicles: { name: 'totalVehicles' },
vehicles: { name: 'vehicles', type: [StockDataRow] },
}
end
end
class OnlineShowroomStockRequest
include ServiceStack::DTO
# @return [List]
attr_accessor :gssns
def self.properties
{
gssns: { name: 'gssns' },
}
end
def response_type() = OnlineShowroomStockResponse
def get_type_name() = 'OnlineShowroomStockRequest'
end
Ruby OnlineShowroomStockRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/OnlineShowroom/Stock HTTP/1.1
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"gssns":["String"]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"totalVehicles":0,"vehicles":[{"commissionNumber":"String","description":"String","salesDescriptionLong":"String","model":"String","colour":"String","colourGroup":"String","fuelType":"String","transmission":"String","transmissionType":"String","packages":"String","lines":"String","upholstery":"String","upholsteryCode":"String","displayStockAgent":"String","location":"String","vin":"String","vid":"String","vehicleType":"String","vehicleClass":"String","creationDate":"\/Date(-62135596800000-0000)\/","lastUpdated":"\/Date(-62135596800000-0000)\/","portArrivalDate":"\/Date(-62135596800000-0000)\/","combinedGrossOfferValue":0,"currentLocation":"String","notVisibleOnlineShowroom":false,"nvosReason":"String","nvosReasonOneAdminExcluded":false,"nvosReasonLinkedToBackOrder":false,"includedAfterDeduplication":false,"unique":false,"duplicate":false,"duplicateGroup":0,"lowestComm":false,"rule":"String","fin":"String","chassisNumber":"String","modelYear":"String","modelYearCode":"String","halfModelYearCode":"String","fullModelYearCode":"String","bodyStyle":"String","engine":"String","cesarIdShipToParty":"String","vehicleUsageCode":"String","acceleration":0,"bootCapacity":0,"topSpeed":0,"driveConcept":"String","combustionPowerHp":0,"electricPowerKw":0,"electricPowerHp":0,"combinedPowerKw":0,"combinedPowerHP":0,"underOffer":false,"isSellable":false,"mbukSecured":false,"isDisplayStock":false,"isSpecialistCar":false,"account":"String","productRange":"String","isAMG":false,"actualPrice":0,"retailPrice_ExVAT":0,"retailPrice_IncVAT":0,"otr":0,"nst":"String","bm7NST":"String","electricRange":0,"electricConsumption":0,"emission":0,"emissionDirective":"String","emissionCombined":"String","emissionExtraUrban":"String","emissionUrban":"String","energyEfficiencyClass":"String","wltpEmissionCombined":"String","wltpCombined":"String","wltpLow":"String","wltpMedium":"String","wltpHigh":"String","wltpExtraHigh":"String","totalMoneyOffersExclDiscretionary":0,"discretionaryMoneyOffer":0,"totalMoneyOffersInclDiscretionary":0,"nonDiscretionaryNMOCount":0,"nonDiscretionaryMOCount":0,"discretionaryNMOCount":0,"discretionaryMOCount":0,"totalOfferVIPAmount":0,"stockLevelIndicator":"String","confirmedProductionDate":"\/Date(-62135596800000-0000)\/","forecastedArrivalDate":"\/Date(-62135596800000-0000)\/"}]}