Sha256: 72190b6819428259d57f141efe60eea50077867df3f6b177f9d86c0f60797a04

Contents?: true

Size: 601 Bytes

Versions: 4

Compression:

Stored size: 601 Bytes

Contents

require 'quick_travel/adapter'

module QuickTravel
  class Vehicle < Adapter
    attr_accessor :id, :vehicle_type_id, :registration, :length, :linked_to, :vehicle_type_name, :details

    def self.create(booking_id, vehicle_types = {})
      options = { booking_id: booking_id, vehicle_types: vehicle_types }
      response = post_and_validate("#{Booking.front_office_base}/#{booking_id}/vehicles.json", options)
      fail AdapterException.new(response) unless response.key?('booking_id')
    end

    def vehicle_type
      VehicleType.all.detect { |vt| vt.id == vehicle_type_id }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
quicktravel_client-1.1.2 lib/quick_travel/vehicle.rb
quicktravel_client-1.1.1 lib/quick_travel/vehicle.rb
quicktravel_client-1.1.0 lib/quick_travel/vehicle.rb
quicktravel_client-1.0.2 lib/quick_travel/vehicle.rb