Class: VinDecoder::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/vin_decoder/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



5
6
7
8
9
10
11
# File 'lib/vin_decoder/client.rb', line 5

def initialize
  config = VinDecoder.configuration || Configuration.new
  @connection = Faraday.new(url: config.base_url) do |faraday|
    faraday.options.timeout = config.timeout
    faraday.adapter Faraday.default_adapter
  end
end

Instance Method Details

#decode(vin) ⇒ Object



13
14
15
16
17
# File 'lib/vin_decoder/client.rb', line 13

def decode(vin)
  response = @connection.get("DecodeVinValuesExtended/#{vin}", format: 'json')

  handle_response(response)
end