Sha256: b4e49b2c248790d0817a36b1ea9c90de9f33c1f011abec3614857e1b50e943ce

Contents?: true

Size: 970 Bytes

Versions: 5

Compression:

Stored size: 970 Bytes

Contents

require "vindetta/decoder/dsl"

module Vindetta
  class Decoder
    class Result
      extend Vindetta::Decoder::DSL

      has_value :make, 26
      has_value :model, 28
      has_value :year, 29, type: :int
      has_value :number_of_doors, 14, type: :int
      has_value :number_of_windows, 40, type: :int
      has_value :seat_belts_type, 79
      has_value :manufacturer_name, 27
      has_value :vehicle_type, 39
      has_value :plant_city, 31
      has_value :body_class, 5
      has_value :primary_fuel_type, 24
      has_value :engine_configuration, 64
      has_value :manufacturer_id, 157, type: :int
      has_value :primary_fuel_type, 24

      def initialize(variables)
        @variables = variables
      end

      def inspect
        "#<Vindetta::Decoder::Response:#{format('0x00%x', (object_id << 1))}>"
      end

      def to_json
        self.class.decoded_attributes.map do |a|
          [a, send(a)]
        end.to_h
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vindetta-0.19.0 lib/vindetta/decoder/result.rb
vindetta-0.17.1 lib/vindetta/decoder/result.rb
vindetta-0.17.0 lib/vindetta/decoder/result.rb
vindetta-0.16.0 lib/vindetta/decoder/result.rb
vindetta-0.15.0 lib/vindetta/decoder/result.rb