Class: AcuityData::Client

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/acuitydata/client.rb

Constant Summary

Constants included from Constants

AcuityData::Constants::BASE_PATH, AcuityData::Constants::BASE_PORT, AcuityData::Constants::BASE_URI

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_token, base_path: BASE_PATH, port: BASE_PORT) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
# File 'lib/acuitydata/client.rb', line 7

def initialize(auth_token, base_path: BASE_PATH, port: BASE_PORT)
  @base_path = base_path
  @port = port
  @auth_token = auth_token
end

Instance Attribute Details

#auth_tokenObject (readonly)

Returns the value of attribute auth_token.



5
6
7
# File 'lib/acuitydata/client.rb', line 5

def auth_token
  @auth_token
end

#base_pathObject (readonly)

Returns the value of attribute base_path.



5
6
7
# File 'lib/acuitydata/client.rb', line 5

def base_path
  @base_path
end

#portObject (readonly)

Returns the value of attribute port.



5
6
7
# File 'lib/acuitydata/client.rb', line 5

def port
  @port
end

Class Method Details

.api_versionObject

This is the version of the API docs this client was built off-of



18
19
20
# File 'lib/acuitydata/client.rb', line 18

def self.api_version
  'v1 2024-03-19'
end

.compatible_api_versionObject



13
14
15
# File 'lib/acuitydata/client.rb', line 13

def self.compatible_api_version
  'v1'
end

Instance Method Details

#makeObject

Endpoints /lookup/make Retrieve make information



25
26
27
# File 'lib/acuitydata/client.rb', line 25

def make
  send_request(http_method: :get, path: "lookup/make")
end

#model(make, year = nil) ⇒ Object

/lookup/model/#make Retrieve model information for make



31
32
33
34
35
36
37
# File 'lib/acuitydata/client.rb', line 31

def model(make, year = nil)
  if year
    send_request(http_method: :get, path: "lookup/model2/#{make}/#{year}")
  else
    send_request(http_method: :get, path: "lookup/model/#{make}")
  end
end

#report(make, model, variant, year, mileage) ⇒ Object

/report/#make/#model/#variant/#year/mileage Retrieve vehicle report using make, model, year, variant and mileage



57
58
59
# File 'lib/acuitydata/client.rb', line 57

def report(make, model, variant, year, mileage)
  send_request(http_method: :get, path: "report/#{make}/#{model}/#{variant}/#{year}/#{mileage}")
end

#variant(make, model, year) ⇒ Object

/lookup/variant/#make/#model/#year Retrieve variant information for make, model and year



51
52
53
# File 'lib/acuitydata/client.rb', line 51

def variant(make, model, year)
  send_request(http_method: :get, path: "lookup/variant/#{make}/#{model}/#{year}")
end

#year(make, model = nil) ⇒ Object

/lookup/year/#make/#model Retrieve year information for make and model



41
42
43
44
45
46
47
# File 'lib/acuitydata/client.rb', line 41

def year(make, model = nil)
  if model
    send_request(http_method: :get, path: "lookup/year/#{make}/#{model}")
  else
    send_request(http_method: :get, path: "lookup/year2/#{make}")
  end
end